3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = array('php__01.png','php__02.png','php__03.png','php_2_01.png','php_2_02.png','php_10_01.png','php_10_02.png','php_9_02.png','php_9_01.png','php_9_03.png'); $cb = function($valueA, $valueB) { $vA = explode('_', $valueA); $vB = explode('_', $valueB); $element = 0; do { $x = $vA[$element] - $vB[$element++]; } while ($x <> 0); return $x; }; usort($arr, $cb); var_dump($arr);
Output for 7.1.0 - 7.3.0rc4
Warning: A non-numeric value encountered in /in/9mGq0 on line 10 Warning: A non-numeric value encountered in /in/9mGq0 on line 10 Warning: A non-numeric value encountered in /in/9mGq0 on line 10 Warning: A non-numeric value encountered in /in/9mGq0 on line 10 Warning: A non-numeric value encountered in /in/9mGq0 on line 10 Warning: A non-numeric value encountered in /in/9mGq0 on line 10 Warning: A non-numeric value encountered in /in/9mGq0 on line 10 Warning: A non-numeric value encountered in /in/9mGq0 on line 10 Warning: A non-numeric value encountered in /in/9mGq0 on line 10 Warning: A non-numeric value encountered in /in/9mGq0 on line 10 Warning: A non-numeric value encountered in /in/9mGq0 on line 10 Warning: A non-numeric value encountered in /in/9mGq0 on line 10 Warning: A non-numeric value encountered in /in/9mGq0 on line 10 Warning: A non-numeric value encountered in /in/9mGq0 on line 10 Warning: A non-numeric value encountered in /in/9mGq0 on line 10 Warning: A non-numeric value encountered in /in/9mGq0 on line 10 Warning: A non-numeric value encountered in /in/9mGq0 on line 10 Warning: A non-numeric value encountered in /in/9mGq0 on line 10 array(10) { [0]=> string(11) "php__01.png" [1]=> string(11) "php__02.png" [2]=> string(11) "php__03.png" [3]=> string(12) "php_2_01.png" [4]=> string(12) "php_2_02.png" [5]=> string(13) "php_10_01.png" [6]=> string(13) "php_10_02.png" [7]=> string(12) "php_9_02.png" [8]=> string(12) "php_9_01.png" [9]=> string(12) "php_9_03.png" }
Output for 7.0.0 - 7.0.20
array(10) { [0]=> string(11) "php__01.png" [1]=> string(11) "php__02.png" [2]=> string(11) "php__03.png" [3]=> string(12) "php_2_01.png" [4]=> string(12) "php_2_02.png" [5]=> string(13) "php_10_01.png" [6]=> string(13) "php_10_02.png" [7]=> string(12) "php_9_02.png" [8]=> string(12) "php_9_01.png" [9]=> string(12) "php_9_03.png" }
Output for 5.6.0 - 5.6.26
array(10) { [0]=> string(13) "php_10_02.png" [1]=> string(12) "php_9_02.png" [2]=> string(12) "php_9_01.png" [3]=> string(12) "php_9_03.png" [4]=> string(13) "php_10_01.png" [5]=> string(12) "php_2_02.png" [6]=> string(11) "php__02.png" [7]=> string(11) "php__03.png" [8]=> string(12) "php_2_01.png" [9]=> string(11) "php__01.png" }