3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @method static LocationType GROUP_OF_STATES() * @method static LocationType STATE() * @method static LocationType REGION() * @method static LocationType CITY() * @method static LocationType DISTRICT() * @method static LocationType ADDRESS() */ class LocationType extends EnumBASE { const GROUP_OF_STATES = "GROUP-OF-STATES"; const STATE = "STATE"; const REGION = "REGION"; const CITY = "CITY"; const DISTRICT = "DISTRICT"; const ADDRESS = "ADDRESS"; } var_dump(LocationType::GROUP_OF_STATES()); var_dump(LocationType::REGION()); var_dump(LocationType::ADDRESS()); abstract class EnumBASE { static function getAll() { $x = new ReflectionClass(static::class); foreach($x->getConstants() as $constantValue) yield new static($constantValue); } private $name; private $value; /** * Constructs by value * * @param int|float|string|bool|null $enumValue */ final function __construct($enumValue) { $valid = false; foreach((new ReflectionClass($this))->getConstants() as $constantName => $constantValue) { if($constantValue === $enumValue) { $this->name = $constantName; $this->value = $constantValue; $valid = true; break; } } if(!$valid) throw new ExceptionDomain("Enum is invalid."); } /** * Constructs by name * * @param string $method * @param mixed[] $params * @return static */ final static function __callStatic($method, $params) { return new static(constant(get_called_class() . "::" . $method)); } /** * TODO * * @return string */ function getName() { return $this->name; } /** * TODO * * @return mixed */ function getValue() { return $this->value; } function __toString() { return $this->getName(); } }

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.0120.00918.55
8.3.50.0110.00318.15
8.3.40.0090.00618.84
8.3.30.0060.00919.03
8.3.20.0000.00820.16
8.3.10.0090.00623.55
8.3.00.0050.00319.04
8.2.180.0100.00716.34
8.2.170.0110.01122.96
8.2.160.0100.00320.34
8.2.150.0090.00624.18
8.2.140.0000.00824.66
8.2.130.0040.01126.16
8.2.120.0030.00719.54
8.2.110.0060.00319.35
8.2.100.0040.00717.97
8.2.90.0000.00819.50
8.2.80.0000.00819.02
8.2.70.0040.00418.04
8.2.60.0000.00818.25
8.2.50.0080.00018.10
8.2.40.0000.00919.48
8.2.30.0040.00419.16
8.2.20.0060.00317.79
8.2.10.0040.00418.05
8.2.00.0080.00017.78
8.1.280.0100.00725.92
8.1.270.0030.00618.77
8.1.260.0070.00026.35
8.1.250.0070.00028.09
8.1.240.0050.00522.14
8.1.230.0040.00820.83
8.1.220.0000.00817.79
8.1.210.0040.00418.95
8.1.200.0030.00617.25
8.1.190.0040.00417.22
8.1.180.0070.00318.10
8.1.170.0080.00018.66
8.1.160.0000.00718.83
8.1.150.0040.00418.90
8.1.140.0080.00017.27
8.1.130.0040.00417.77
8.1.120.0000.00817.34
8.1.110.0040.00417.41
8.1.100.0040.00417.38
8.1.90.0030.00417.41
8.1.80.0070.00017.41
8.1.70.0000.00717.22
8.1.60.0050.00317.42
8.1.50.0060.00317.50
8.1.40.0050.00617.50
8.1.30.0000.00917.45
8.1.20.0040.00417.58
8.1.10.0050.00317.42
8.1.00.0040.00417.52
8.0.300.0070.00020.16
8.0.290.0050.00316.75
8.0.280.0020.00518.51
8.0.270.0030.00517.29
8.0.260.0030.00317.14
8.0.250.0030.00317.06
8.0.240.0070.00016.89
8.0.230.0030.00417.03
8.0.220.0000.00816.99
8.0.210.0040.00416.82
8.0.200.0070.00016.89
8.0.190.0040.00417.02
8.0.180.0080.00017.03
8.0.170.0030.00617.00
8.0.160.0000.00716.95
8.0.150.0000.00716.96
8.0.140.0030.00416.89
8.0.130.0040.00413.35
8.0.120.0060.00316.84
8.0.110.0070.00016.86
8.0.100.0070.00016.86
8.0.90.0040.00417.03
8.0.80.0100.01016.97
8.0.70.0000.00716.84
8.0.60.0000.00716.91
8.0.50.0000.00716.85
8.0.30.0050.01817.08
8.0.20.0160.00517.40
8.0.10.0000.00817.09
8.0.00.0120.00516.84
7.4.330.0020.00215.05
7.4.320.0070.00016.65
7.4.300.0000.00716.55
7.4.290.0000.00716.43
7.4.280.0030.00316.58
7.4.270.0030.00316.60
7.4.260.0040.00316.61
7.4.250.0070.00016.50
7.4.240.0000.00716.51
7.4.230.0070.00016.70
7.4.220.0070.01316.61
7.4.210.0030.01716.45
7.4.200.0030.00316.41
7.4.160.0100.01016.51
7.4.150.0030.01317.40
7.4.140.0120.00717.86
7.4.130.0120.00516.58
7.4.120.0100.00816.44
7.4.110.0110.00816.45
7.4.100.0070.01716.53
7.4.90.0090.00916.61
7.4.80.0030.01419.39
7.4.70.0030.01416.68
7.4.60.0060.00916.45
7.4.50.0000.00816.47
7.4.40.0080.01116.41
7.4.30.0110.00616.55
7.4.00.0100.00715.17
7.3.330.0030.00313.24
7.3.320.0000.00513.25
7.3.310.0040.00416.38
7.3.300.0030.00316.39
7.3.290.0100.00516.34
7.3.280.0110.00716.32
7.3.270.0090.00917.40
7.3.260.0100.00716.22
7.3.250.0060.01116.37
7.3.240.0040.01516.38
7.3.230.0070.01016.47
7.3.210.0110.00716.36
7.3.200.0130.00419.39
7.3.190.0120.00616.43
7.3.180.0030.01816.41
7.3.170.0080.00816.46
7.3.160.0050.01116.39
7.2.330.0090.00916.70
7.2.320.0130.00416.63
7.2.310.0090.00916.82
7.2.300.0120.00616.75
7.2.290.0120.00616.48
7.2.00.0000.01219.67
7.1.100.0030.00918.19
7.1.70.0070.01016.84
7.1.60.0100.01319.22
7.1.50.0070.00416.98
7.1.00.0070.07322.54
7.0.200.0030.00716.87
7.0.140.0030.05322.15
7.0.110.0100.08020.07
7.0.100.0030.08319.94
7.0.90.0130.07719.95
7.0.80.0030.07720.04
7.0.70.0130.08020.08
7.0.60.0000.08319.92
7.0.50.0070.08320.42
7.0.40.0100.07020.19
7.0.30.0100.08320.09
7.0.20.0030.08020.16
7.0.10.0130.07720.27
7.0.00.0200.07320.10
5.6.280.0070.07021.01
5.6.250.0030.04320.52
5.6.240.0130.08020.57
5.6.230.0170.07020.68
5.6.220.0170.06320.54
5.6.210.0100.08020.56
5.6.200.0070.08721.13
5.6.190.0070.08020.96
5.6.180.0030.09320.95
5.6.170.0070.08321.14
5.6.160.0100.07320.97
5.6.150.0070.08020.95
5.6.140.0100.04721.03
5.6.130.0030.08321.28
5.6.120.0030.08721.28
5.6.110.0100.08320.93
5.6.100.0170.07321.27
5.6.90.0200.06721.18
5.6.80.0070.08020.48
5.6.70.0030.06320.34
5.6.60.0100.08020.33
5.6.50.0130.08020.63
5.6.40.0100.04320.30
5.6.30.0030.08020.45
5.6.20.0130.07020.51
5.6.10.0170.07320.51
5.6.00.0070.08020.38
5.5.380.0070.07720.58
5.5.370.0130.03320.43
5.5.360.0070.08320.47
5.5.350.0070.04720.46
5.5.340.0170.04020.83
5.5.330.0100.08020.85
5.5.320.0100.07720.86
5.5.310.0000.05720.82
5.5.300.0130.06720.96
5.5.290.0030.05020.94
5.5.280.0170.06320.92
5.5.270.0070.08720.71
5.5.260.0070.08020.88
5.5.250.0130.07720.79
5.5.240.0100.06320.35
5.5.230.0130.07020.38
5.5.220.0100.07020.38
5.5.210.0170.07320.34
5.5.200.0030.08020.26
5.5.190.0130.06020.11
5.5.180.0030.08720.27
5.5.160.0030.07320.34
5.5.150.0100.06720.25
5.5.140.0070.07720.31
5.5.130.0000.08320.32
5.5.120.0070.05020.31
5.5.110.0030.06320.17
5.5.100.0100.07720.19
5.5.90.0070.08320.18
5.5.80.0070.04319.98
5.5.70.0130.07020.05
5.5.60.0100.07320.02
5.5.50.0200.06320.21
5.5.40.0030.05720.11
5.5.30.0030.04719.98
5.5.20.0170.07320.25
5.5.10.0130.07020.03
5.5.00.0100.07720.24
5.4.450.0070.08319.64
5.4.440.0100.07319.50
5.4.430.0000.08719.32
5.4.420.0130.07019.50
5.4.410.0100.07319.38
5.4.400.0070.08019.09
5.4.390.0170.06319.00
5.4.380.0070.05319.21
5.4.370.0030.08319.00
5.4.360.0000.08319.03
5.4.350.0100.05719.18
5.4.340.0030.07719.16
5.4.320.0130.05019.01
5.4.310.0030.07719.01
5.4.300.0100.06019.18
5.4.290.0170.06719.20
5.4.280.0130.07019.26
5.4.270.0030.08019.18
5.4.260.0030.07719.33
5.4.250.0100.07018.94
5.4.240.0070.08019.02
5.4.230.0070.07719.13
5.4.220.0070.04719.01
5.4.210.0100.07319.08
5.4.200.0100.07319.14
5.4.190.0070.08019.13
5.4.180.0170.07019.18
5.4.170.0030.07319.17
5.4.160.0070.06018.98
5.4.150.0070.07319.22
5.4.140.0030.07316.61
5.4.130.0070.07316.60
5.4.120.0100.06316.38
5.4.110.0070.07016.61
5.4.100.0070.07316.52
5.4.90.0030.07016.63
5.4.80.0100.07016.61
5.4.70.0070.07316.54
5.4.60.0100.07316.39
5.4.50.0030.08016.56
5.4.40.0070.07316.39
5.4.30.0170.06016.34
5.4.20.0070.07016.33
5.4.10.0100.04716.44
5.4.00.0070.07015.80
5.3.290.0170.06314.76
5.3.280.0100.07314.73
5.3.270.0130.07314.84
5.3.260.0070.07714.57
5.3.250.0070.06014.65
5.3.240.0030.04714.76
5.3.230.0070.07314.60
5.3.220.0030.06014.58
5.3.210.0100.07014.80
5.3.200.0070.04314.58
5.3.190.0030.05714.57
5.3.180.0070.06014.65
5.3.170.0030.04314.61
5.3.160.0100.06714.58
5.3.150.0070.05714.71
5.3.140.0130.06714.60
5.3.130.0100.07014.57
5.3.120.0030.07014.68
5.3.110.0070.06314.55
5.3.100.0130.06314.19
5.3.90.0130.05714.01
5.3.80.0030.07314.03
5.3.70.0130.06714.01
5.3.60.0100.07014.23
5.3.50.0000.07013.93
5.3.40.0070.04013.93
5.3.30.0130.05713.93
5.3.20.0100.06313.79
5.3.10.0070.03713.73
5.3.00.0030.03713.62
5.2.170.0030.05711.16
5.2.160.0100.02311.16
5.2.150.0000.03711.23
5.2.140.0070.04311.29
5.2.130.0030.06010.96
5.2.120.0000.06711.18
5.2.110.0000.06311.25
5.2.100.0100.05711.11
5.2.90.0030.06011.17
5.2.80.0100.03311.16
5.2.70.0030.05711.11
5.2.60.0030.05311.29
5.2.50.0030.06311.02
5.2.40.0100.06010.98
5.2.30.0070.04710.98
5.2.20.0030.04710.96
5.2.10.0100.05310.88
5.2.00.0000.04710.72
5.1.60.0000.05310.01
5.1.50.0000.05310.00
5.1.40.0100.0479.96
5.1.30.0070.05310.47
5.1.20.0170.04310.44
5.1.10.0130.04310.05
5.1.00.0000.05710.07
5.0.50.0030.0278.56
5.0.40.0070.0438.40
5.0.30.0100.0608.48
5.0.20.0030.0438.20
5.0.10.0000.0438.17
5.0.00.0100.0608.17
4.4.90.0000.0378.17
4.4.80.0030.0338.17
4.4.70.0170.0138.17
4.4.60.0000.0378.17
4.4.50.0070.0338.17
4.4.40.0070.0438.17
4.4.30.0000.0378.17
4.4.20.0030.0238.17
4.4.10.0030.0278.17
4.4.00.0000.0538.17
4.3.110.0070.0208.17
4.3.100.0000.0378.17
4.3.90.0070.0308.17
4.3.80.0030.0508.17
4.3.70.0070.0308.17
4.3.60.0070.0278.17
4.3.50.0030.0308.17
4.3.40.0000.0338.17
4.3.30.0000.0278.17
4.3.20.0000.0308.17
4.3.10.0000.0338.17
4.3.00.0030.0308.17

preferences:
60.98 ms | 400 KiB | 5 Q