3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $sizes = array("BAR", "L", "XXXL", "INVALID", "M", "S", "FOO"); function compare($a, $b) { list($a, $b) = array_keys(array("XS", "S", "M", "L", "XL", "XXL", "XXXL"), array($a, $b)); if($a == FALSE || $b == FALSE) return $a < $b; return $a > $b; } usort($sizes, "compare"); print_r($sizes);
Output for 7.0.0 - 7.1.0
Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Array ( [0] => BAR [1] => L [2] => XXXL [3] => INVALID [4] => M [5] => S [6] => FOO )
Output for 5.3.0 - 5.6.28
Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Array ( [0] => S [1] => FOO [2] => M [3] => INVALID [4] => L [5] => XXXL [6] => BAR )
Output for 4.3.0 - 5.2.17
Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Notice: Undefined offset: 1 in /in/NLsaF on line 5 Notice: Undefined offset: 0 in /in/NLsaF on line 5 Array ( [0] => S [1] => FOO [2] => M [3] => INVALID [4] => L [5] => XXXL [6] => BAR )