3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arr = array ( '_fc1' => array ( 'week_day' => 0, 'hours_start' => '13:30:00', 'hours_end' => '17:30:00', ), '_fc2' => array ( 'week_day' => 1, 'hours_start' => '17:0:00', 'hours_end' => '19:30:00', ), '_fc3' => array ( 'week_day' => 2, 'hours_start' => '16:30:00', 'hours_end' => '20:0:00', ), '_fc4' => array ( 'week_day' => 4, 'hours_start' => '12:0:00', 'hours_end' => '17:30:00', ), ); $newArr = array(); foreach($arr as $val) { $newArr[$val['week_day'].$val['hours_start']] = $val; } rsort($newArr); echo print_r($newArr,1);
Output for 4.3.0 - 7.1.0
Array ( [0] => Array ( [week_day] => 4 [hours_start] => 12:0:00 [hours_end] => 17:30:00 ) [1] => Array ( [week_day] => 2 [hours_start] => 16:30:00 [hours_end] => 20:0:00 ) [2] => Array ( [week_day] => 1 [hours_start] => 17:0:00 [hours_end] => 19:30:00 ) [3] => Array ( [week_day] => 0 [hours_start] => 13:30:00 [hours_end] => 17:30:00 ) )