3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(0); // The original function function a($i){$e=microtime(1)+$i;while(microtime(1)<$e);} // Use 'for' instead of 'while' function b($i){for($e=microtime(1)+$i;microtime(1)<$e;);} // Extract 'microtime' into a variable function c($i){for($f=microtime,$e=$f(1)+$i;$f(1)<$e;);} //var_dump(PHP_VERSION_ID); exit(); // PHP 7 only: initialize $f on its first use //if (70000 <= PHP_VERSION_ID) { // function d($i){for($e=($f=microtime)(1)+$i;$f(1)<$e;);} //} // Test $t0 = microtime(true); a(1); $ta = microtime(true); b(1); $tb = microtime(true); c(1); $tc = microtime(true); if (70000 <= PHP_VERSION_ID) { // d(1); } $td = microtime(true); printf("a(): %.6f\n", $ta-$t0); printf("b(): %.6f\n", $tb-$ta); printf("c(): %.6f\n", $tc-$tb); if (70000 <= PHP_VERSION_ID) { // printf("d(): %.6f\n", $td-$tc); } else { printf("d(): N/A\n"); }

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)
7.2.00.0002.50119.40
7.1.100.0072.49518.05
7.1.70.0002.50116.83
7.1.60.0172.48519.42
7.1.50.0102.49117.08
7.1.00.0032.49722.39
7.0.200.0702.32114.80
7.0.60.0102.47319.92
7.0.50.0072.49317.89
7.0.40.0132.48719.89
7.0.30.0302.47020.00
7.0.20.0232.47719.84
7.0.10.0272.47319.81
7.0.00.0032.49719.72
5.6.280.0002.50020.89
5.6.210.0102.46320.52
5.6.200.0032.49718.13
5.6.190.0072.49320.42
5.6.180.0002.50020.39
5.6.170.0272.47320.34
5.6.160.0072.49320.39
5.6.150.0172.48318.20
5.6.140.0102.49018.14
5.6.130.0072.49318.09
5.6.120.0032.49721.14
5.6.110.0032.47720.90
5.6.100.0032.49721.12
5.6.90.0002.50021.09
5.6.80.0132.48720.45
5.6.70.0232.47720.51
5.5.350.0002.50020.41
5.5.340.0172.46717.95
5.5.330.0032.49720.30
5.5.320.0302.47020.14
5.5.310.0102.49020.15
5.5.300.0072.49317.95
5.5.290.0072.47318.03
5.5.280.0102.49020.74
5.5.270.0002.50020.89
5.5.260.0132.48720.80
5.5.250.0102.49020.54
5.5.240.0132.48720.17
5.4.450.0132.48319.36
5.4.440.0670.74719.25
5.4.430.0570.76019.43
5.4.420.0870.71319.32
5.4.410.0530.74319.28
5.4.400.0630.76719.20
5.4.390.0700.75018.78
5.4.380.0730.76719.09
5.4.370.0530.74719.23
5.4.360.0500.75319.05
5.4.350.0600.74719.32
5.4.340.0670.53319.35
5.4.320.0470.47719.11
5.4.310.0330.61019.05
5.4.300.0470.64718.77
5.4.290.0300.65019.21
5.4.280.0570.32719.18
5.4.270.0470.35018.80
5.4.260.0200.41019.09
5.4.250.0130.56318.90
5.4.240.0730.62318.90
5.4.230.0670.70719.09
5.4.220.0230.76719.25
5.4.210.0230.76718.81
5.4.200.0400.75016.65
5.4.190.0530.73719.02
5.4.180.0170.76719.13
5.4.170.0100.80019.20
5.4.160.0400.75719.14
5.4.150.0100.80319.17
5.4.140.0700.85016.48
5.4.130.0100.91316.34
5.4.120.0200.90316.49
5.4.110.0130.97016.32
5.4.100.0730.25016.43
5.4.90.0170.87316.32
5.4.80.0370.89016.39
5.4.70.0270.98016.34
5.4.60.0002.49716.41
5.4.50.0002.49716.21
5.4.40.0032.49316.49
5.4.30.0132.48316.41
5.4.20.0202.47716.45
5.4.10.2672.23016.51

preferences:
37.7 ms | 400 KiB | 5 Q