3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('zend.exception_ignore_args', 1); function main() { try { foo(false); } catch (Exception $ex) { echo $ex->getMessage() . PHP_EOL; } try { foo(true); } catch (Exception $ex) { echo $ex->getMessage() . PHP_EOL; } } function foo($ok) { $file = new SplFileObject('/tmp/hoge.txt', 'a'); if ($file->flock(LOCK_EX|LOCK_NB) == false) { throw new RuntimeException("Unable lock file"); } bar($file, $ok); // この関数を抜けたときにファイルは閉じられるはず } function bar(SplFileObject $file, $ok) { // なにか処理する if ($ok == false) { // 失敗したので例外を投げる throw new RuntimeException("oops!!!"); } echo "ok\n"; } main();

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)
8.4.120.0120.00923.95
8.4.110.0110.00718.81
8.4.100.0100.01119.13
8.4.90.0070.01320.42
8.4.80.0090.01120.74
8.4.70.0120.00618.16
8.4.60.0100.00718.95
8.4.50.0160.00519.50
8.4.40.0120.00620.26
8.4.30.0070.00323.89
8.4.20.0000.01619.54
8.4.10.0030.00619.77
8.3.250.0130.00717.24
8.3.240.0100.00917.06
8.3.230.0080.00716.51
8.3.220.0070.01218.76
8.3.210.0120.00616.68
8.3.200.0070.00216.57
8.3.190.0110.01116.88
8.3.180.0060.00416.66
8.3.170.0000.01819.02
8.3.160.0160.00318.31
8.3.150.0130.00719.10
8.3.140.0070.00716.69
8.3.130.0040.00418.56
8.3.120.0080.00318.77
8.3.110.0090.00320.94
8.3.100.0030.00524.06
8.3.90.0050.00326.77
8.3.80.0090.00019.36
8.3.70.0150.00416.50
8.3.60.0140.00018.43
8.3.50.0080.00924.49
8.3.40.0140.00718.88
8.3.30.0110.00718.63
8.3.20.0050.00220.76
8.3.10.0060.00321.91
8.3.00.0040.00421.80
8.2.290.0100.00820.73
8.2.280.0110.00818.52
8.2.270.0120.00317.37
8.2.260.0090.00018.36
8.2.250.0040.00418.83
8.2.240.0120.00017.22
8.2.230.0130.00322.58
8.2.220.0060.00637.54
8.2.210.0120.00326.77
8.2.200.0000.00918.18
8.2.190.0090.00616.88
8.2.180.0090.00618.64
8.2.170.0070.00722.96
8.2.160.0130.00022.26
8.2.150.0060.00324.18
8.2.140.0050.00324.66
8.2.130.0050.00326.16
8.2.120.0110.00821.18
8.2.110.0040.01419.45
8.2.100.0040.00817.75
8.2.90.0030.00619.24
8.2.80.0040.00417.97
8.2.70.0000.00979.33
8.2.60.0140.00479.33
8.2.50.0120.00679.33
8.2.40.0140.00379.33
8.2.30.0130.00579.33
8.2.20.0110.00779.33
8.2.10.0170.00079.33
8.2.00.0170.00079.33
8.1.330.0110.00922.03
8.1.320.0110.00916.10
8.1.310.0080.00016.61
8.1.300.0090.00620.32
8.1.290.0060.00318.88
8.1.280.0110.00425.92
8.1.270.0060.00322.44
8.1.260.0090.00026.35
8.1.250.0060.00328.09
8.1.240.0060.00319.09
8.1.230.0120.00017.42
8.1.220.0050.00317.74
8.1.210.0060.00318.77
8.1.200.0130.00479.33
8.1.190.0090.00979.33
8.1.180.0090.00979.33
8.1.170.0190.00079.33
8.1.160.0100.00779.33
8.1.150.0090.00979.33
8.1.140.0090.00979.33
8.1.130.0090.00979.33
8.1.120.0090.00979.33
8.1.110.0120.00679.33
8.1.100.0150.00479.33
8.1.90.0140.00379.33
8.1.80.0130.00479.33
8.1.70.0130.00479.33
8.1.60.0090.00979.33
8.1.50.0110.00779.33
8.1.40.0150.00479.33
8.1.30.0120.00679.33
8.1.20.0120.00879.33
8.1.10.0090.00979.33
8.1.00.0140.00579.33
8.0.300.0000.00918.77
8.0.290.0130.00479.33
8.0.280.0170.00079.33
8.0.270.0140.00579.33
8.0.260.0110.00779.33
8.0.250.0120.00479.33
8.0.240.0190.00079.33
8.0.230.0100.00779.33
8.0.220.0140.00379.33
8.0.210.0100.00779.33
8.0.200.0110.00779.33
8.0.190.0120.00679.33
8.0.180.0090.00979.33
8.0.170.0140.00579.33
8.0.160.0160.00079.33
8.0.150.0140.00579.33
8.0.140.0140.00279.33
8.0.130.0100.00679.33
8.0.120.0180.00079.33
8.0.110.0120.00579.33
8.0.100.0070.01079.33
8.0.90.0120.00479.33
8.0.80.0130.00379.33
8.0.70.0080.00879.33
8.0.60.0140.00479.33
8.0.50.0090.00979.33
8.0.30.0140.00379.33
8.0.20.0140.00379.33
8.0.10.0140.00379.33
8.0.00.0060.01179.33
7.4.330.0090.00379.33
7.4.320.0170.00079.33
7.4.300.0110.00579.33
7.4.290.0080.00879.33
7.4.280.0140.00379.33
7.4.270.0090.00979.33
7.4.260.0160.00379.33
7.4.250.0160.00079.33
7.4.240.0140.00479.33
7.4.230.0130.00379.33
7.4.220.0120.00479.33
7.4.210.0120.00679.33
7.4.200.0160.00079.33
7.4.190.0090.00979.33
7.4.180.0120.00479.33
7.4.160.0060.00979.33
7.4.150.0040.01279.33
7.4.140.0120.00479.33
7.4.130.0130.00379.33
7.4.120.0160.00079.33
7.4.110.0160.00079.33
7.4.100.0100.00679.33
7.4.90.0150.00079.33
7.4.80.0100.00579.33
7.4.70.0130.00379.33
7.4.60.0130.00379.33
7.4.50.0030.01379.33
7.4.40.0110.00579.33
7.4.30.0070.00779.33
7.4.20.0150.00079.33
7.4.10.0140.00079.33
7.4.00.0130.00479.33
7.3.330.0150.00079.33
7.3.320.0120.00379.33
7.3.310.0110.00579.33
7.3.300.0120.00479.33
7.3.290.0050.01179.33
7.3.280.0100.00579.33
7.3.270.0140.00379.33
7.3.260.0160.00079.33
7.3.250.0080.00879.33
7.3.240.0130.00479.33
7.3.230.0130.00379.33
7.3.220.0110.00679.33
7.3.210.0150.00379.33
7.3.200.0170.00079.33
7.3.190.0100.00779.33
7.3.180.0090.00979.33
7.3.170.0100.00779.33
7.3.160.0050.01079.33
7.3.150.0070.00979.33
7.3.140.0130.00379.33
7.3.130.0120.00479.33
7.3.120.0120.00379.33
7.3.110.0160.00079.33
7.3.100.0130.00379.33
7.3.90.0100.00579.33
7.3.80.0110.00479.33
7.3.70.0110.00379.33
7.3.60.0100.00579.33
7.3.50.0150.00079.33
7.3.40.0090.00679.33
7.3.30.0150.00079.33
7.3.20.0120.00379.33
7.3.10.0100.00579.33
7.3.00.0110.00579.33
7.2.340.0120.00379.33
7.2.330.0160.00079.33
7.2.320.0100.00579.33
7.2.310.0110.00379.33
7.2.300.0100.00579.33
7.2.290.0080.00879.33
7.2.280.0070.01079.33
7.2.270.0090.00779.33
7.2.260.0110.00379.33
7.2.250.0110.00479.33
7.2.240.0080.00879.33
7.2.230.0080.00879.33
7.2.220.0080.00879.33
7.2.210.0110.00579.33
7.2.200.0060.00979.33
7.2.190.0130.00979.33
7.2.180.0100.01079.33
7.2.170.0130.00379.33
7.2.160.0100.00579.33
7.2.150.0100.00579.33
7.2.140.0120.00479.33
7.2.130.0000.01679.33
7.2.120.0120.00379.33
7.2.110.0120.00479.33
7.2.100.0150.00079.33
7.2.90.0080.00879.33
7.2.80.0120.00479.33
7.2.70.0140.00279.33
7.2.60.0090.00679.33
7.2.50.0070.00779.33
7.2.40.0120.00579.33
7.2.30.0150.00079.33
7.2.20.0130.00379.33
7.2.10.0170.00379.33
7.2.00.0080.00879.33

preferences:
29.42 ms | 403 KiB | 5 Q