Given an array of arrays, how would I natural sort the inner arrays based on their values?
Example array:
array (size=2)
0 =>
array (size=1
PHP's usort() allows you to define a custom callback function for sorting:
usort($array, function($a, $b){
if ($a['manager'] == $b['manager']) {
return 0;
}
return ($a['manager'] < $b['manager']) ? -1 : 1;
});
For sorting months, you can use something like date('m', strtotime($a['month']))
to get the month number for comparison. More ways to do that can be found here: convert month from name to number