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; } } var_dump(EventStatus::Failed());

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.0140.00316.63
8.3.50.0160.00217.28
8.3.40.0090.00618.79
8.3.30.0110.00418.76
8.3.20.0040.00418.60
8.3.10.0080.00018.64
8.3.00.0040.00419.19
8.2.180.0130.00716.75
8.2.170.0110.00422.96
8.2.160.0070.01520.95
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0070.00026.16
8.2.120.0040.00419.23
8.2.110.0070.00321.03
8.2.100.0000.01017.72
8.2.90.0030.00719.17
8.2.80.0070.00019.36
8.2.70.0050.00317.61
8.2.60.0030.00617.93
8.2.50.0030.00718.07
8.2.40.0020.00518.16
8.2.30.0050.00318.11
8.2.20.0000.00717.68
8.2.10.0000.00817.77
8.2.00.0000.00717.76
8.1.280.0070.01025.92
8.1.270.0000.00724.66
8.1.260.0030.00526.35
8.1.250.0000.00828.09
8.1.240.0030.00722.46
8.1.230.0040.00720.88
8.1.220.0040.00417.74
8.1.210.0060.00318.84
8.1.200.0040.00417.48
8.1.190.0050.00317.53
8.1.180.0050.00518.10
8.1.170.0080.00018.91
8.1.160.0040.00418.96
8.1.150.0040.00418.66
8.1.140.0080.00017.45
8.1.130.0050.00317.69
8.1.120.0000.00817.38
8.1.110.0080.00017.39
8.1.100.0000.00717.52
8.1.90.0000.00717.36
8.1.80.0000.00717.52
8.1.70.0000.00817.42
8.1.60.0030.00517.63
8.1.50.0040.00417.44
8.1.40.0000.00917.50
8.1.30.0040.00417.67
8.1.20.0040.00417.64
8.1.10.0060.00317.49
8.1.00.0070.00017.41
8.0.300.0030.00519.94
8.0.290.0070.00016.75
8.0.280.0070.00018.51
8.0.270.0000.00717.28
8.0.260.0000.00716.84
8.0.250.0070.00017.00
8.0.240.0040.00416.89
8.0.230.0040.00416.96
8.0.220.0030.00316.91
8.0.210.0070.00016.87
8.0.200.0040.00416.96
8.0.190.0000.00817.01
8.0.180.0000.01216.95
8.0.170.0000.00816.80
8.0.160.0040.00416.91
8.0.150.0030.00516.87
8.0.140.0110.00016.70
8.0.130.0060.00013.35
8.0.120.0080.00016.85
8.0.110.0040.00416.81
8.0.100.0000.00716.72
8.0.90.0050.00317.02
8.0.80.0030.01316.79
8.0.70.0000.00716.77
8.0.60.0050.00216.82
8.0.50.0070.00016.95
8.0.30.0070.01717.21
8.0.20.0050.01217.20
8.0.10.0040.00416.86
8.0.00.0090.00916.84
7.4.330.0050.00012.95
7.4.320.0060.00016.64
7.4.300.0040.00416.66
7.4.290.0080.00316.50
7.4.280.0000.00816.55
7.4.270.0000.00716.43
7.4.260.0060.00013.32
7.4.250.0000.00816.49
7.4.240.0000.00716.44
7.4.230.0000.00816.62
7.4.220.0100.01016.46
7.4.210.0050.01016.66
7.4.200.0080.00016.63
7.4.190.0040.00416.69
7.4.160.0120.00916.61
7.4.150.0180.00316.65
7.4.140.0090.00816.61
7.4.130.0060.01116.54
7.4.120.0120.00716.51
7.4.110.0130.01016.61
7.4.100.0030.01616.41
7.4.90.0090.00916.68
7.4.80.0130.00616.68
7.4.70.0100.01016.51
7.4.60.0140.01216.61
7.4.50.0060.00616.65
7.4.40.0030.01316.74
7.4.30.0040.01416.60
7.4.00.0100.00614.70
7.3.330.0030.00313.08
7.3.320.0000.00513.34
7.3.310.0070.00016.34
7.3.300.0000.00716.19
7.3.290.0060.00916.33
7.3.280.0060.01016.28
7.3.270.0110.00516.38
7.3.260.0120.01116.35
7.3.250.0090.00916.43
7.3.240.0120.00416.32
7.3.230.0190.00416.35
7.3.210.0130.00316.36
7.3.200.0090.01419.39
7.3.190.0120.00516.63
7.3.180.0130.00916.26
7.3.170.0070.00816.41
7.3.160.0100.00716.33
7.3.120.0030.01114.69
7.2.330.0060.01316.80
7.2.320.0100.01316.71
7.2.310.0090.00916.48
7.2.300.0090.00916.70
7.2.290.0070.01016.46
7.2.00.0100.01019.73
7.1.200.0030.01215.87
7.1.100.0060.00618.13
7.1.70.0060.00316.95
7.1.60.0140.01019.40
7.1.50.0030.01916.95
7.1.00.0100.02722.46
7.0.200.0050.00316.71
7.0.140.0100.06721.95
7.0.120.0030.06722.04
7.0.60.0000.05019.84
7.0.50.0100.05717.89
7.0.40.0000.08020.27
7.0.30.0300.08020.26
7.0.20.0300.05020.16
7.0.10.0200.07320.34
7.0.00.0100.08720.33
5.6.210.0130.08020.61
5.6.200.0100.05018.27
5.6.190.0030.06020.55
5.6.180.0270.04020.53
5.6.170.0300.06720.71
5.6.160.0100.08020.55
5.6.150.0000.04718.29
5.6.140.0030.04318.27
5.6.130.0100.07718.21
5.6.120.0100.08021.02
5.6.110.0070.04721.06
5.6.100.0100.08020.98
5.6.90.0200.07320.89
5.6.80.0100.07720.39
5.6.70.0200.08020.34
5.5.350.0230.04020.46
5.5.340.0030.04018.07
5.5.330.0000.05020.13
5.5.320.0300.04320.26
5.5.310.0330.07320.34
5.5.300.0030.04017.95
5.5.290.0070.04318.02
5.5.280.0000.08720.88
5.5.270.0030.07320.86
5.5.260.0030.05320.91
5.5.250.0070.06320.80
5.5.240.0030.04020.18
5.4.450.0170.04019.47
5.4.440.0000.04319.46
5.4.430.0100.03719.40
5.4.420.0030.03719.57
5.4.410.0030.03719.33
5.4.400.0030.03719.20
5.4.390.0030.03718.85
5.4.380.0030.04319.16
5.4.370.0000.04319.14
5.4.360.0070.03318.86
5.4.350.0070.03318.86
5.4.340.0070.03718.98
5.4.320.0000.04019.24
5.4.310.0030.05019.08
5.4.300.0070.06719.24
5.4.290.0070.07719.23
5.4.280.0100.07318.97
5.4.270.0100.07019.16
5.4.260.0100.07719.14
5.4.250.0070.07319.23
5.4.240.0030.06319.25
5.4.230.0030.04019.15
5.4.220.0100.04318.84
5.4.210.0030.04019.14
5.4.200.0070.04718.84
5.4.190.0100.07319.14
5.4.180.0070.07718.96
5.4.170.0030.04018.84
5.4.160.0030.04718.85
5.4.150.0100.07019.22
5.4.140.0100.06716.35
5.4.130.0070.06716.35
5.4.120.0100.07016.49
5.4.110.0070.07316.67
5.4.100.0030.07716.44
5.4.90.0070.05316.30
5.4.80.0070.04316.38
5.4.70.0100.05716.66
5.4.60.0030.07716.39
5.4.50.0070.07016.27
5.4.40.0070.04716.36
5.4.30.0170.03016.38
5.4.20.0000.05016.25
5.4.10.0030.04716.38
5.4.00.0030.07315.79
5.3.290.0030.03714.71
5.3.280.0070.07714.51
5.3.270.0100.03314.66
5.3.260.0170.03314.62
5.3.250.0000.04014.59
5.3.240.0030.08014.62
5.3.230.0030.07314.59
5.3.220.0130.04314.63
5.3.210.0130.07014.62
5.3.200.0030.05014.71
5.3.190.0030.04314.59
5.3.180.0130.04014.71
5.3.170.0100.07014.61
5.3.160.0030.04314.59
5.3.150.0030.04014.63
5.3.140.0030.05014.56
5.3.130.0000.04714.46
5.3.120.0070.07714.70
5.3.110.0170.07014.57
5.3.100.0000.08013.92
5.3.90.0100.03314.08
5.3.80.0030.07014.04
5.3.70.0070.06014.02
5.3.60.0070.07714.07
5.3.50.0100.06713.94
5.3.40.0070.04013.83
5.3.30.0070.07313.79
5.3.20.0130.03713.86
5.3.10.0000.03713.70
5.3.00.0000.05713.79
5.2.170.0100.02311.14
5.2.160.0070.03011.03
5.2.150.0030.03711.16
5.2.140.0070.04011.05
5.2.130.0100.05011.10
5.2.120.0070.06011.06
5.2.110.0030.06311.04
5.2.100.0070.05311.09
5.2.90.0030.03311.16
5.2.80.0100.02711.09
5.2.70.0000.03711.23
5.2.60.0030.06011.05
5.2.50.0030.04011.01
5.2.40.0030.06711.04
5.2.30.0030.04010.96
5.2.20.0100.05310.96
5.2.10.0030.06011.00
5.2.00.0100.05010.67
5.1.60.0070.03710.01
5.1.50.0030.0379.90
5.1.40.0030.03310.03
5.1.30.0070.04710.48
5.1.20.0030.05710.50
5.1.10.0070.05010.04
5.1.00.0070.04710.13
5.0.50.0070.0378.52
5.0.40.0030.0378.38
5.0.30.0000.0578.23
5.0.20.0030.0238.15
5.0.10.0000.0438.16
5.0.00.0100.0608.18
4.4.90.0000.0377.84
4.4.80.0000.0237.84
4.4.70.0000.0237.84
4.4.60.0000.0277.84
4.4.50.0030.0137.84
4.4.40.0000.0577.84
4.4.30.0070.0307.84
4.4.20.0030.0237.84
4.4.10.0000.0407.84
4.4.00.0000.0577.84
4.3.110.0030.0177.84
4.3.100.0000.0307.84
4.3.90.0030.0307.84
4.3.80.0030.0337.84
4.3.70.0000.0277.84
4.3.60.0070.0237.84
4.3.50.0000.0277.84
4.3.40.0030.0477.84
4.3.30.0000.0407.84
4.3.20.0030.0307.84
4.3.10.0030.0377.84
4.3.00.0030.0337.84

preferences:
43.23 ms | 401 KiB | 5 Q