3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function add($val = 0) { $this->stuff[] = $val; } } $x = new Foo(); $x->add(42); echo serialize($x) . "\n"; var_dump($x); echo "\n\n"; class Bar { private $stuff = []; public function add($x = 0) { $this->stuff[] = $x; } } $x = new Bar(); $x->add(42); echo serialize($x) . "\n"; var_dump($x);

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.3.70.0140.00716.88
8.3.60.0110.00716.75
8.3.50.0100.01020.48
8.3.40.0100.00321.91
8.3.30.0130.00618.79
8.3.20.0070.00024.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.190.0120.00916.63
8.2.180.0130.00725.92
8.2.170.0180.00019.21
8.2.160.0070.01022.96
8.2.150.0000.00725.66
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0040.00419.89
8.2.110.0100.00020.47
8.2.100.0040.00817.84
8.2.90.0050.00319.35
8.2.80.0000.00818.03
8.2.70.0030.00517.63
8.2.60.0000.00818.04
8.2.50.0000.00818.07
8.2.40.0030.00618.34
8.2.30.0050.00318.11
8.2.20.0000.00720.48
8.2.10.0000.00817.91
8.2.00.0000.00719.11
8.1.280.0000.01625.92
8.1.270.0040.00423.99
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0000.00918.92
8.1.230.0040.00717.76
8.1.220.0040.00417.79
8.1.210.0030.00518.77
8.1.200.0050.00517.35
8.1.190.0050.00317.35
8.1.180.0080.00018.10
8.1.170.0080.00018.59
8.1.160.0040.00418.88
8.1.150.0040.00418.63
8.1.140.0030.00617.36
8.1.130.0030.00318.80
8.1.120.0000.00717.36
8.1.110.0000.00817.41
8.1.100.0030.00617.46
8.1.90.0040.00417.49
8.1.80.0040.00417.30
8.1.70.0120.00517.42
8.1.60.0160.00317.59
8.1.50.0140.00417.50
8.1.40.0070.01117.39
8.1.30.0120.00617.66
8.1.20.0040.01317.50
8.1.10.0140.00417.52
8.1.00.0080.01217.50
8.0.300.0000.00718.77
8.0.290.0000.00916.63
8.0.280.0080.00020.25
8.0.270.0000.00718.06
8.0.260.0000.00618.34
8.0.250.0000.00716.86
8.0.240.0080.00016.93
8.0.230.0030.00716.96
8.0.220.0000.00816.93
8.0.210.0130.00316.69
8.0.200.0090.00316.89
8.0.190.0050.00316.76
8.0.180.0110.00016.76
8.0.170.0070.00816.78
8.0.160.0080.00516.74
8.0.150.0070.00416.68
8.0.140.0080.00816.71
8.0.130.0110.00516.71
8.0.120.0160.00016.86
8.0.110.0080.00516.82
8.0.100.0130.00316.79
8.0.90.0120.00416.68
8.0.80.0060.00616.74
8.0.70.0110.00416.71
8.0.60.0120.00316.63
8.0.50.0150.00016.76
8.0.30.0050.01016.84
8.0.20.0000.01516.76
8.0.10.0100.00516.74
7.4.330.0050.00015.55
7.4.320.0000.00616.58
7.4.300.0100.00016.56
7.4.290.0130.00316.59
7.4.280.0120.00416.61
7.4.270.0150.00316.45
7.4.260.0140.00516.50
7.4.250.0110.00816.53
7.4.240.0130.00416.51
7.4.230.0140.00316.49
7.4.220.0130.00316.49
7.4.210.0160.00016.48
7.4.200.0170.00016.38
7.4.190.0150.00016.45
7.4.180.0000.00916.66
7.4.160.0050.00316.57
7.4.150.0090.00316.48
7.4.140.0100.00316.34
7.4.130.0100.00716.49
7.4.120.0040.01216.53
7.4.110.0090.00216.34
7.4.100.0080.00316.41
7.4.90.0110.00016.31
7.4.80.0090.00316.43
7.4.70.0090.00616.46
7.4.60.0120.00216.32
7.4.50.0140.00016.34
7.4.40.0090.00516.24
7.4.30.0110.00316.26
7.4.20.0080.00816.52
7.4.10.0120.00316.48
7.4.00.0120.00916.40

preferences:
19.83 ms | 401 KiB | 5 Q