3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array ( array ('B.Osweiler',14.88 ), array ('D.Fales', 3.96), array ('B.Radcliff', 6.4 ), array ('K.Ballage', 13.7 ), array ('J.Langford', 2.8 ), array ('B.Howell', 16.8 ) ); print '<pre>'; print "Before Sort". PHP_EOL;; print_r($array); usort($array, function($a, $b) { return $b['1'] - $a['1']; }); print "After Sort". PHP_EOL; print_r($array); ?>
Output for 7.1.0 - 7.1.21, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
<pre>Before Sort Array ( [0] => Array ( [0] => B.Osweiler [1] => 14.88 ) [1] => Array ( [0] => D.Fales [1] => 3.96 ) [2] => Array ( [0] => B.Radcliff [1] => 6.4 ) [3] => Array ( [0] => K.Ballage [1] => 13.7 ) [4] => Array ( [0] => J.Langford [1] => 2.8 ) [5] => Array ( [0] => B.Howell [1] => 16.8 ) ) After Sort Array ( [0] => Array ( [0] => B.Howell [1] => 16.8 ) [1] => Array ( [0] => B.Osweiler [1] => 14.88 ) [2] => Array ( [0] => K.Ballage [1] => 13.7 ) [3] => Array ( [0] => B.Radcliff [1] => 6.4 ) [4] => Array ( [0] => D.Fales [1] => 3.96 ) [5] => Array ( [0] => J.Langford [1] => 2.8 ) )
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 <pre>Before Sort Array ( [0] => Array ( [0] => B.Osweiler [1] => 14.88 ) [1] => Array ( [0] => D.Fales [1] => 3.96 ) [2] => Array ( [0] => B.Radcliff [1] => 6.4 ) [3] => Array ( [0] => K.Ballage [1] => 13.7 ) [4] => Array ( [0] => J.Langford [1] => 2.8 ) [5] => Array ( [0] => B.Howell [1] => 16.8 ) ) After Sort Array ( [0] => Array ( [0] => B.Howell [1] => 16.8 ) [1] => Array ( [0] => B.Osweiler [1] => 14.88 ) [2] => Array ( [0] => K.Ballage [1] => 13.7 ) [3] => Array ( [0] => B.Radcliff [1] => 6.4 ) [4] => Array ( [0] => D.Fales [1] => 3.96 ) [5] => Array ( [0] => J.Langford [1] => 2.8 ) )

preferences:
144.63 ms | 404 KiB | 168 Q