3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); namespace App { class Product { private $id; private $name; private $volumes; /** * Product constructor. * @param int $id * @param string $name * @param array $volumes * @throws \InvalidArgumentException */ public function __construct(int $id, string $name, array $volumes) { $this->id = $id; $this->name = $name; if (count($volumes) === 0) { throw new \InvalidArgumentException('Your product must have 1 product at least.'); } $this->volumes = $this->prepareVolumes($volumes); } private function prepareVolumes(array $volumes) { foreach ($volumes as $volume) { $volume->setProduct($this); } return $volumes; } } class Volume { protected $id; protected $product; protected $description; public function __construct(string $description) { $this->description = $description; } public function setProduct(Product $product) { $this->product = $product; } } class ProductTest { public function __construct() { $volume1 = new Volume('part-1'); $volume2 = new Volume('part-2'); $volume3 = new Volume('part-3'); $product = new Product(1, 'BED', [$volume1, $volume2, $volume3]); $invalidProduct = new Product(2, 'Table', []); } } return new ProductTest(); }

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.130.0120.00717.95
8.4.120.0120.00724.07
8.4.110.0080.00318.78
8.4.100.0160.00617.88
8.4.90.0140.00720.76
8.4.80.0120.00818.92
8.4.70.0090.01320.82
8.4.60.0110.01018.67
8.4.50.0160.00419.54
8.4.40.0150.00619.49
8.4.30.0040.00417.65
8.4.20.0090.00917.93
8.4.10.0100.00717.75
8.3.250.0140.00519.09
8.3.240.0100.00916.48
8.3.230.0050.00318.86
8.3.220.0100.00819.12
8.3.210.0060.00616.71
8.3.200.0040.00516.95
8.3.190.0120.00619.17
8.3.180.0130.00818.52
8.3.170.0140.00419.21
8.3.160.0000.00818.50
8.3.150.0090.00918.84
8.3.140.0080.00016.69
8.3.130.0060.00918.53
8.3.120.0040.00420.98
8.3.110.0110.00820.94
8.3.100.0080.00024.06
8.3.90.0080.00026.77
8.3.80.0000.01017.97
8.3.70.0140.00718.55
8.3.60.0060.00918.43
8.3.50.0180.00322.98
8.3.40.0130.00618.86
8.3.30.0060.00918.84
8.3.20.0080.00020.13
8.3.10.0040.00420.50
8.3.00.0040.00420.70
8.2.290.0090.01117.08
8.2.280.0080.01020.33
8.2.270.0070.00416.79
8.2.260.0040.00419.07
8.2.250.0100.00016.95
8.2.240.0050.00518.64
8.2.230.0000.00822.58
8.2.220.0080.00037.54
8.2.210.0050.00326.77
8.2.200.0060.00316.75
8.2.190.0040.01118.41
8.2.180.0080.01116.75
8.2.170.0110.00722.96
8.2.160.0030.01022.30
8.2.150.0040.00425.66
8.2.140.0080.00424.66
8.2.130.0070.00021.02
8.2.120.0030.00626.35
8.2.110.0070.00322.15
8.2.100.0000.01218.04
8.2.90.0000.00818.26
8.2.80.0060.00319.15
8.2.70.0020.00817.78
8.2.60.0120.00117.76
8.2.50.0080.00517.80
8.2.40.0090.00419.01
8.2.30.0100.00218.26
8.2.20.0100.00217.64
8.2.10.0110.00117.73
8.2.00.0130.00217.75
8.1.330.0120.00816.23
8.1.320.0130.00616.42
8.1.310.0090.00616.88
8.1.300.0150.00418.48
8.1.290.0070.00330.84
8.1.280.0160.00325.92
8.1.270.0080.00023.96
8.1.260.0070.00028.09
8.1.250.0040.00428.09
8.1.240.0070.00323.84
8.1.230.0070.00720.96
8.1.220.0080.00017.74
8.1.210.0000.00818.77
8.1.200.0060.00317.29
8.1.190.0060.00717.05
8.1.180.0040.00817.61
8.1.170.0110.00417.88
8.1.160.0100.00218.89
8.1.150.0070.00518.12
8.1.140.0090.00317.35
8.1.130.0090.00217.51
8.1.120.0080.00417.26
8.1.110.0110.00117.20
8.1.100.0060.00717.45
8.1.90.0060.00517.24
8.1.80.0080.00417.27
8.1.70.0080.00417.31
8.1.60.0070.00517.46
8.1.50.0030.00917.41
8.1.40.0120.00217.32
8.1.30.0090.00417.52
8.1.20.0060.00617.63
8.1.10.0110.00217.42
8.1.00.0070.00517.33
8.0.300.0050.00320.29
8.0.290.0100.00216.75
8.0.280.0080.00317.56
8.0.270.0040.00817.65
8.0.260.0050.00716.96
8.0.250.0040.00716.75
8.0.240.0080.00416.85
8.0.230.0070.00416.92
8.0.220.0100.00216.75
8.0.210.0060.00616.76
8.0.200.0100.00316.85
8.0.190.0080.00416.79
8.0.180.0100.00216.95
8.0.170.0080.00416.96
8.0.160.0100.00216.75
8.0.150.0090.00316.83
8.0.140.0070.00616.74
8.0.130.0080.00514.99
8.0.120.0090.00416.77
8.0.110.0060.00516.79
8.0.100.0120.00016.81
8.0.90.0100.00216.78
8.0.80.0110.00516.82
8.0.70.0060.00716.77
8.0.60.0050.00616.74
8.0.50.0060.00616.79
8.0.30.0090.00916.97
8.0.20.0120.00617.20
8.0.10.0070.00616.92
8.0.00.0120.00716.67
7.4.330.0070.00216.62
7.4.320.0030.00816.61
7.4.300.0080.00416.57
7.4.290.0070.00616.52
7.4.280.0070.00416.57
7.4.270.0090.00316.53
7.4.260.0070.00516.56
7.4.250.0060.00716.60
7.4.240.0080.00316.51
7.4.230.0090.00316.63
7.4.220.0070.00416.53
7.4.210.0090.00816.59
7.4.200.0040.00716.54
7.4.190.0110.00416.58
7.4.180.0160.00016.58
7.4.160.0110.00516.60
7.4.150.0140.00516.99
7.4.140.0090.01217.43
7.4.130.0050.01216.60
7.4.120.0100.00816.56
7.4.110.0100.00716.59
7.4.100.0060.01316.60
7.4.90.0140.00216.66
7.4.80.0090.00917.99
7.4.70.0110.00516.68
7.4.60.0090.00716.56
7.4.50.0090.00516.67
7.4.40.0080.00816.63
7.4.30.0070.00816.60
7.4.20.0110.00416.58
7.4.10.0070.01015.51
7.4.00.0090.00815.35
7.3.330.0080.00214.89
7.3.320.0070.00414.99
7.3.310.0070.00416.51
7.3.300.0090.00216.41
7.3.290.0090.00216.42
7.3.280.0120.00616.43
7.3.270.0130.00716.99
7.3.260.0110.00516.59
7.3.250.0110.00616.46
7.3.240.0070.00916.50
7.3.230.0140.00316.53
7.3.220.0120.00416.58
7.3.210.0140.01016.56
7.3.200.0110.00816.61
7.3.190.0150.00116.49
7.3.180.0040.01316.64
7.3.170.0110.00616.48
7.3.160.0110.00416.51
7.3.150.0160.00016.58
7.3.140.0130.00416.58
7.3.130.0110.00715.37
7.3.120.0090.00815.33
7.3.110.0070.01015.30
7.3.100.0070.00915.44
7.3.90.0100.00515.38
7.3.80.0080.00515.42
7.3.70.0070.00415.34
7.3.60.0030.01215.37
7.3.50.0060.00815.21
7.3.40.0060.00815.33
7.3.30.0060.00615.33
7.3.20.0120.00617.02
7.3.10.0090.00516.91
7.3.00.0080.00816.81
7.2.340.0050.01116.58
7.2.330.0090.00916.72
7.2.320.0110.00516.66
7.2.310.0100.00516.63
7.2.300.0100.00516.68
7.2.290.0070.00916.63
7.2.280.0170.00016.58
7.2.270.0070.00716.58
7.2.260.0080.00815.32
7.2.250.0080.00815.56
7.2.240.0070.00615.41
7.2.230.0070.00815.56
7.2.220.0050.01415.45
7.2.210.0050.00715.50
7.2.200.0060.00915.45
7.2.190.0060.01115.45
7.2.180.0050.01115.35
7.2.170.0080.00615.37
7.2.160.0050.00915.40
7.2.150.0090.00717.21
7.2.140.0100.00417.21
7.2.130.0060.01017.24
7.2.120.0060.00717.17
7.2.110.0070.00717.23
7.2.100.0080.00717.14
7.2.90.0050.00917.35
7.2.80.0050.00917.27
7.2.70.0080.00917.16
7.2.60.0100.00617.19
7.2.50.0060.00817.23
7.2.40.0090.00817.32
7.2.30.0080.00917.18
7.2.20.0060.00917.20
7.2.10.0060.00917.20
7.2.00.0090.00617.15
7.1.330.0070.00716.21
7.1.320.0070.00816.05
7.1.310.0070.00816.05
7.1.300.0080.00716.10
7.1.290.0050.00615.90
7.1.280.0050.00916.13
7.1.270.0070.00815.98
7.1.260.0070.00616.03
7.1.250.0080.00616.12
7.1.240.0020.01016.06
7.1.230.0080.00616.03
7.1.220.0050.00916.07
7.1.210.0050.00916.15
7.1.200.0110.00615.89
7.1.190.0090.00515.97
7.1.180.0060.00816.03
7.1.170.0060.00815.99
7.1.160.0060.00716.04
7.1.150.0080.00616.02
7.1.140.0110.00416.15
7.1.130.0060.00716.14
7.1.120.0050.00916.09
7.1.110.0040.00716.13
7.1.100.0070.00716.03
7.1.90.0040.00916.24
7.1.80.0060.00716.12
7.1.70.0050.00716.22
7.1.60.0080.00516.75
7.1.50.0070.00616.33
7.1.40.0040.01016.14
7.1.30.0070.00815.93
7.1.20.0070.00716.08
7.1.10.0100.00316.02
7.1.00.0070.01817.33
7.0.330.0060.00715.72
7.0.320.0070.00715.79
7.0.310.0030.01115.74
7.0.300.0080.00715.76
7.0.290.0060.00815.73
7.0.280.0070.00315.79
7.0.270.0060.00515.66
7.0.260.0080.00615.74
7.0.250.0080.00515.86
7.0.240.0080.00515.75
7.0.230.0060.00815.92
7.0.220.0080.00515.76
7.0.210.0050.00815.84
7.0.200.0050.00615.94
7.0.190.0080.00415.63
7.0.180.0050.00915.77
7.0.170.0040.00915.73
7.0.160.0070.00515.81
7.0.150.0080.00615.90
7.0.140.0040.00815.75
7.0.130.0040.00915.74
7.0.120.0090.00515.74
7.0.110.0050.00715.76
7.0.100.0050.01316.56
7.0.90.0070.01716.59
7.0.80.0100.01616.59
7.0.70.0080.01416.63
7.0.60.0040.01616.71
7.0.50.0050.01516.74
7.0.40.0060.01515.46
7.0.30.0080.01115.58
7.0.20.0050.01515.48
7.0.10.0040.01515.42
7.0.00.0080.01115.43
5.6.400.0050.00814.93
5.6.390.0060.00814.78
5.6.380.0070.00514.94
5.6.370.0030.01014.63
5.6.360.0080.00814.90
5.6.350.0090.00614.72
5.6.340.0050.00914.96
5.6.330.0040.01015.00
5.6.320.0050.00614.71
5.6.310.0070.00614.86
5.6.300.0040.01014.86
5.6.290.0070.00514.92
5.6.280.0080.01916.11
5.6.270.0040.00814.91
5.6.260.0060.00714.92
5.6.250.0060.01415.98
5.6.240.0050.01315.92
5.6.230.0070.01315.99
5.6.220.0050.01615.96
5.6.210.0050.01415.97
5.6.200.0060.01416.08
5.6.190.0070.01316.12
5.6.180.0080.01116.16
5.6.170.0060.01416.04
5.6.160.0080.01216.02
5.6.150.0060.01316.02
5.6.140.0070.01216.08
5.6.130.0060.01316.06
5.6.120.0050.01415.93
5.6.110.0070.01415.92
5.6.100.0060.01516.13
5.6.90.0070.01116.22
5.6.80.0070.01315.94
5.6.70.0030.01615.87
5.6.60.0060.01415.90
5.6.50.0080.01916.03
5.6.40.0070.01915.88
5.6.30.0040.01915.93
5.6.20.0030.01915.91
5.6.10.0060.02215.93
5.6.00.0110.01515.84
5.5.380.0060.01415.96
5.5.370.0090.01215.82
5.5.360.0060.01915.85
5.5.350.0060.01715.85
5.5.340.0080.01116.05
5.5.330.0070.01315.99
5.5.320.0070.01215.98
5.5.310.0070.01215.87
5.5.300.0090.01115.99
5.5.290.0060.01315.91
5.5.280.0060.01815.90
5.5.270.0060.01216.09
5.5.260.0050.01316.00
5.5.250.0040.01515.84
5.5.240.0060.01415.90
5.5.230.0060.01215.77
5.5.220.0060.01715.86
5.5.210.0040.01415.83
5.5.200.0070.01615.75
5.5.190.0060.01615.78
5.5.180.0100.00915.80
5.5.170.0100.00414.77
5.5.160.0080.02115.73
5.5.150.0090.01415.81
5.5.140.0060.02315.76
5.5.130.0060.02115.79
5.5.120.0050.02015.88
5.5.110.0070.01915.82
5.5.100.0090.01915.81
5.5.90.0090.01515.81
5.5.80.0060.02115.83
5.5.70.0080.01815.69
5.5.60.0060.02015.75
5.5.50.0040.01915.80
5.5.40.0060.01715.73
5.5.30.0080.02015.75
5.5.20.0070.02215.76
5.5.10.0070.02115.61
5.5.00.0060.01915.75

preferences:
16.11 ms | 403 KiB | 5 Q