3v4l.org

run code in 300+ PHP versions simultaneously
<? $count = 1000000; function t($a) { return $a + 1; } function tl1(&$a) { $a += 1; } function tl2(&$a) { $a++; } class test { public static function staticTest($a) { return $a + 1; } public function nonStaticTest($a) { return $a + 1; } } $time = microtime(true); $i = 0; $a = 1; while ($i++ < $count) { $a = $a + 1; } echo '$a = $a + 1: ', "\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; while ($i++ < $count) { $a += 1; } echo '$a += 1: ', "\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; while ($i++ < $count) { $a++; } echo '$a++: ', "\t\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; while ($i++ < $count) { ++$a; } echo '++$a: ', "\t\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; while ($i++ < $count) { $a = t($a); } echo '$a = t($a): ', "\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; while ($i++ < $count) { tl1($a); } echo 'tl1($a): ', "\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; while ($i++ < $count) { tl2($a); } echo 'tl2($a): ', "\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; while ($i++ < $count) { test::staticTest($a); } echo 'test::staticTest($a): ', "\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $test = new test; $i = 0; $a = 1; while ($i++ < $count) { $test->nonStaticTest($a); } echo '$test->nonStaticTest($a): ', "\t", (microtime(true) - $time), PHP_EOL;

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.2.110.0030.00621.06
8.2.100.0080.00417.91
8.2.90.0040.00418.16
8.2.80.0040.00417.97
8.2.70.0060.00317.50
8.2.60.0040.00418.03
8.2.50.0040.00418.07
8.2.40.0030.00618.09
8.2.30.0050.00317.95
8.2.20.0000.00817.45
8.2.10.0040.00417.93
8.2.00.0000.00818.11
8.1.240.0100.00317.64
8.1.230.0070.00420.92
8.1.220.0030.00617.74
8.1.210.0030.00518.77
8.1.200.0040.00417.10
8.1.190.0050.00317.00
8.1.180.0040.00418.10
8.1.170.0050.00320.32
8.1.160.0000.00722.02
8.1.150.0040.00418.77
8.1.140.0000.00717.34
8.1.130.0000.00717.69
8.1.120.0030.00317.23
8.1.110.0030.00317.23
8.1.100.0040.00417.20
8.1.90.0040.00417.40
8.1.80.0000.00717.30
8.1.70.0030.00317.36
8.1.60.0040.00417.45
8.1.50.0040.00417.29
8.1.40.0050.00317.38
8.1.30.0050.00317.52
8.1.20.0060.00317.42
8.1.10.0000.00817.43
8.1.00.0070.00417.41
8.0.300.0040.00419.71
8.0.290.0050.00216.75
8.0.280.0030.00318.30
8.0.270.0030.00317.14
8.0.260.0000.00617.23
8.0.250.0030.00516.72
8.0.240.0040.00416.73
8.0.230.0070.00016.84
8.0.220.0070.00016.71
8.0.210.0030.00316.82
8.0.200.0030.00316.81
8.0.190.0050.00316.83
8.0.180.0030.00516.77
8.0.170.0080.00016.66
8.0.160.0040.00416.85
8.0.150.0050.00316.71
8.0.140.0040.00416.63
8.0.130.0000.18713.28
8.0.120.0040.00416.64
8.0.110.0050.00216.67
8.0.100.0040.00416.80
8.0.90.0000.00716.57
8.0.80.0000.01816.82
8.0.70.0040.00416.60
8.0.60.0000.00716.82
8.0.50.0080.00016.73
8.0.30.0150.00916.81
8.0.20.0080.01017.40
8.0.10.0030.00316.85
8.0.00.0070.01216.53
7.4.330.0060.12315.03
7.4.320.0030.00316.39
7.4.300.0030.00316.39
7.4.290.0030.00316.39
7.4.280.0030.00516.38
7.4.270.0030.00316.38
7.4.260.0030.00316.47
7.4.250.0000.00716.41
7.4.240.0030.00316.38
7.4.230.0000.00716.29
7.4.220.0030.01316.38
7.4.210.0030.01016.52
7.4.200.0030.00316.43
7.4.160.0070.00716.60
7.4.150.0110.01217.40
7.4.140.0150.00617.86
7.4.130.0100.00716.41
7.4.120.0110.00616.39
7.4.110.0080.00916.24
7.4.100.0190.00316.41
7.4.90.0080.00816.38
7.4.80.0090.00919.39
7.4.70.0130.00316.40
7.4.60.0090.00916.38
7.4.50.0040.00016.51
7.4.40.0000.01616.21
7.4.30.0110.00716.50
7.3.330.0030.21413.36
7.3.320.0030.22013.35
7.3.310.0000.00716.21
7.3.300.0030.00316.10
7.3.290.0110.00616.14
7.3.280.0090.00716.13
7.3.270.0110.00617.40
7.3.260.0100.01016.46
7.3.250.0090.00816.22
7.3.240.0140.00616.38
7.3.230.0140.01016.46
7.3.210.0120.00616.61
7.3.200.0080.01119.39
7.3.190.0060.01316.24
7.3.180.0100.00716.21
7.3.170.0160.00016.49
7.3.160.0030.01316.14
7.3.10.0100.24216.20
7.3.00.0100.24016.48
7.2.330.0160.00516.36
7.2.320.0060.01616.35
7.2.310.0070.01016.35
7.2.300.0130.00316.51
7.2.290.0090.01216.32
7.2.130.0030.27716.77
7.2.120.0070.26616.82
7.2.110.0070.27716.65
7.2.100.0080.28716.78
7.2.90.0030.26816.71
7.2.80.0070.27316.78
7.2.70.0130.26416.76
7.2.60.0080.25616.77
7.2.50.0120.26516.60
7.2.40.0120.26916.83
7.2.30.0070.26717.02
7.2.20.0130.27116.56
7.2.10.0120.26016.43
7.2.00.0100.26016.83
7.1.250.0080.57015.60
7.1.70.0000.21517.19
7.1.60.0100.25919.50
7.1.50.0100.24617.02
7.1.00.0000.30722.30
7.0.200.0540.24714.77
7.0.140.0000.22021.92
7.0.60.0030.30021.66
7.0.50.0070.28017.94
7.0.40.0070.28020.20
7.0.30.0300.27720.09
7.0.20.0330.26020.06
7.0.10.0070.25320.16
7.0.00.0070.25020.24
5.6.280.0070.58721.02
5.6.210.0070.60320.49
5.6.200.0030.54318.19
5.6.190.0130.76020.61
5.6.180.0430.61320.68
5.6.170.0200.58020.58
5.6.160.0200.61020.51
5.6.150.0100.62318.28
5.6.140.0000.56718.18
5.6.130.0170.59718.13
5.6.120.0070.61321.14
5.6.110.0000.63721.10
5.6.100.0070.57721.15
5.6.90.0070.68720.99
5.6.80.0100.61320.30
5.5.350.4130.55320.50
5.5.340.0030.60017.96
5.5.330.0030.55320.21
5.5.320.1230.60320.27
5.5.310.0170.57020.23
5.5.300.0070.60017.97
5.5.290.0030.64017.99
5.5.280.0070.58020.80
5.5.270.0070.54720.82
5.5.260.0070.60720.89
5.5.250.0100.59020.68
5.5.240.0100.58720.18
5.4.450.0200.59019.55
5.4.440.0300.58019.41
5.4.430.0170.53019.55
5.4.420.0230.54319.54
5.4.410.0100.57719.51
5.4.400.1200.88018.62
5.4.390.1230.88318.89
5.4.380.1130.89018.75
5.4.370.1000.82318.62
5.4.360.1030.85318.62
5.4.350.1130.82718.62
5.4.340.1100.91718.77
5.4.320.1170.82018.60
5.4.310.1070.85718.75
5.4.300.1170.94718.49
5.4.290.1271.03718.80
5.4.280.1100.91718.64
5.4.270.1131.07018.78
5.4.260.1101.05718.78
5.4.250.1171.08018.77
5.4.240.1170.96718.55
5.4.230.1130.90718.79
5.4.220.1030.95318.42
5.4.210.1130.85318.82
5.4.200.1100.94316.71
5.4.190.1030.84318.57
5.4.180.1030.86718.70
5.4.170.1301.07018.77
5.4.160.1100.96318.46
5.4.150.1030.97018.78
5.4.140.1230.86716.49
5.4.130.1230.86716.29
5.4.120.1070.97316.31
5.4.110.1070.90716.31
5.4.100.1200.81716.46
5.4.90.1070.88016.19
5.4.80.1130.91016.21
5.4.70.1271.14716.24
5.4.60.1130.95016.22
5.4.50.1070.86016.38
5.4.40.1100.87016.31
5.4.30.0070.64716.48
5.4.20.0100.51316.21
5.4.10.0300.53016.48

preferences:
58.01 ms | 401 KiB | 5 Q