3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $sizes = array("Z", "L", "XXXL", "INVALID", "M", "S", "FOO"); function compare($a, $b) { $sizeincrement = array("XS", "S", "M", "L", "XL", "XXL", "XXXL"); if(!array_search($a, $sizeincrement)) return 1; return array_search($a, $sizeincrement) > array_search($b, $sizeincrement); } usort($sizes, "compare"); print_r($sizes);
Output for 7.0.0 - 7.1.0
Array ( [0] => S [1] => FOO [2] => M [3] => INVALID [4] => L [5] => XXXL [6] => Z )
Output for 4.3.0 - 5.6.28
Array ( [0] => S [1] => M [2] => L [3] => Z [4] => XXXL [5] => INVALID [6] => FOO )