[Solved] Using Cake PHP Sort to sort Array Keys


You cannot sort an simple array by his key in cake. You can only sort like this: (or you can use {n}.{n} )

 $array = (e,h,u,w,r);
 $result = Set::sort($array, '{n}', 'asc');
 pr($result);

For key sorting use ksort php function, or create in cake a ksort function with same properties and use it

ksort( $array );
foreach ( $array as $key => $val ) {
print "$key = $val<br />";
}

solved Using Cake PHP Sort to sort Array Keys