3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php$array = array( 0 => array ( 'id' => '9', 'rus_name' => 'аŸаЕб€аВаАб аКаАб‚аЕаГаОб€аИб', 'en_name' => 'first_cat', 'description' => 'аžаПаИбаАаНаИаЕ', 'title' => 'а—аАаГаОаЛаОаВаОаК', 'route' => 'Admin_AdminController@choke', 'level' => '1', 'link' => '', 'parent_devider_id' => '0', 'devider_or_cat_or_real' =>' cat', 'devider' => '0', 'parent_id' =>' 0', 'order_inside_level' => '2', 'icon' => 'gi-certificate', 'created_at' => '-0001-11-30 00:00:00', 'updated_at' => '-0001-11-30 00:00:00', 'children' => array ( 0 => array ( 'id'=> '11', 'rus_name' => 'а аЕаАаЛ б‚б€аАаНаИб†аА 1', 'en_name' => 'first-real', 'description' => 'аžаПаИбаАаНаИаЕ аПаЕб€аВаОаЙ б€аЕаАаЛбŒаНаОаЙ бб‚б€аАаНаИб†б‹', 'title' => 'аŸаЕб€аВаАб б€аЕаАаЛбŒаНаАб бб‚б€аАаНаИб†аА', 'route' => 'Admin_AdminController@choke', 'level' => '2', 'link' => '', 'parent_devider_id' => '0', 'devider_or_cat_or_real' => 'real', 'devider' => '0', 'parent_id' => '9', 'order_inside_level' => '0', 'icon' => '', 'created_at' => '-0001-11-30 00:00:00', 'updated_at' => '-0001-11-30 00:00:00' ), 1 => array ( 'id'=> '12', 'rus_name' => 'а аЕаАаЛ бб‚б€аАаНаИб†аА 2', 'en_name' => 'second-real', 'description' => 'аžаПаИбаАаНаИаЕ аВб‚аОб€аОаЙ б€аЕаАаЛбŒаНаОаЙ бб‚б€аАаНаИб†б‹', 'title' =>' а’б‚аОб€аАб б€аЕаАаЛбŒаНаАб бб‚б€аАаНаИб†аА', 'route' => 'Admin_AdminController@choke', 'level' => '2', 'link' => '', 'parent_devider_id' =>' 0', 'devider_or_cat_or_real' => 'real', 'devider' => '0', 'parent_id' => '9', 'order_inside_level' => '0', 'icon' => '', 'created_at' => '0001-11-30 00:00:00', 'updated_at' => '-0001-11-30 00:00:00', ) ) ), 1 => array ( 'id'=> '14', 'parent_id' => '0', 'order_inside_level' => '1', 'children' => array ( 0 => array ( 'id'=> '15', 'parent_id' => '14', 'order_inside_level' => '2', ), 1 => array ( 'id'=> '16', 'parent_id' => '14', 'order_inside_level' => '1', 'children' => array ( 0 => array ( 'id'=> '17', 'parent_id' => '16', 'order_inside_level' => '0', ), 1 => array ( 'id'=> '18', 'parent_id' => '16', 'order_inside_level' => '0', 'children' => array ( 0 => array ( 'id'=> '19', 'parent_id' => '18', 'order_inside_level' => '0', ) ) ) ) ) ) )); function fs($array){ usort($array, 'sortByOrder'); }; function sortByOrder($a, $b) { return $a['order_inside_level'] - $b['order_inside_level']; }; fs($array); var_dump($array);?>
based on 9cLfV
Output for 5.3.0 - 5.4.32
<?php$array = array( 0 => array ( 'id' => '9', 'rus_name' => 'аŸаЕб€аВаАб аКаАб‚аЕаГаОб€аИб', 'en_name' => 'first_cat', 'description' => 'аžаПаИбаАаНаИаЕ', 'title' => 'а—аАаГаОаЛаОаВаОаК', 'route' => 'Admin_AdminController@choke', 'level' => '1', 'link' => '', 'parent_devider_id' => '0', 'devider_or_cat_or_real' =>' cat', 'devider' => '0', 'parent_id' =>' 0', 'order_inside_level' => '2', 'icon' => 'gi-certificate', 'created_at' => '-0001-11-30 00:00:00', 'updated_at' => '-0001-11-30 00:00:00', 'children' => array ( 0 => array ( 'id'=> '11', 'rus_name' => 'а аЕаАаЛ б‚б€аАаНаИб†аА 1', 'en_name' => 'first-real', 'description' => 'аžаПаИбаАаНаИаЕ аПаЕб€аВаОаЙ б€аЕаАаЛбŒаНаОаЙ бб‚б€аАаНаИб†б‹', 'title' => 'аŸаЕб€аВаАб б€аЕаАаЛбŒаНаАб бб‚б€аАаНаИб†аА', 'route' => 'Admin_AdminController@choke', 'level' => '2', 'link' => '', 'parent_devider_id' => '0', 'devider_or_cat_or_real' => 'real', 'devider' => '0', 'parent_id' => '9', 'order_inside_level' => '0', 'icon' => '', 'created_at' => '-0001-11-30 00:00:00', 'updated_at' => '-0001-11-30 00:00:00' ), 1 => array ( 'id'=> '12', 'rus_name' => 'а аЕаАаЛ бб‚б€аАаНаИб†аА 2', 'en_name' => 'second-real', 'description' => 'аžаПаИбаАаНаИаЕ аВб‚аОб€аОаЙ б€аЕаАаЛбŒаНаОаЙ бб‚б€аАаНаИб†б‹', 'title' =>' а’б‚аОб€аАб б€аЕаАаЛбŒаНаАб бб‚б€аАаНаИб†аА', 'route' => 'Admin_AdminController@choke', 'level' => '2', 'link' => '', 'parent_devider_id' =>' 0', 'devider_or_cat_or_real' => 'real', 'devider' => '0', 'parent_id' => '9', 'order_inside_level' => '0', 'icon' => '', 'created_at' => '0001-11-30 00:00:00', 'updated_at' => '-0001-11-30 00:00:00', ) ) ), 1 => array ( 'id'=> '14', 'parent_id' => '0', 'order_inside_level' => '1', 'children' => array ( 0 => array ( 'id'=> '15', 'parent_id' => '14', 'order_inside_level' => '2', ), 1 => array ( 'id'=> '16', 'parent_id' => '14', 'order_inside_level' => '1', 'children' => array ( 0 => array ( 'id'=> '17', 'parent_id' => '16', 'order_inside_level' => '0', ), 1 => array ( 'id'=> '18', 'parent_id' => '16', 'order_inside_level' => '0', 'children' => array ( 0 => array ( 'id'=> '19', 'parent_id' => '18', 'order_inside_level' => '0', ) ) ) ) ) ) )); function fs($array){ usort($array, 'sortByOrder'); }; function sortByOrder($a, $b) { return $a['order_inside_level'] - $b['order_inside_level']; }; fs($array); var_dump($array);?>