PHP Array Ascending Sort -
i've , array, want sort array ascending order [sys_title] key index. should do?
[0] => array ( [sys_id] => 9 [sys_title] => checklist [sys_home] => /cp/system/chl/ ) [1] => array ( [sys_id] => 8 [sys_title] => bakery ordering system [sys_home] => /cp/system/bos/ )
expected result should this:
[0] => array ( [sys_id] => 8 [sys_title] => bakery ordering system [sys_home] => /cp/system/bos/ ) [1] => array ( [sys_id] => 9 [sys_title] => checklist [sys_home] => /cp/system/chl/ )
you can try piece of code:
usort($data,function($a,$b){ return strcmp($a['sys_title'],$b['sys_title']); }); print_r($data);
Comments
Post a Comment