3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array( 'Second', 'First', 'Twentieth', 'Tenth', 'Third', ); $b = array( '2 a', '1 b', '20 c', '10 d', '3 e', ); array_multisort($b, SORT_NATURAL, $a); var_dump($a, $b);
Output for 5.4.0 - 7.1.0
array(5) { [0]=> string(5) "First" [1]=> string(6) "Second" [2]=> string(5) "Third" [3]=> string(5) "Tenth" [4]=> string(9) "Twentieth" } array(5) { [0]=> string(3) "1 b" [1]=> string(3) "2 a" [2]=> string(3) "3 e" [3]=> string(4) "10 d" [4]=> string(4) "20 c" }
Output for 4.3.2 - 5.3.29
Notice: Use of undefined constant SORT_NATURAL - assumed 'SORT_NATURAL' in /in/rJNBl on line 18 Warning: array_multisort(): Argument #2 is expected to be an array or a sort flag in /in/rJNBl on line 18 array(5) { [0]=> string(6) "Second" [1]=> string(5) "First" [2]=> string(9) "Twentieth" [3]=> string(5) "Tenth" [4]=> string(5) "Third" } array(5) { [0]=> string(3) "2 a" [1]=> string(3) "1 b" [2]=> string(4) "20 c" [3]=> string(4) "10 d" [4]=> string(3) "3 e" }
Output for 4.3.0 - 4.3.1
Notice: Use of undefined constant SORT_NATURAL - assumed 'SORT_NATURAL' in /in/rJNBl on line 18 Warning: array_multisort() [http://www.php.net/function.array-multisort]: Argument #2 is expected to be an array or a sort flag in /in/rJNBl on line 18 array(5) { [0]=> string(6) "Second" [1]=> string(5) "First" [2]=> string(9) "Twentieth" [3]=> string(5) "Tenth" [4]=> string(5) "Third" } array(5) { [0]=> string(3) "2 a" [1]=> string(3) "1 b" [2]=> string(4) "20 c" [3]=> string(4) "10 d" [4]=> string(3) "3 e" }