3v4l.org

run code in 300+ PHP versions simultaneously
<?php /*function sortByLength($a,$b){ return strlen($b)-strlen($a); } $array = array("bbbbb", "dog", "cat", "aaa", "aaaa"); echo usort($array,'sortByLength'); // print_r($sorted);*/ <?php $priorities = array(5, 8, 3, 7, 3); usort($priorities, function($a, $b) { if ($a == $b) { echo "a ($a) is same priority as b ($b), keeping the same\n"; return 0; } else if ($a > $b) { echo "a ($a) is higher priority than b ($b), moving b down array\n"; return -1; } else { echo "b ($b) is higher priority than a ($a), moving b up array\n"; return 1; } }); echo "Sorted priorities:\n"; var_dump($priorities);

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.6.140.0130.08018.15
5.6.130.0170.07318.28
5.6.120.0100.08320.88
5.6.110.0200.07021.11
5.6.100.0030.08321.02
5.6.90.0030.08320.86
5.6.80.0100.07720.39
5.5.300.0030.07018.01
5.5.290.0030.05317.96
5.5.280.0070.08720.61
5.5.270.0100.08320.77
5.5.260.0130.08020.76
5.5.250.0100.07720.68
5.5.240.0100.07020.21
5.4.450.0700.07319.14
5.4.440.0800.05719.56
5.4.430.0670.06319.48
5.4.420.0900.06719.57
5.4.410.0670.06719.47
5.4.400.0830.06718.79
5.4.390.0670.05319.05
5.4.380.0800.05719.05
5.4.370.0730.04719.28
5.4.360.0630.06319.25
5.4.350.0770.04318.78
5.4.340.0630.05319.17
5.4.320.0730.05319.29
5.4.310.0700.05318.95
5.4.300.0770.04019.25
5.4.290.0630.06018.99
5.4.280.0800.07019.08
5.4.270.0600.06318.91
5.4.260.0800.05318.91
5.4.250.0700.05319.23
5.4.240.0800.06719.01
5.4.230.0770.04718.99
5.4.220.0730.05319.36
5.4.210.0630.05718.91
5.4.200.0730.05019.26
5.4.190.0670.05318.77
5.4.180.0700.05719.07
5.4.170.0700.05319.16
5.4.160.0700.05719.06
5.4.150.0600.06319.22
5.4.140.0700.04716.40
5.4.130.0830.04716.71
5.4.120.0730.04716.40
5.4.110.0630.05316.52
5.4.100.0670.04716.21
5.4.90.0670.04316.67
5.4.80.0700.04716.26
5.4.70.0130.03716.34
5.4.60.0030.05016.42
5.4.50.0030.03716.17
5.4.40.0200.04016.22
5.4.30.0270.06716.38
5.4.20.0070.04716.42

preferences:
143.67 ms | 1398 KiB | 7 Q