3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = $array2 = array(array("title" => "Fairy Tail - Ending 19v2 [Lenny]"), array("title" => "Fairy Tail - Ending 19v3 [Kagura]"), array("title" => "Fairy Tail - Ending 19v4 [Mio]"), array("title" => "Fairy Tail - Ending 19v1 [Erza]")); //natsort($array); var_dump($array); usort($array2, function($a, $b) { return ($a['title'] > $b['title']) ? 1 : ($a['title'] < $b['title']) ? -1 : 0; }); var_dump($array2);
based on ZkZLT
Output for 7.0.0 - 7.2.0
array(4) { [0]=> array(1) { ["title"]=> string(32) "Fairy Tail - Ending 19v2 [Lenny]" } [1]=> array(1) { ["title"]=> string(33) "Fairy Tail - Ending 19v3 [Kagura]" } [2]=> array(1) { ["title"]=> string(30) "Fairy Tail - Ending 19v4 [Mio]" } [3]=> array(1) { ["title"]=> string(31) "Fairy Tail - Ending 19v1 [Erza]" } } array(4) { [0]=> array(1) { ["title"]=> string(32) "Fairy Tail - Ending 19v2 [Lenny]" } [1]=> array(1) { ["title"]=> string(33) "Fairy Tail - Ending 19v3 [Kagura]" } [2]=> array(1) { ["title"]=> string(30) "Fairy Tail - Ending 19v4 [Mio]" } [3]=> array(1) { ["title"]=> string(31) "Fairy Tail - Ending 19v1 [Erza]" } }
Output for 5.3.17 - 5.6.28
array(4) { [0]=> array(1) { ["title"]=> string(32) "Fairy Tail - Ending 19v2 [Lenny]" } [1]=> array(1) { ["title"]=> string(33) "Fairy Tail - Ending 19v3 [Kagura]" } [2]=> array(1) { ["title"]=> string(30) "Fairy Tail - Ending 19v4 [Mio]" } [3]=> array(1) { ["title"]=> string(31) "Fairy Tail - Ending 19v1 [Erza]" } } array(4) { [0]=> array(1) { ["title"]=> string(31) "Fairy Tail - Ending 19v1 [Erza]" } [1]=> array(1) { ["title"]=> string(30) "Fairy Tail - Ending 19v4 [Mio]" } [2]=> array(1) { ["title"]=> string(33) "Fairy Tail - Ending 19v3 [Kagura]" } [3]=> array(1) { ["title"]=> string(32) "Fairy Tail - Ending 19v2 [Lenny]" } }