3v4l.org

run code in 300+ PHP versions simultaneously
<?php $user_scores = [ 82 => ['score' => 1, 'time' => 6.442], 34 => ['score' => 1, 'time' => 5.646], 66 => ['score' => 3, 'time' => 1.554], 7 => ['score' => 2, 'time' => 4.442], 99 => ['score' => 4, 'time' => 3.646], 55 => ['score' => 1, 'time' => 2.554] ]; uasort($user_scores, function($a, $b) { return [$b['score'], $a['time']] <=> [$a['score'], $b['time']]; }); var_export($user_scores);
Output for 7.2.0 - 7.2.34, 7.3.0 - 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.19, 8.3.0 - 8.3.4, 8.3.6 - 8.3.7
array ( 99 => array ( 'score' => 4, 'time' => 3.646, ), 66 => array ( 'score' => 3, 'time' => 1.554, ), 7 => array ( 'score' => 2, 'time' => 4.442, ), 55 => array ( 'score' => 1, 'time' => 2.554, ), 34 => array ( 'score' => 1, 'time' => 5.646, ), 82 => array ( 'score' => 1, 'time' => 6.442, ), )
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 array ( 99 => array ( 'score' => 4, 'time' => 3.646, ), 66 => array ( 'score' => 3, 'time' => 1.554, ), 7 => array ( 'score' => 2, 'time' => 4.442, ), 55 => array ( 'score' => 1, 'time' => 2.554, ), 34 => array ( 'score' => 1, 'time' => 5.646, ), 82 => array ( 'score' => 1, 'time' => 6.442, ), )
Output for 7.0.0
array ( 99 => array ( 'score' => 4, 'time' => 3.6459999999999999, ), 66 => array ( 'score' => 3, 'time' => 1.554, ), 7 => array ( 'score' => 2, 'time' => 4.4420000000000002, ), 55 => array ( 'score' => 1, 'time' => 2.5539999999999998, ), 34 => array ( 'score' => 1, 'time' => 5.6459999999999999, ), 82 => array ( 'score' => 1, 'time' => 6.4420000000000002, ), )
Output for 5.6.40
Parse error: syntax error, unexpected '>' in /in/HcqRK on line 14
Process exited with code 255.

preferences:
125.81 ms | 401 KiB | 193 Q