3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Carro implements IteratorAggregate { private Peca $motor; private Peca $pneus; private Peca $amortecedor; public function __construct( Peca $motor, Peca $pneus, Peca $amortecedor ) { $this->motor = $motor; $this->pneus = $pneus; $this->amortecedor = $amortecedor; } public function __get($atributo) { return $this->$atributo; } public function __set($atributo, $valor) { $this->$atributo = $valor; } public function getIterator() { return new \ArrayIterator([ $this->motor, $this->pneus, $this->amortecedor, ]); } } class Peca { private string $marca; private string $modelo; private float $preco; public function __construct( ?string $marca, string $modelo, float $preco ) { $this->marca = $marca; $this->modelo = $modelo; $this->preco = $preco; } public function __get($atributo) { return $this->$atributo ; } public function __set($atributo, $valor) { $this->$atributo = $valor; } } $carro = new Carro( new Peca('Teste', "1.8", 15000.00), new Peca("Pirelli", "P7", 500.00), new Peca("Cofap", "ar", 1000.00) ); foreach($carro as $peca){ $peca->marca = "VW"; } var_dump($carro);

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.0110.00620.53
8.4.110.0050.00322.60
8.4.100.0120.00917.93
8.4.90.0060.00417.79
8.4.80.0080.00417.82
8.4.70.0060.00318.22
8.4.60.0080.00318.55
8.4.50.0110.01017.84
8.4.40.0120.00619.54
8.4.30.0160.00320.64
8.4.20.0080.00019.74
8.4.10.0030.00622.31
8.3.250.0110.00818.92
8.3.240.0080.00916.70
8.3.230.0050.00516.61
8.3.220.0140.00516.93
8.3.210.0100.00916.90
8.3.200.0110.00816.69
8.3.190.0130.00618.71
8.3.180.0100.00816.78
8.3.170.0000.01916.67
8.3.160.0050.00317.42
8.3.150.0120.00316.89
8.3.140.0040.00418.84
8.3.130.0080.00416.79
8.3.120.0000.00820.85
8.3.110.0050.00518.49
8.3.100.0000.01016.80
8.3.90.0120.00618.77
8.3.80.0040.00419.36
8.3.70.0100.00717.00
8.3.60.0090.00618.55
8.3.50.0080.00823.48
8.3.40.0120.00918.92
8.3.30.0130.00318.82
8.3.20.0000.00724.18
8.3.10.0000.00724.66
8.3.00.0040.00426.16
8.2.290.0100.00920.60
8.2.280.0080.01018.39
8.2.270.0080.00016.73
8.2.260.0080.00016.50
8.2.250.0040.00418.39
8.2.240.0060.00317.13
8.2.230.0150.00420.94
8.2.220.0070.00324.06
8.2.210.0150.00326.77
8.2.200.0090.00016.50
8.2.190.0110.01116.63
8.2.180.0080.00825.92
8.2.170.0070.01119.07
8.2.160.0100.00322.96
8.2.150.0090.00025.66
8.2.140.0080.00024.66
8.2.130.0000.00726.16
8.2.120.0040.01421.12
8.2.110.0070.00322.29
8.2.100.0090.00317.91
8.2.90.0000.00817.75
8.2.80.0100.00019.95
8.2.70.0000.00917.63
8.2.60.0030.00517.63
8.2.50.0030.00718.05
8.2.40.0040.00418.03
8.2.30.0040.00418.07
8.2.20.0050.00218.01
8.2.10.0090.00019.18
8.2.00.0070.00019.25
8.1.330.0110.00816.76
8.1.320.0100.00918.30
8.1.310.0150.00316.36
8.1.300.0040.00415.98
8.1.290.0090.00018.88
8.1.280.0000.01525.92
8.1.270.0060.00323.99
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00620.88
8.1.230.0120.00022.20
8.1.220.0050.00317.74
8.1.210.0030.00618.77
8.1.200.0040.00417.48
8.1.190.0090.00017.35
8.1.180.0030.00518.10
8.1.170.0000.00818.38
8.1.160.0070.00018.94
8.1.150.0060.00318.89
8.1.140.0030.00518.91
8.1.130.0030.00320.21
8.1.120.0090.00017.50
8.1.110.0040.00417.48
8.1.100.0040.00417.40
8.1.90.0030.00717.50
8.1.80.0090.00017.52
8.1.70.0040.00717.37
8.1.60.0030.00617.52
8.1.50.0040.00417.55
8.1.40.0000.00817.57
8.1.30.0080.00017.67
8.1.20.0000.00817.64
8.1.10.0030.00617.60
8.1.00.0000.00817.43
8.0.300.0060.00320.04
8.0.290.0060.00316.88
8.0.280.0030.00318.60
8.0.270.0000.00718.22
8.0.260.0030.00318.43
8.0.250.0040.00417.00
8.0.240.0000.00717.01
8.0.230.0030.00317.07
8.0.220.0030.00316.88
8.0.210.0040.00417.00
8.0.200.0040.00417.04
8.0.190.0000.00817.04
8.0.180.0040.00416.96
8.0.170.0030.00516.91
8.0.160.0000.00816.88
8.0.150.0030.00616.81
8.0.140.0000.00716.95
8.0.130.0060.00013.45
8.0.120.0000.00817.00
8.0.110.0080.00016.85
8.0.100.0040.00417.02
8.0.90.0040.00416.85
8.0.80.0090.00616.96
8.0.70.0040.00417.02
8.0.60.0040.00416.77
8.0.50.0070.00017.00
8.0.30.0110.00817.32
8.0.20.0120.00817.02
8.0.10.0000.00817.17
8.0.00.0150.00416.82
7.4.330.0000.00515.55
7.4.320.0040.00416.67
7.4.300.0060.00016.52
7.4.290.0050.00316.50
7.4.280.0000.00716.55
7.4.270.0040.00416.45
7.4.260.0000.00513.30
7.4.250.0050.00316.57
7.4.240.0030.00316.48
7.4.230.0000.00716.71
7.4.220.0050.00216.57
7.4.210.0110.00616.63
7.4.200.0000.00716.70
7.4.130.0070.01216.56
7.4.120.0080.01416.61
7.4.110.0100.00716.54
7.4.100.0110.00616.68
7.4.90.0120.00616.37
7.4.80.0040.01616.47
7.4.70.0150.00816.46
7.4.60.0090.00916.50
7.4.50.0100.00716.44
7.4.40.0070.01016.35
7.4.30.0070.01016.44
7.4.20.0150.00316.52
7.4.10.0140.00516.54
7.4.00.0090.00916.45
7.3.330.0030.00316.14
7.3.320.0060.00013.14
7.3.310.0030.00316.16
7.3.300.0000.00816.13
7.3.290.0110.00516.17
7.3.280.0070.00716.19
7.3.260.0060.01216.12
7.3.240.0070.01016.30
7.3.230.0110.00516.18
7.3.210.0120.00616.22
7.3.200.0120.00316.22
7.3.190.0100.00716.10
7.3.180.0130.00616.32
7.3.170.0070.01016.27
7.3.160.0120.00416.28
7.3.150.0100.00616.15
7.3.140.0180.00016.28
7.3.130.0080.00816.20
7.3.120.0030.01316.30
7.3.110.0160.00416.23
7.3.100.0140.00416.34
7.3.90.0160.00316.12
7.3.80.0090.01216.21
7.3.70.0110.00716.19
7.3.60.0130.00916.34
7.3.50.0110.00516.18
7.3.40.0100.01016.34
7.3.30.0090.00616.19
7.3.20.0130.00516.23
7.3.10.0100.00716.30
7.3.00.0060.01016.15
7.2.330.0070.01116.30
7.2.320.0090.00916.40
7.2.310.0130.00616.35
7.2.300.0130.00316.15
7.2.290.0030.01616.30
7.2.280.0030.01316.43
7.2.270.0060.01216.36
7.2.260.0170.00316.16
7.2.250.0110.00616.36
7.2.240.0070.01616.27
7.2.230.0100.00716.34
7.2.220.0130.00616.21
7.2.210.0100.01016.42
7.2.200.0200.00916.39
7.2.190.0060.01216.34
7.2.180.0110.01116.33
7.2.170.0090.00916.22
7.2.160.0030.01416.25
7.2.150.0050.01416.50
7.2.140.0110.00616.52
7.2.130.0060.01116.28
7.2.120.0030.01316.25
7.2.110.0130.00516.48
7.2.100.0050.01316.32
7.2.90.0260.01016.23
7.2.80.0130.00316.29
7.2.70.0090.00916.39
7.2.60.0160.00516.31
7.2.50.0130.00716.25
7.2.40.0130.00416.36
7.2.30.0140.00316.46
7.2.20.0160.00016.46
7.2.10.0100.00516.40
7.2.00.0080.00816.20

preferences:
27.36 ms | 403 KiB | 5 Q