[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 ); … Read more

[Solved] how to sum the array time [closed]

$totalTimeSecs = 0; foreach ($array as $l1) { // Loop outer array foreach ($l1 as $l2) { // Loop inner arrays if (isset($l2[‘jQuery’][‘length’])) { // Check this item has a length list($hours,$mins,$secs) = explode(‘:’,$l2[‘jQuery’][‘length’]); // Split into H:m:s $totalTimeSecs += (int) ltrim($secs,’0′); // Add seconds to total $totalTimeSecs += ((int) ltrim($mins,’0′)) * 60; // Add … Read more