3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $test_cases = array( /* 0 */ array( 'A' , 'B' , 'C' ), /* 1 */ array( 'A' , 'C' , 'B' ), /* 2 */ array( 'B' , 'A' , 'C' ), /* 3 */ array( 'B' , 'C' , 'A' ), /* 4 */ array( 'C' , 'A' , 'B' ), /* 5 */ array( 'C' , 'B' , 'A' ), /* 6 */ array( 'A' , 'B' , 'C' , 'D' ), /* 7 */ array( 'A' , 'B' , 'D' ), /* 8 */ array( 'A' , 'B' , 'B' ), /* 9 */ array( 'A' , 'B' ), /* 10 */ array( 'A' , 'B' , 'C' , 'B' ), ); array_walk($test_cases, 'sort'); var_dump($test_cases);
Output for 7.0.0 - 7.1.0
array(11) { [0]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "C" } [1]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "C" [2]=> string(1) "B" } [2]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "C" } [3]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "C" } [4]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "C" } [5]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "C" } [6]=> array(4) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "C" [3]=> string(1) "D" } [7]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "D" } [8]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "B" } [9]=> array(2) { [0]=> string(1) "A" [1]=> string(1) "B" } [10]=> array(4) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "B" [3]=> string(1) "C" } }
Output for 5.4.0 - 5.6.28
array(11) { [0]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "C" } [1]=> array(3) { [0]=> string(1) "B" [1]=> string(1) "C" [2]=> string(1) "A" } [2]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "C" } [3]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "C" } [4]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "C" } [5]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "C" } [6]=> array(4) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "C" [3]=> string(1) "D" } [7]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "D" } [8]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "B" } [9]=> array(2) { [0]=> string(1) "B" [1]=> string(1) "A" } [10]=> array(4) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "B" [3]=> string(1) "C" } }
Output for 4.3.0 - 5.3.29
array(11) { [0]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "C" } [1]=> array(3) { [0]=> string(1) "B" [1]=> string(1) "C" [2]=> string(1) "A" } [2]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "C" } [3]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "C" } [4]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "C" } [5]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "C" } [6]=> array(4) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "C" [3]=> string(1) "D" } [7]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "D" } [8]=> array(3) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "B" } [9]=> array(2) { [0]=> string(1) "A" [1]=> string(1) "B" } [10]=> array(4) { [0]=> string(1) "A" [1]=> string(1) "B" [2]=> string(1) "B" [3]=> string(1) "C" } }