3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @property stdClass $x * @property stdClass $y */ class C { private $buffer = array(); function __get($key) { if (array_key_exists($key, $this->buffer)) { return $this->buffer[$key]; } $f = 'calc_' . $key; return $this->buffer[$key] = $this->$f(); } function calc_x() {print __METHOD__ . "\n"; $x = new stdClass; $x->y = $this->__get('y'); return $x; } function calc_y() {print __METHOD__ . "\n"; $y = new stdClass; // Set a stub to avoid infinite recursion. $this->buffer['y'] = $y; $y->x = $this->__get('x'); return $y; } } $c = new C; $x = $c->x; $y = $c->y; var_dump($x->y === $y, $y->x === $x); print "\n"; $c = new C; $y = $c->y; $x = $c->x; var_dump($x->y === $y, $y->x === $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.4.120.0090.01120.83
8.4.110.0090.01122.54
8.4.100.0050.00417.59
8.4.90.0120.00917.86
8.4.80.0130.00817.77
8.4.70.0040.00417.78
8.4.60.0160.00320.23
8.4.50.0040.00517.59
8.4.40.0120.00817.76
8.4.30.0070.01417.69
8.4.20.0130.00717.61
8.4.10.0030.00617.54
8.3.250.0130.00318.83
8.3.240.0120.00716.50
8.3.230.0120.00816.61
8.3.220.0050.00316.98
8.3.210.0090.01116.65
8.3.200.0110.00916.59
8.3.190.0090.00719.21
8.3.180.0110.00816.59
8.3.170.0050.00316.48
8.3.160.0030.00618.94
8.3.150.0130.00616.98
8.3.140.0120.00316.48
8.3.130.0040.00816.66
8.3.120.0060.00320.98
8.3.110.0030.00616.54
8.3.100.0040.00418.43
8.3.90.0080.00018.48
8.3.80.0070.00317.97
8.3.70.0150.00716.75
8.3.60.0070.01116.75
8.3.50.0150.00521.21
8.3.40.0070.00718.83
8.3.30.0040.01118.67
8.3.20.0040.00420.36
8.3.10.0050.00323.64
8.3.00.0040.00423.71
8.2.290.0110.00820.48
8.2.280.0110.00718.32
8.2.270.0090.00916.77
8.2.260.0050.00319.07
8.2.250.0070.00716.78
8.2.240.0040.00417.29
8.2.230.0040.00420.94
8.2.220.0070.01424.06
8.2.210.0060.00326.77
8.2.200.0060.00316.63
8.2.190.0100.01316.58
8.2.180.0090.01318.29
8.2.170.0120.00322.96
8.2.160.0170.00320.44
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0040.00419.83
8.2.120.0000.00826.35
8.2.110.0040.00720.57
8.2.100.0110.00017.97
8.2.90.0050.00319.16
8.2.80.0040.00417.97
8.2.70.0060.00317.50
8.2.60.0080.00018.16
8.2.50.0050.00318.10
8.2.40.0080.00022.32
8.2.30.0040.00419.56
8.2.20.0000.00717.63
8.2.10.0000.00718.19
8.2.00.0040.00418.00
8.1.330.0100.00916.44
8.1.320.0080.01220.10
8.1.310.0030.01416.70
8.1.300.0040.00417.97
8.1.290.0060.00330.84
8.1.280.0070.00725.92
8.1.270.0040.00423.99
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0090.00023.76
8.1.230.0040.00720.90
8.1.220.0030.00617.74
8.1.210.0030.00618.77
8.1.200.0060.00317.35
8.1.190.0040.00417.35
8.1.180.0030.00618.10
8.1.170.0040.00418.52
8.1.160.0030.00620.63
8.1.150.0000.00718.82
8.1.140.0000.00819.52
8.1.130.0000.00717.69
8.1.120.0050.00517.43
8.1.110.0000.00817.29
8.1.100.0040.00417.37
8.1.90.0030.00517.31
8.1.80.0040.00417.28
8.1.70.0040.00417.38
8.1.60.0040.00417.51
8.1.50.0040.00417.58
8.1.40.0050.00317.43
8.1.30.0030.00517.61
8.1.20.0050.00317.61
8.1.10.0040.00417.49
8.1.00.0000.00817.55
8.0.300.0060.00318.77
8.0.290.0040.00416.63
8.0.280.0030.00318.49
8.0.270.0070.00017.29
8.0.260.0040.00417.25
8.0.250.0030.00316.87
8.0.240.0050.00316.93
8.0.230.0000.00716.98
8.0.220.0000.00716.91
8.0.210.0070.00016.85
8.0.200.0000.00716.93
8.0.190.0060.00317.01
8.0.180.0050.00316.84
8.0.170.0060.00316.95
8.0.160.0080.00017.03
8.0.150.0030.00316.84
8.0.140.0040.00416.81
8.0.130.0000.00613.35
8.0.120.0040.00416.94
8.0.110.0080.00016.88
8.0.100.0030.00516.92
8.0.90.0000.00816.70
8.0.80.0080.01116.77
8.0.70.0020.00516.85
8.0.60.0000.00816.71
8.0.50.0000.00716.85
8.0.30.0100.01217.01
8.0.20.0090.01117.42
8.0.10.0000.00716.92
8.0.00.0090.00916.83
7.4.330.0000.00516.71
7.4.320.0050.00316.37
7.4.300.0000.00816.50
7.4.290.0050.00216.51
7.4.280.0000.00916.39
7.4.270.0070.00016.57
7.4.260.0030.00616.47
7.4.250.0040.00416.58
7.4.240.0050.00216.60
7.4.230.0000.00816.70
7.4.220.0100.01016.71
7.4.210.0060.00816.47
7.4.200.0000.00816.51
7.4.160.0060.01016.32
7.4.150.0100.01017.40
7.4.140.0130.00417.86
7.4.130.0100.01116.54
7.4.120.0080.01016.37
7.4.110.0150.00316.38
7.4.100.0090.00916.38
7.4.90.0130.00316.59
7.4.80.0090.01319.39
7.4.70.0130.00316.48
7.4.60.0100.00716.68
7.4.50.0110.00416.36
7.4.40.0110.00516.45
7.4.30.0190.00316.64
7.4.00.0130.00314.88
7.3.330.0030.00513.25
7.3.320.0030.00313.21
7.3.310.0000.00716.18
7.3.300.0030.00316.25
7.3.290.0000.00716.39
7.3.280.0090.01016.38
7.3.270.0040.01717.40
7.3.260.0130.00316.30
7.3.250.0080.00916.43
7.3.240.0130.00916.53
7.3.230.0070.01016.39
7.3.210.0070.01016.44
7.3.200.0100.00719.39
7.3.190.0160.00016.64
7.3.180.0100.00716.31
7.3.170.0050.01416.56
7.3.160.0090.00616.56
7.2.330.0150.00816.78
7.2.320.0060.01216.63
7.2.310.0110.00716.80
7.2.300.0080.01116.72
7.2.290.0060.01116.61
7.2.60.0040.01116.64
7.2.00.0060.00919.44
7.1.200.0100.00315.68
7.1.100.0110.00018.26
7.1.70.0030.00617.30
7.1.60.0100.00719.18
7.1.50.0160.01316.68
7.1.00.0070.07322.26
7.0.200.0540.00614.61
7.0.60.0000.08721.87
7.0.50.0030.07717.89
7.0.40.0070.04320.25
7.0.30.0330.07020.21
7.0.20.0330.06320.10
7.0.10.0070.08720.15
7.0.00.0170.05720.33
5.6.280.0100.05321.12
5.6.210.0030.09020.78
5.6.200.0030.07018.19
5.6.190.0030.06320.48
5.6.180.0300.06320.46
5.6.170.0200.05020.71
5.6.160.0070.07720.48
5.6.150.0130.04018.25
5.6.140.0130.07318.18
5.6.130.0130.07018.15
5.6.120.0130.07321.15
5.6.110.0070.05320.99
5.6.100.0130.06320.96
5.6.90.0070.08320.96
5.6.80.0100.07320.29
5.5.350.0170.03720.43
5.5.340.0130.05317.95
5.5.330.0070.05020.13
5.5.320.0400.07720.32
5.5.310.0200.03720.35
5.5.300.0070.05018.05
5.5.290.0130.05717.96
5.5.280.0130.07720.66
5.5.270.0070.03720.77
5.5.260.0100.05020.87
5.5.250.0100.07720.50
5.5.240.0030.05720.24

preferences:
28.46 ms | 403 KiB | 5 Q