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.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.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:
42.42 ms | 406 KiB | 5 Q