3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // Get 10mb of data from /dev/zero try { $infp = fopen('/dev/zero', 'r'); $data = fread($infp, 1024 * 1024 * 10); } finally { if (isset($infp) && $infp !== false) { echo "closing!"; fclose($infp); } } write_data($data); echo "Peak memory usage: ", number_format(memory_get_peak_usage()), " bytes\n"; /** * Bad example of how to write some data to /dev/null */ function write_data($data) { $outfp = fopen('/dev/null', 'w'); fwrite($outfp, $data); fwrite($outfp, "\n"); fclose($outfp); }

Here you find the average performance (time & memory) of each version. A greyed out version indicates it didn't complete successfully (based on exit-code).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.2.00.0080.01229.14
7.1.100.0070.00728.03
7.1.70.0320.01715.32
7.1.60.0700.01333.46
7.1.50.0600.02433.12
7.1.40.0740.01432.71
7.1.30.0750.01032.90
7.1.20.0790.02132.87
7.1.10.0610.01214.93
7.1.00.0560.00414.93
7.0.200.0470.01214.86
7.0.190.0330.00815.03
7.0.180.0570.01414.50
7.0.170.0570.01014.29
7.0.160.0630.00514.48
7.0.150.0350.01714.39
7.0.140.0540.00614.44
7.0.130.0490.00614.68
7.0.120.0370.01714.46
7.0.110.0350.01314.66
7.0.100.0380.00714.43
7.0.90.0300.01114.62
7.0.80.0390.00914.46
7.0.70.0330.01414.54
7.0.60.0280.01614.23
7.0.50.0300.01614.43
7.0.40.0440.01114.38
7.0.30.0340.01514.52
7.0.20.0320.01214.75
7.0.10.0390.01214.35
7.0.00.0330.01414.66
hhvm-3.15.40.1470.259104.95
5.6.300.0340.07620.72
5.6.290.0240.08220.79
5.6.280.0110.07820.96
5.6.270.0220.06220.91
5.6.260.0170.06020.76
5.6.250.0220.05120.92
5.6.240.0170.05620.85
5.6.230.0170.06420.92
5.6.220.0170.06720.91
5.6.210.0250.07320.81
5.6.200.0130.06520.72
5.6.190.0190.08420.92
5.6.180.0130.07520.76
5.6.170.0240.05220.76
5.6.160.0130.07920.82
5.6.150.0320.06620.82
5.6.140.0160.08820.92
5.6.130.0180.08320.79
5.6.120.0130.08720.75
5.6.110.0170.06020.71
5.6.100.0100.07420.96
5.6.90.0220.06120.96
5.6.80.0170.05520.10
5.6.70.0240.05820.23
5.6.60.0240.07020.31
5.6.50.0160.07920.10
5.6.40.0160.08020.07
5.6.30.0210.07820.11
5.6.20.0120.08820.04
5.6.10.0130.08320.06
5.6.00.0190.05220.07