3v4l.org

run code in 300+ PHP versions simultaneously
<?php class EventStatus { const SUCCESS = 'success'; const STOPPED = 'stopped'; const FAILED = 'failed'; private static $validStatuses = [ self::SUCCESS, self::STOPPED, self::FAILED ]; private $status = self::SUCCESS; public function __construct($aStatus = self::SUCCESS) { $this->status = $this->sanitizeAndValidate($aStatus); } public static function __callStatic($aStatus, $arguments = []) { return new static($aStatus); } public function isSuccess() { return ($this->status == static::SUCCESS); } public function isStopped() { return ($this->status == static::STOPPED); } public function isFailed() { return ($this->status == static::FAILED); } private function sanitize($aStatus) { return strtolower(trim($aStatus)); } private function validate($aStatus) { if (!in_array($aStatus, static::$validStatuses)) { throw new DomainException("Invalid event status [$aStatus]"); } } private function sanitizeAndValidate($aStatus) { $sanitized = $this->sanitize($aStatus); $this->validate($sanitized); return $sanitized; } } $status = EventStatus::Failed(); var_dump($status, $status->isSuccess());

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.0070.01518.68
8.3.50.0190.00521.21
8.3.40.0110.01118.88
8.3.30.0030.01020.16
8.3.20.0060.00320.14
8.3.10.0040.00421.96
8.3.00.0040.00422.52
8.2.180.0110.01116.63
8.2.170.0150.00022.96
8.2.160.0030.01322.00
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0090.00926.16
8.2.120.0060.00320.66
8.2.110.0060.00322.25
8.2.100.0000.01217.91
8.2.90.0050.00319.23
8.2.80.0030.00619.21
8.2.70.0040.00417.50
8.2.60.0060.00317.93
8.2.50.0040.00418.07
8.2.40.0000.00818.16
8.2.30.0040.00419.40
8.2.20.0000.00817.76
8.2.10.0040.00417.75
8.2.00.0040.00417.76
8.1.280.0110.00425.92
8.1.270.0050.00323.99
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0000.00923.83
8.1.230.0070.00719.20
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0090.00017.35
8.1.190.0000.00817.43
8.1.180.0030.00519.01
8.1.170.0040.00418.25
8.1.160.0000.00818.91
8.1.150.0030.00718.72
8.1.140.0040.00417.48
8.1.130.0070.00017.76
8.1.120.0000.00717.48
8.1.110.0050.00317.46
8.1.100.0000.00717.49
8.1.90.0060.00317.49
8.1.80.0040.00417.38
8.1.70.0030.00317.38
8.1.60.0030.00617.61
8.1.50.0080.00017.56
8.1.40.0000.00917.45
8.1.30.0060.00317.55
8.1.20.0090.00017.72
8.1.10.0050.00317.59
8.1.00.0040.00417.50
8.0.300.0040.00418.77
8.0.290.0070.00017.30
8.0.280.0050.00318.46
8.0.270.0000.00717.19
8.0.260.0070.00018.47
8.0.250.0030.00316.94
8.0.240.0030.00516.92
8.0.230.0040.00416.97
8.0.220.0030.00316.89
8.0.210.0000.00716.92
8.0.200.0040.00416.98
8.0.190.0040.00716.99
8.0.180.0000.00816.87
8.0.170.0000.00816.95
8.0.160.0000.00716.91
8.0.150.0070.00016.92
8.0.140.0050.00216.82
8.0.130.0050.00313.38
8.0.120.0000.00716.83
8.0.110.0070.00016.92
8.0.100.0000.00716.74
8.0.90.0000.00816.73
8.0.80.0150.00016.91
8.0.70.0070.00016.95
8.0.60.0000.00816.82
8.0.50.0000.00716.86
8.0.30.0080.01117.21
8.0.20.0130.00817.41
8.0.10.0090.00017.08
8.0.00.0110.00716.70
7.4.330.0000.00715.00
7.4.320.0000.00716.62
7.4.300.0000.00616.43
7.4.290.0000.00716.48
7.4.280.0000.00716.53
7.4.270.0030.00316.41
7.4.260.0030.00313.30
7.4.250.0070.00016.46
7.4.240.0040.00416.56
7.4.230.0030.00316.27
7.4.220.0130.00716.40
7.4.210.0060.00816.54
7.4.200.0040.00416.37
7.4.190.0000.00716.40
7.4.160.0110.00416.25
7.4.150.0140.00317.40
7.4.140.0080.01217.86
7.4.130.0170.00116.51
7.4.120.0090.00916.65
7.4.110.0070.01016.49
7.4.100.0060.01016.43
7.4.90.0130.00316.62
7.4.80.0120.00819.39
7.4.70.0170.00616.49
7.4.60.0070.01316.58
7.4.50.0040.00416.43
7.4.40.0040.01522.77
7.4.30.0120.00916.66
7.4.00.0150.00014.88
7.3.330.0050.00013.34
7.3.320.0030.00313.33
7.3.310.0030.00316.33
7.3.300.0000.00716.27
7.3.290.0090.00616.32
7.3.280.0090.00616.33
7.3.270.0170.00017.40
7.3.260.0070.01416.31
7.3.250.0090.00916.53
7.3.240.0100.00716.35
7.3.230.0080.00816.39
7.3.210.0220.00316.62
7.3.200.0160.01319.39
7.3.190.0100.00716.43
7.3.180.0030.01316.43
7.3.170.0090.01216.33
7.3.160.0030.01316.40
7.3.120.0040.01114.71
7.3.10.0110.00416.54
7.3.00.0090.00716.53
7.2.330.0000.01716.58
7.2.320.0090.00916.43
7.2.310.0060.01216.78
7.2.300.0080.00916.70
7.2.290.0090.00816.71
7.2.130.0110.00616.79
7.2.120.0060.01116.84
7.2.110.0110.00316.63
7.2.100.0070.00916.75
7.2.90.0070.00616.99
7.2.80.0130.00416.65
7.2.70.0110.00816.97
7.2.60.0100.00316.84
7.2.50.0110.01116.74
7.2.40.0080.00616.89
7.2.30.0100.00616.91
7.2.20.0060.00816.77
7.2.10.0060.00916.95
7.2.00.0070.00816.98
7.1.250.0080.00515.62
7.1.70.0070.00317.24
7.1.60.0150.00919.32
7.1.50.0040.02116.70
7.1.00.0000.04722.33
7.0.200.0040.00816.85
7.0.140.0000.07321.95
7.0.100.0100.07320.03
7.0.90.0030.08719.98
7.0.80.0270.08019.89
7.0.70.0130.07319.90
7.0.60.0030.06719.95
7.0.50.0230.08020.26
7.0.40.0000.08320.10
7.0.30.0070.05020.04
7.0.20.0170.08720.04
7.0.10.0000.08019.98
7.0.00.0100.08720.14
5.6.280.0070.07021.13
5.6.250.0030.07020.55
5.6.240.0130.05720.68
5.6.230.0100.08720.60
5.6.220.0100.07020.59
5.6.210.0070.08720.76
5.6.200.0100.06321.05
5.6.190.0170.07321.01
5.6.180.0100.07721.05
5.6.170.0070.04321.09
5.6.160.0030.05720.95
5.6.150.0170.07721.01
5.6.140.0170.07321.13
5.6.130.0100.07321.03
5.6.120.0030.08021.17
5.6.110.0030.05321.08
5.6.100.0000.09020.97
5.6.90.0100.07021.00
5.6.80.0130.04020.35
5.6.70.0070.05720.47
5.6.60.0070.05320.42
5.6.50.0130.05020.57
5.6.40.0070.03720.40
5.6.30.0070.03720.39
5.6.20.0070.07020.40
5.6.10.0100.06320.37
5.6.00.0130.06720.44
5.5.380.0130.07020.42
5.5.370.0030.09020.37
5.5.360.0030.09020.39
5.5.350.0130.08020.42
5.5.340.0100.07720.94
5.5.330.0130.04020.93
5.5.320.0100.07720.93
5.5.310.0070.07720.89
5.5.300.0000.05320.82
5.5.290.0070.06720.89
5.5.280.0030.09020.85
5.5.270.0070.07020.89
5.5.260.0130.05320.93
5.5.250.0170.07320.57
5.5.240.0100.07720.22
5.5.230.0130.07720.14
5.5.220.0030.04720.20
5.5.210.0000.07320.27
5.5.200.0030.03720.17
5.5.190.0130.08320.26
5.5.180.0030.06020.24
5.5.160.0100.05020.28
5.5.150.0070.08720.27
5.5.140.0100.05020.23
5.5.130.0030.05720.18
5.5.120.0030.06320.25
5.5.110.0100.07320.27
5.5.100.0130.07020.09
5.5.90.0170.06020.14
5.5.80.0100.04020.11
5.5.70.0070.07720.14
5.5.60.0070.04320.11
5.5.50.0070.07720.17
5.5.40.0130.05719.95
5.5.30.0130.05720.09
5.5.20.0070.05020.14
5.5.10.0070.07720.11
5.5.00.0000.04720.13
5.4.450.0130.04019.48
5.4.440.0070.07319.55
5.4.430.0130.05719.42
5.4.420.0070.05719.22
5.4.410.0130.06019.09
5.4.400.0070.06719.05
5.4.390.0000.06018.89
5.4.380.0070.06719.20
5.4.370.0030.07318.84
5.4.360.0030.07719.21
5.4.350.0030.08019.15
5.4.340.0000.05318.91
5.4.320.0030.07319.05
5.4.310.0170.03719.04
5.4.300.0030.07319.23
5.4.290.0100.03719.23
5.4.280.0070.08019.21
5.4.270.0100.05019.07
5.4.260.0100.07019.16
5.4.250.0070.07019.22
5.4.240.0100.05719.11
5.4.230.0070.07719.02
5.4.220.0170.05719.09
5.4.210.0000.08018.85
5.4.200.0130.06718.87
5.4.190.0030.06319.16
5.4.180.0030.07719.13
5.4.170.0100.06318.84
5.4.160.0070.04019.11
5.4.150.0100.07719.10
5.4.140.0100.07016.15
5.4.130.0100.07316.14
5.4.120.0030.07316.14
5.4.110.0100.05716.32
5.4.100.0070.07016.34
5.4.90.0030.07316.39
5.4.80.0100.06316.49
5.4.70.0030.05016.34
5.4.60.0130.05716.34
5.4.50.0200.04316.41
5.4.40.0170.06316.36
5.4.30.0130.06316.44
5.4.20.0100.04016.39
5.4.10.0170.06316.45
5.4.00.0130.05315.84
5.3.290.0070.08014.69
5.3.280.0030.06714.71
5.3.270.0030.04714.71
5.3.260.0030.04314.59
5.3.250.0000.05714.69
5.3.240.0000.07714.69
5.3.230.0000.06314.52
5.3.220.0030.04014.53
5.3.210.0100.06314.59
5.3.200.0130.04314.62
5.3.190.0130.05314.53
5.3.180.0100.03714.59
5.3.170.0100.07314.50
5.3.160.0130.06314.53
5.3.150.0130.07014.56
5.3.140.0130.06714.61
5.3.130.0030.08014.46
5.3.120.0130.06714.55
5.3.110.0070.06714.61
5.3.100.0030.08313.98
5.3.90.0100.07314.12
5.3.80.0030.06714.03
5.3.70.0030.08314.08
5.3.60.0070.06014.09
5.3.50.0070.03313.93
5.3.40.0070.06314.00
5.3.30.0100.06013.99
5.3.20.0100.03013.82
5.3.10.0170.06313.56
5.3.00.0030.04013.55
5.2.170.0100.06011.53
5.2.160.0030.06011.53
5.2.150.0070.05711.53
5.2.140.0100.06011.53
5.2.130.0000.03311.53
5.2.120.0100.05711.53
5.2.110.0030.04711.53
5.2.100.0130.05011.53
5.2.90.0030.06011.53
5.2.80.0070.06011.53
5.2.70.0070.06011.53
5.2.60.0130.05311.53
5.2.50.0000.04711.53
5.2.40.0130.05311.53
5.2.30.0070.03011.53
5.2.20.0100.04711.53
5.2.10.0030.06311.53
5.2.00.0070.06011.53
5.1.60.0070.05011.53
5.1.50.0000.03311.53
5.1.40.0030.03311.53
5.1.30.0070.05311.53
5.1.20.0070.05311.53
5.1.10.0070.05011.53
5.1.00.0030.05711.53
5.0.50.0030.04711.53
5.0.40.0000.03711.53
5.0.30.0030.06311.53
5.0.20.0000.04711.53
5.0.10.0100.03311.53
5.0.00.0070.06011.53
4.4.90.0070.03011.53
4.4.80.0030.01311.53
4.4.70.0000.02311.53
4.4.60.0030.03311.53
4.4.50.0100.02711.53
4.4.40.0000.05311.53
4.4.30.0000.02311.53
4.4.20.0070.02311.53
4.4.10.0070.02711.53
4.4.00.0030.02711.53
4.3.110.0000.04011.53
4.3.100.0030.03011.53
4.3.90.0030.01711.53
4.3.80.0100.04711.53
4.3.70.0030.02311.53
4.3.60.0000.02711.53
4.3.50.0100.02711.53
4.3.40.0000.05011.53
4.3.30.0070.01711.53
4.3.20.0030.02711.53
4.3.10.0000.03711.53
4.3.00.0030.03311.53

preferences:
37.87 ms | 401 KiB | 5 Q