3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); namespace App { class Status { const ACTIVE = 1; const INACTIVE = 2; const SOLD = 3; private $value; private $labels = [ self::ACTIVE => 'Active', self::ACTIVE => 'Inactive', self::ACTIVE => 'Sold', ]; /** * Status constructor. * @param $value */ public function __construct(int $value) { if (in_array($value, $this->labels)) { throw new \InvalidArgumentException('Invalid status'); } $this->value = $value; } public function __toString() { return $this->labels[$this->value]; } } class Product { private $id; private $name; private $status; /** * Product constructor. * @param $id * @param $name * @param $status */ public function __construct(int $id, string $name, Status $status) { $this->id = $id; $this->name = $name; $this->status = $status; } } var_dump(new Product(1, 'Chess board', new Status(Status::SOLD))); }

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.3.60.0110.00418.30
8.3.50.0140.00822.02
8.3.40.0190.00318.57
8.3.30.0030.01918.89
8.3.20.0040.00420.16
8.3.10.0080.00020.61
8.3.00.0000.00821.77
8.2.180.0120.00616.38
8.2.170.0070.01122.96
8.2.160.0040.01122.16
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00421.07
8.2.120.0060.00326.35
8.2.110.0030.00621.13
8.2.100.0040.00818.04
8.2.90.0040.00419.26
8.2.80.0040.00417.97
8.2.70.0030.00617.63
8.2.60.0080.00018.05
8.2.50.0040.00418.09
8.2.40.0050.00320.28
8.2.30.0000.00719.41
8.2.20.0000.00717.62
8.2.10.0030.00618.05
8.2.00.0000.00818.12
8.1.280.0110.00425.92
8.1.270.0030.01722.04
8.1.260.0080.00028.09
8.1.250.0040.00428.09
8.1.240.0060.00322.52
8.1.230.0000.01117.70
8.1.220.0000.00817.74
8.1.210.0090.00018.77
8.1.200.0040.00817.36
8.1.190.0040.00417.23
8.1.180.0060.00318.10
8.1.170.0040.00418.32
8.1.160.0000.00720.77
8.1.150.0040.00418.85
8.1.140.0040.00419.46
8.1.130.0030.00317.58
8.1.120.0070.00017.34
8.1.110.0000.00717.46
8.1.100.0040.00417.53
8.1.90.0040.00417.51
8.1.80.0000.00817.49
8.1.70.0030.00317.40
8.1.60.0000.00717.54
8.1.50.0040.00417.46
8.1.40.0000.00917.53
8.1.30.0030.00617.69
8.1.20.0040.00417.51
8.1.10.0000.00817.57
8.1.00.0000.00717.46
8.0.300.0060.00318.77
8.0.290.0000.00816.75
8.0.280.0000.00718.42
8.0.270.0030.00317.21
8.0.260.0030.00317.25
8.0.250.0060.00317.03
8.0.240.0000.00816.95
8.0.230.0070.00016.96
8.0.220.0000.00716.95
8.0.210.0030.00316.95
8.0.200.0000.00616.97
8.0.190.0000.00816.99
8.0.180.0000.00917.02
8.0.170.0000.00717.01
8.0.160.0050.00216.86
8.0.150.0040.00416.87
8.0.140.0040.00416.74
8.0.130.0060.00013.39
8.0.120.0040.00416.91
8.0.110.0000.00816.99
8.0.100.0000.00717.01
8.0.90.0080.00016.88
8.0.80.0110.00416.95
8.0.70.0000.00717.00
8.0.60.0040.00416.86
8.0.50.0050.00316.95
8.0.30.0110.00817.16
8.0.20.0120.00717.40
8.0.10.0000.00717.11
8.0.00.0080.00916.74
7.4.330.0000.00616.71
7.4.320.0000.00616.48
7.4.300.0000.00616.47
7.4.290.0000.00716.37
7.4.280.0080.00016.54
7.4.270.0050.00316.61
7.4.260.0050.00216.57
7.4.250.0080.00016.54
7.4.240.0040.00416.59
7.4.230.0040.00416.31
7.4.220.0040.01516.49
7.4.210.0140.00716.64
7.4.200.0040.00416.67
7.4.160.0090.00916.27
7.4.150.0150.00717.40
7.4.140.0150.00517.86
7.4.130.0090.00816.47
7.4.120.0140.00616.59
7.4.110.0090.01216.58
7.4.100.0120.00616.54
7.4.90.0130.01016.43
7.4.80.0030.01419.39
7.4.70.0030.01716.68
7.4.60.0040.01616.45
7.4.50.0050.00516.49
7.4.40.0080.00816.24
7.4.30.0090.01016.40
7.4.00.0060.00915.03
7.3.330.0000.00613.12
7.3.320.0000.00513.21
7.3.310.0040.00416.31
7.3.300.0030.00316.32
7.3.290.0060.00916.27
7.3.280.0060.00916.24
7.3.270.0130.01317.40
7.3.260.0060.01216.29
7.3.250.0100.00816.24
7.3.240.0090.00816.39
7.3.230.0100.01316.39
7.3.210.0120.00616.42
7.3.200.0120.00416.43
7.3.190.0030.01716.40
7.3.180.0130.00316.41
7.3.170.0080.00816.49
7.3.160.0050.01116.36
7.3.120.0070.01014.82
7.3.110.0030.01314.70
7.3.100.0090.00914.96
7.3.90.0040.00814.75
7.3.80.0120.00414.63
7.3.70.0040.00714.63
7.3.60.0070.00714.96
7.3.50.0070.00314.62
7.3.40.0080.00414.48
7.3.30.0030.01514.45
7.3.20.0000.01316.55
7.3.10.0080.00416.44
7.3.00.0070.00716.48
7.2.330.0110.00816.53
7.2.320.0080.01116.61
7.2.310.0140.00416.67
7.2.300.0060.01216.51
7.2.290.0120.00616.57
7.2.250.0100.01015.16
7.2.240.0060.00914.94
7.2.230.0000.01414.84
7.2.220.0070.01015.11
7.2.210.0130.00314.98
7.2.200.0030.01214.65
7.2.190.0120.00314.67
7.2.180.0030.01014.93
7.2.170.0030.00914.84
7.2.160.0050.00515.07
7.2.150.0060.00616.76
7.2.140.0060.00916.82
7.2.130.0040.01116.68
7.2.120.0100.00516.83
7.2.110.0050.00616.80
7.2.100.0090.00516.89
7.2.90.0070.00716.97
7.2.80.0090.01116.74
7.2.70.0050.00916.84
7.2.60.0090.00616.79
7.2.50.0030.00816.89
7.2.40.0070.01016.62
7.2.30.0030.01216.66
7.2.20.0060.00916.89
7.2.10.0060.01116.66
7.2.00.0040.00917.69
7.1.330.0070.01015.63
7.1.320.0000.01515.77
7.1.310.0030.01215.76
7.1.300.0070.00315.68
7.1.290.0070.00715.75
7.1.280.0090.00615.68
7.1.270.0130.00315.97
7.1.260.0040.00715.56
7.1.250.0030.01115.93
7.1.240.0070.00715.48
7.1.230.0030.00615.55
7.1.220.0050.00915.67
7.1.210.0040.00815.54
7.1.200.0030.00815.58
7.1.190.0030.01115.72
7.1.180.0110.00515.72
7.1.170.0050.00615.67
7.1.160.0060.00915.78
7.1.150.0100.00615.60
7.1.140.0070.00715.82
7.1.130.0040.00915.54
7.1.120.0120.00315.51
7.1.110.0080.00815.75
7.1.100.0080.00716.57
7.1.90.0100.00415.78
7.1.80.0090.00715.70
7.1.70.0020.01216.26
7.1.60.0100.00816.88
7.1.50.0060.01015.95
7.1.40.0060.00415.75
7.1.30.0080.00715.75
7.1.20.0100.00315.62
7.1.10.0110.00815.67
7.1.00.0020.03317.93
7.0.330.0020.01115.41
7.0.320.0090.00215.33
7.0.310.0030.00815.20
7.0.300.0070.00715.30
7.0.290.0130.00315.14
7.0.280.0070.00515.25
7.0.270.0050.00815.31
7.0.260.0030.01015.53
7.0.250.0070.00515.25
7.0.240.0030.01015.39
7.0.230.0050.01015.40
7.0.220.0060.00715.25
7.0.210.0060.00615.40
7.0.200.0160.00515.14
7.0.190.0000.01215.42
7.0.180.0080.00815.25
7.0.170.0100.00615.35
7.0.160.0020.01015.30
7.0.150.0080.00615.22
7.0.140.0070.00415.12
7.0.130.0050.00615.45
7.0.120.0040.00915.59
7.0.110.0020.01115.31
7.0.100.0050.00515.15
7.0.90.0040.00615.43
7.0.80.0080.00315.31
7.0.70.0100.00215.42
7.0.60.0100.02817.54
7.0.50.0040.02716.16
7.0.40.0070.03515.64
7.0.30.0190.02915.69
7.0.20.0130.01815.74
7.0.10.0050.03315.66
7.0.00.0060.02315.61
5.6.400.0000.01214.30
5.6.390.0000.01514.27
5.6.380.0040.00914.14
5.6.370.0080.00614.11
5.6.360.0030.00914.16
5.6.350.0080.00914.06
5.6.340.0040.00914.22
5.6.330.0050.00814.25
5.6.320.0080.00714.24
5.6.310.0030.01014.07
5.6.300.0070.00814.06
5.6.290.0100.00414.41
5.6.280.0030.02716.54
5.6.270.0050.00814.29
5.6.260.0100.00514.30
5.6.250.0020.00714.01
5.6.240.0050.00814.34
5.6.230.0060.00814.36
5.6.220.0050.00514.21
5.6.210.0070.01616.43
5.6.200.0070.02415.50
5.6.190.0050.02816.35
5.6.180.0100.02216.25
5.6.170.0110.02016.39
5.6.160.0060.03216.17
5.6.150.0050.01915.67
5.6.140.0060.02715.57
5.6.130.0050.02115.38
5.6.120.0130.02516.37
5.6.110.0050.02616.46
5.6.100.0040.01916.45
5.6.90.0040.03616.36
5.6.80.0050.02316.26
5.6.70.0050.00813.99
5.6.60.0070.00814.21
5.6.50.0070.01013.88
5.6.40.0050.00914.21
5.6.30.0090.00314.15
5.6.20.0070.00713.94
5.6.10.0080.00714.25
5.6.00.0060.00714.06
5.5.380.0110.00512.55
5.5.370.0050.00712.32
5.5.360.0020.00812.63
5.5.350.0130.03015.29
5.5.340.0030.02414.31
5.5.330.0060.02115.15
5.5.320.0120.01915.16
5.5.310.0100.02915.09
5.5.300.0020.02014.53
5.5.290.0080.03114.42
5.5.280.0070.03015.43
5.5.270.0040.01715.33
5.5.260.0060.02915.33
5.5.250.0100.02515.25
5.5.240.0060.03015.03
5.5.230.0020.01012.56
5.5.220.0070.00512.54
5.5.210.0050.00612.41
5.5.200.0060.00612.45
5.5.190.0050.00512.46
5.5.180.0070.00512.55
5.5.170.0080.00212.62
5.5.160.0060.00312.44
5.5.150.0020.01012.68
5.5.140.0020.00712.55
5.5.130.0050.00912.71
5.5.120.0020.00912.58
5.5.110.0080.00512.72
5.5.100.0050.00812.38
5.5.90.0030.00912.44
5.5.80.0030.00712.35
5.5.70.0040.01012.41
5.5.60.0070.00512.32
5.5.50.0030.00512.51
5.5.40.0020.00612.54
5.5.30.0040.00512.52
5.5.20.0030.00712.51
5.5.10.0030.00712.56
5.5.00.0040.00612.42

preferences:
51.5 ms | 401 KiB | 5 Q