3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test1() { $str = 'derp'; if ($str != 'files' && $str != 'something' && $str != 'Derrr') { return; } return; } function test2() { $str = 'derp'; switch ($str) { case 'files': case 'something': case 'Derrr': break; default: return; } return; } function runTest1() { $start1 = microtime(1); for ($i = 1; $i < 10000; $i++) { test1(); } $start1 -= microtime(1); return $start1; } function runTest2() { $start2 = microtime(1); for ($i = 1; $i < 10000; $i++) { test2(); } $start2 -= microtime(1); return $start2; } $tests = 10; $tests2 = 0; for($i = 0;$i<$tests;$i++) { $tests2 += runTest2(); } $start2 = $tests2 / $tests; $tests1 = 0; for($i = 0;$i<$tests;$i++) { $tests1 += runTest1(); } $start1 = $tests1 / $tests; if ($start1 < $start2) { $perc = 100-round(($start2 / $start1) * 100,2); echo "Test1 is $perc"."% faster than Test2"; } if ($start2 < $start1) { $perc = 100-round(($start1 / $start2) * 100,2); echo "Test2 is $perc"."% faster than Test1"; }

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.0030.01919.38
7.1.70.0030.02117.30
7.1.60.0070.03519.40
7.1.50.0030.03816.96
7.1.00.0000.05322.43
7.0.200.0090.01516.78
7.0.140.0030.09021.99
7.0.120.0100.08722.04
7.0.60.0100.09319.88
7.0.50.0070.09717.95
7.0.40.0130.06020.40
7.0.30.0300.10320.25
7.0.20.0230.05320.10
7.0.10.0030.06320.10
7.0.00.0030.09320.24
5.6.280.0000.13721.07
5.6.210.0030.09320.47
5.6.200.0170.11718.24
5.6.190.0130.08020.47
5.6.180.0430.08320.55
5.6.170.0200.08020.61
5.6.160.0070.13720.54
5.6.150.0070.10318.27
5.6.140.0070.12318.17
5.6.130.0030.10018.28
5.6.120.0070.11020.98
5.6.110.0070.12721.12
5.6.100.0100.12320.96
5.6.90.0030.13321.00
5.6.80.0100.12020.43
5.5.350.0130.10320.45
5.5.340.0070.09718.00
5.5.330.0070.09320.32
5.5.320.3700.06720.29
5.5.310.0300.08320.43
5.5.300.0200.12018.06
5.5.290.0030.07718.04
5.5.280.0130.10720.88
5.5.270.0070.08720.76
5.5.260.0000.09020.95
5.5.250.0070.07720.59
5.5.240.0130.13020.27
5.4.450.0030.11719.18
5.4.440.0070.10019.51
5.4.430.0030.13319.46
5.4.420.0100.07719.52
5.4.410.0100.10019.41
5.4.400.0100.11018.86
5.4.390.0100.11319.18
5.4.380.0100.10719.11
5.4.370.0100.11019.15
5.4.360.0030.11019.22
5.4.350.0130.08319.24
5.4.340.0030.07319.24
5.4.320.0100.12018.85
5.4.310.0030.12719.15
5.4.300.0000.07719.14
5.4.290.0030.08019.22
5.4.280.0100.07719.24
5.4.270.0130.12319.21
5.4.260.0200.07719.18
5.4.250.0030.12319.14
5.4.240.0070.11018.85
5.4.230.0000.08018.85
5.4.220.0100.09019.23
5.4.210.0100.10319.23
5.4.200.0030.07319.21
5.4.190.0100.12319.21
5.4.180.0030.09019.05
5.4.170.0070.07319.23
5.4.160.0100.12719.13
5.4.150.0100.07019.22
5.4.140.0070.12016.38
5.4.130.0070.12016.41
5.4.120.0030.09016.43
5.4.110.0070.07016.41
5.4.100.0100.11716.45
5.4.90.0100.09716.32
5.4.80.0070.12016.57
5.4.70.0000.07316.57
5.4.60.0130.09016.47
5.4.50.0070.06716.26
5.4.40.0070.06716.64
5.4.30.0000.07316.44
5.4.20.0070.06316.38
5.4.10.0070.06716.44
5.4.00.0030.07715.90
5.3.290.0070.12714.68
5.3.280.0070.12714.63
5.3.270.0170.11014.78
5.3.260.0030.12014.69
5.3.250.0100.12014.61
5.3.240.0100.13014.77
5.3.230.0230.12014.68
5.3.220.0070.13714.61
5.3.210.0070.13314.63
5.3.200.0100.12714.73
5.3.190.0130.13314.66
5.3.180.0030.08014.56
5.3.170.0100.12314.57
5.3.160.0130.12314.60
5.3.150.0070.13014.65
5.3.140.0030.08014.55
5.3.130.0130.07014.71
5.3.120.0070.07314.55
5.3.110.0030.08014.57
5.3.100.0100.06714.13
5.3.90.0070.07014.10
5.3.80.0030.07714.13
5.3.70.0070.07014.19
5.3.60.0100.06714.16
5.3.50.0000.08313.85
5.3.40.0000.07713.97
5.3.30.0030.07313.96
5.3.20.0000.07713.86
5.3.10.0070.07013.81
5.3.00.0000.07313.54
5.2.170.0030.08311.27
5.2.160.0100.08011.30
5.2.150.0000.10011.11
5.2.140.0000.10011.25
5.2.130.0030.08311.21
5.2.120.0000.08711.34
5.2.110.0000.08711.32
5.2.100.0070.08011.21
5.2.90.0030.08711.18
5.2.80.0030.09711.25
5.2.70.0030.08311.16
5.2.60.0000.09011.17
5.2.50.0030.12011.00
5.2.40.0000.10311.21
5.2.30.0000.14011.04
5.2.20.0000.09011.09
5.2.10.0030.12010.97
5.2.00.0100.09710.89
5.1.60.0030.11010.89
5.1.50.0000.09310.89
5.1.40.0030.09310.89
5.1.30.0030.10010.89
5.1.20.0070.08710.89
5.1.10.0000.15310.89
5.1.00.0030.09010.89
5.0.50.0100.18010.89
5.0.40.0000.18010.89
5.0.30.0000.17010.89
5.0.20.0000.18710.89
5.0.10.0030.11710.89
5.0.00.0030.18310.89
4.4.90.0030.11010.89
4.4.80.0030.11010.89
4.4.70.0070.17710.89
4.4.60.0000.15310.89
4.4.50.0000.17710.89
4.4.40.0070.13710.89
4.4.30.0000.11710.89
4.4.20.0000.11710.89
4.4.10.0070.18010.89
4.4.00.0070.15010.89
4.3.110.0070.16310.89
4.3.100.0000.11710.89
4.3.90.0030.19010.89
4.3.80.0030.19710.89
4.3.70.0030.14010.89
4.3.60.0000.18010.89
4.3.50.0030.15010.89
4.3.40.0030.19010.89
4.3.30.0030.12010.89
4.3.20.0030.17310.89
4.3.10.0070.14310.89
4.3.00.0030.16710.89

preferences:
39.38 ms | 400 KiB | 5 Q