3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Orig {} class Override1 {} class Override2 {} class Override3 {} class A { function g () { global $prop, $instance; $newProp = ['override1']; $newInstance = new Override1; $prop=$newProp; $instance=$newInstance; } function ap ($prop, $instance) { $newProp = ['override2']; $newInstance = new Override2; $prop=$newProp; $instance=$newInstance; } function al (&$prop, &$instance) { $newProp = ['override3']; $newInstance = new Override3; $prop=$newProp; $instance=$newInstance; } } $prop = ['orig']; $instance = new Orig; var_dump('Orig:', $prop[0], get_class($instance), '------'); $prop = ['orig']; $instance = new Orig; (new A)->g(); var_dump('As global:', $prop[0], get_class($instance), '------'); $prop = ['orig']; $instance = new Orig; (new A)->ap($prop, $instance); var_dump('As arg:', $prop[0], get_class($instance), '------'); $prop = ['orig']; $instance = new Orig; (new A)->al($prop, $instance); var_dump('As link arg:', $prop[0], get_class($instance), '------');

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.20.0100.01020.45
8.4.10.0110.01117.75
8.3.150.0120.00417.28
8.3.140.0050.00316.86
8.3.130.0040.00416.61
8.3.120.0150.00420.80
8.3.110.0000.00816.49
8.3.100.0070.00316.44
8.3.90.0060.00326.77
8.3.80.0060.00619.36
8.3.70.0120.00918.18
8.3.60.0000.01818.30
8.3.50.0140.00523.60
8.3.40.0110.00718.67
8.3.30.0070.01018.61
8.3.20.0040.00421.74
8.3.10.0050.00322.05
8.3.00.0040.00423.65
8.2.270.0170.00317.26
8.2.260.0070.01116.31
8.2.250.0080.00016.98
8.2.240.0030.00619.14
8.2.230.0120.00620.94
8.2.220.0060.00324.06
8.2.210.0040.00426.77
8.2.200.0000.01218.88
8.2.190.0120.00618.40
8.2.180.0080.00816.63
8.2.170.0060.01022.96
8.2.160.0100.00320.34
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0030.00526.16
8.2.110.0090.00020.52
8.2.100.0040.00817.84
8.2.90.0040.00419.64
8.2.80.0000.00817.97
8.2.70.0050.00317.80
8.2.60.0060.00318.22
8.2.50.0040.00418.10
8.2.40.0060.00319.17
8.2.30.0080.00019.24
8.2.20.0040.00418.00
8.2.10.0000.00819.19
8.2.00.0000.00719.16
8.1.310.0110.00718.38
8.1.300.0040.00418.74
8.1.290.0050.00530.84
8.1.280.0100.00725.92
8.1.270.0080.00022.04
8.1.260.0040.00426.35
8.1.250.0030.01028.09
8.1.240.0100.00022.54
8.1.230.0090.00322.73
8.1.220.0040.00417.78
8.1.210.0030.00718.77
8.1.200.0030.00617.22
8.1.190.0000.00817.23
8.1.180.0000.00819.01
8.1.170.0050.00318.50
8.1.160.0000.00818.97
8.1.150.0040.00419.04
8.1.140.0000.00820.84
8.1.130.0060.00620.23
8.1.120.0030.00317.44
8.1.110.0040.00417.46
8.1.100.0000.00717.39
8.1.90.0040.00417.32
8.1.80.0000.00817.36
8.1.70.0030.00317.42
8.1.60.0090.00017.59
8.1.50.0030.00617.54
8.1.40.0040.00417.54
8.1.30.0030.00517.66
8.1.20.0080.00017.59
8.1.10.0000.00817.52
8.1.00.0040.00417.55
8.0.300.0070.00019.96
8.0.290.0060.00316.63
8.0.280.0030.00318.34
8.0.270.0000.00816.71
8.0.260.0000.00619.95
8.0.250.0030.00316.92
8.0.240.0030.00317.01
8.0.230.0000.00716.91
8.0.220.0000.00716.73
8.0.210.0040.00416.87
8.0.200.0040.00416.81
8.0.190.0000.00716.77
8.0.180.0040.00416.81
8.0.170.0040.00416.73
8.0.160.0030.00416.73
8.0.150.0040.00416.77
8.0.140.0000.00716.75
8.0.130.0030.00313.27
8.0.120.0000.00716.73
8.0.110.0050.00316.76
8.0.100.0080.00016.86
8.0.90.0090.00016.95
8.0.80.0130.00816.83
8.0.70.0080.00016.90
8.0.60.0000.00716.76
8.0.50.0050.00316.80
8.0.30.0040.01517.14
8.0.20.0100.01017.00
8.0.10.0080.00016.88
8.0.00.0090.00916.52
7.4.330.0000.00516.67
7.4.320.0030.00316.34
7.4.300.0000.00716.54
7.4.290.0080.00016.59
7.4.280.0040.00416.54
7.4.270.0060.00516.45
7.4.260.0030.00316.54
7.4.250.0040.00416.62
7.4.240.0050.00316.60
7.4.230.0030.00316.64
7.4.220.0050.00216.72
7.4.210.0050.01516.63
7.4.200.0030.00316.70
7.4.130.0090.00916.66
7.4.120.0110.00716.52
7.4.110.0080.00816.68
7.4.100.0060.01316.52
7.4.90.0100.01016.64
7.4.80.0120.00919.39
7.4.70.0070.01116.44
7.4.60.0100.00716.73
7.4.50.0110.00416.32
7.4.40.0130.01016.71
7.4.20.0130.00316.40
7.4.10.0100.00716.57
7.4.00.0070.01516.49
7.3.330.0070.00016.30
7.3.320.0050.00013.36
7.3.310.0070.00016.35
7.3.300.0060.00016.27
7.3.290.0040.00416.26
7.3.280.0070.01416.37
7.3.260.0110.01416.57
7.3.240.0070.01116.52
7.3.230.0070.01016.51
7.3.210.0060.01216.48
7.3.200.0130.00516.72
7.3.190.0090.00916.43
7.3.180.0060.01016.43
7.3.170.0060.01516.57
7.3.160.0030.01316.40
7.3.130.0100.01016.24
7.3.120.0090.01316.61
7.3.110.0080.00816.64
7.3.100.0070.01016.64
7.3.90.0130.01016.28
7.3.80.0030.01316.63
7.3.70.0060.00916.32
7.3.60.0030.01216.46
7.3.50.0130.00316.51
7.3.40.0060.00916.43
7.3.30.0100.01016.30
7.3.20.0120.00616.32
7.3.10.0130.01316.52
7.3.00.0130.00616.52
7.2.330.0040.01416.53
7.2.320.0030.01416.87
7.2.310.0100.00616.61
7.2.300.0060.01216.46
7.2.290.0060.00916.66
7.2.260.0060.01616.53
7.2.250.0060.01616.61
7.2.240.0030.01316.41
7.2.230.0040.01416.41
7.2.220.0150.01416.60
7.2.210.0140.00316.63
7.2.200.0080.00816.55
7.2.190.0100.00616.50
7.2.180.0140.00316.55
7.2.170.0090.00916.52
7.2.160.0100.01016.53
7.2.150.0090.01316.62
7.2.140.0070.01016.81
7.2.130.0180.00516.63
7.2.120.0120.00816.61
7.2.110.0050.01616.63
7.2.100.0070.01316.55
7.2.90.0090.01316.69
7.2.80.0100.01216.48
7.2.70.0110.00816.67
7.2.60.0070.01116.64
7.2.50.0130.01016.38
7.2.40.0090.01516.63
7.2.30.0120.00616.58
7.2.20.0090.00916.59
7.2.10.0120.00416.57
7.2.00.0140.00316.70

preferences:
28.68 ms | 403 KiB | 5 Q