3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Exception { protected $message = 'Unknown exception'; // exception message private $string; // __toString cache protected $code = 0; // user defined exception code protected $file; // source filename of exception protected $line; // source line of exception private $trace; // backtrace private $previous; // previous exception if nested exception public function __construct($message, $code = 0) { // some code // make sure everything is assigned properly self::__construct($message, $code); } } // Inhibits cloning of exceptions. /** * NewException * Extends the Exception class so that the $message parameter is now mendatory. * */ class NewException extends Exception { //$message is now not optional, just for the extension. public function __construct($message, $code = 0, Exception $previous = null) { parent::__construct($message, $code, $previous); } } /** * TestException * Tests and throws Exceptions. */ class TestException { const NONE = 0; const NORMAL = 1; const CUSTOM = 2; public function __construct($type = self::NONE) { switch ($type) { case 1: throw new Exception('Normal Exception'); break; case 2: throw new NewException('Custom Exception'); break; default: return 0; //No exception is thrown. } } } try { $t = new TestException(TestException::CUSTOM); } catch (Exception $e) { print_r($e); //Exception Caught } ?>

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.0180.00018.55
8.3.50.0170.00722.00
8.3.40.0110.00318.59
8.3.30.0040.01418.73
8.3.20.0050.00220.33
8.3.10.0080.00023.58
8.3.00.0000.00820.78
8.2.180.0040.01116.63
8.2.170.0130.00622.96
8.2.160.0070.00722.10
8.2.150.0000.00724.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0050.00321.12
8.2.110.0030.00622.13
8.2.100.0060.00617.84
8.2.90.0000.00819.09
8.2.80.0060.00317.97
8.2.70.0030.00517.50
8.2.60.0040.00417.93
8.2.50.0060.00318.07
8.2.40.0000.00818.09
8.2.30.0050.00217.90
8.2.20.0000.00717.71
8.2.10.0070.00017.63
8.2.00.0000.00717.66
8.1.280.0100.00325.92
8.1.270.0040.00423.88
8.1.260.0030.00526.35
8.1.250.0080.00028.09
8.1.240.0050.00523.77
8.1.230.0080.00319.07
8.1.220.0050.00317.74
8.1.210.0000.00918.77
8.1.200.0000.00817.22
8.1.190.0030.00617.53
8.1.180.0030.00618.10
8.1.170.0090.00018.48
8.1.160.0070.00322.10
8.1.150.0040.00418.61
8.1.140.0040.00417.35
8.1.130.0030.00317.79
8.1.120.0000.00717.32
8.1.110.0060.00317.30
8.1.100.0050.00217.33
8.1.90.0040.00417.31
8.1.80.0040.00417.41
8.1.70.0030.00317.32
8.1.60.0030.00617.57
8.1.50.0060.00317.38
8.1.40.0000.00817.42
8.1.30.0040.00417.60
8.1.20.0030.00517.52
8.1.10.0000.00817.40
8.1.00.0040.00417.37
8.0.300.0000.00718.77
8.0.290.0000.00916.93
8.0.280.0070.00018.42
8.0.270.0030.00317.22
8.0.260.0030.00516.84
8.0.250.0000.00716.93
8.0.240.0000.00816.90
8.0.230.0000.00717.00
8.0.220.0000.00716.85
8.0.210.0040.00416.79
8.0.200.0000.00716.99
8.0.190.0030.00317.03
8.0.180.0030.00517.00
8.0.170.0000.00816.88
8.0.160.0070.00016.88
8.0.150.0040.00416.87
8.0.140.0070.00016.77
8.0.130.0000.00513.32
8.0.120.0000.00816.79
8.0.110.0040.00416.88
8.0.100.0040.00416.79
8.0.90.0000.00716.70
8.0.80.0120.00316.84
8.0.70.0070.00016.98
8.0.60.0050.00316.93
8.0.50.0040.00416.79
8.0.30.0120.00717.01
8.0.20.0080.01017.40
8.0.10.0000.00816.82
8.0.00.0060.01316.68
7.4.330.0060.00015.00
7.4.320.0000.00616.55
7.4.300.0030.00316.57
7.4.290.0070.00016.57
7.4.280.0050.00316.48
7.4.270.0080.00016.58
7.4.260.0090.00016.56
7.4.250.0040.00416.58
7.4.240.0060.00216.49
7.4.230.0080.00016.50
7.4.220.0070.01016.51
7.4.210.0070.00816.50
7.4.200.0080.00016.65
7.4.190.0000.00716.73
7.4.160.0080.00816.40
7.4.150.0070.01117.40
7.4.140.0060.02017.86
7.4.130.0110.00616.40
7.4.120.0060.01116.53
7.4.110.0100.00716.40
7.4.100.0070.01016.69
7.4.90.0130.00316.46
7.4.80.0070.01716.34
7.4.70.0060.01016.53
7.4.60.0130.00316.32
7.4.50.0080.00016.13
7.4.40.0090.00622.77
7.4.30.0070.01016.45
7.4.00.0130.00315.02
7.3.330.0050.00013.29
7.3.320.0000.00713.11
7.3.310.0070.00016.32
7.3.300.0000.00616.31
7.3.290.0100.00316.26
7.3.280.0070.01316.26
7.3.270.0130.00417.40
7.3.260.0150.00316.25
7.3.250.0130.01016.47
7.3.240.0140.00316.29
7.3.230.0000.01616.53
7.3.210.0120.00616.09
7.3.200.0070.01319.39
7.3.190.0060.00916.17
7.3.180.0060.01016.46
7.3.170.0060.01316.30
7.3.160.0140.00316.27
7.3.120.0120.00314.95
7.3.10.0070.00716.34
7.3.00.0030.00916.66
7.2.330.0070.01716.38
7.2.320.0040.01816.42
7.2.310.0100.01016.40
7.2.300.0100.01016.62
7.2.290.0000.02116.33
7.2.130.0140.00016.46
7.2.120.0060.00316.44
7.2.110.0030.00616.82
7.2.100.0090.00316.79
7.2.90.0000.01316.88
7.2.80.0030.01316.53
7.2.70.0030.01016.89
7.2.60.0080.00716.67
7.2.50.0040.00716.75
7.2.40.0000.01516.95
7.2.30.0080.00016.73
7.2.20.0000.01016.73
7.2.10.0030.00716.99
7.2.00.0040.00717.97
7.1.250.0070.00315.69
7.1.200.0070.00715.43
7.1.100.0000.01118.02
7.1.70.0000.00716.89
7.1.60.0100.00319.32
7.1.50.0000.01716.68
7.1.00.0030.07722.54
7.0.200.0060.00616.57
7.0.140.0070.07022.00
7.0.70.0070.07320.14
7.0.60.0030.07719.89
7.0.50.0070.09320.30
7.0.40.0200.06720.13
7.0.30.0130.08020.04
7.0.20.0070.05320.08
7.0.10.0130.07720.13
7.0.00.0130.06720.04
5.6.280.0030.07321.12
5.6.220.0170.07720.68
5.6.210.0170.08020.77
5.6.200.0030.09021.12
5.6.190.0070.08721.12
5.6.180.0130.05021.05
5.6.170.0130.08021.13
5.6.160.0130.06721.03
5.6.150.0130.06321.02
5.6.140.0130.07321.00
5.6.130.0030.04721.00
5.6.120.0130.04321.02
5.6.110.0000.08721.02
5.6.100.0200.08021.11
5.6.90.0030.09021.06
5.6.80.0100.04720.33
5.6.70.0130.07720.49
5.6.60.0200.07020.44
5.6.50.0130.06020.51
5.6.40.0030.08320.48
5.6.30.0130.07020.48
5.6.20.0070.08020.39
5.6.10.0070.08020.38
5.6.00.0230.06320.29
5.5.360.0100.06720.40
5.5.350.0170.05020.36
5.5.340.0000.09720.82
5.5.330.0000.05320.89
5.5.320.0170.05020.90
5.5.310.0030.07720.94
5.5.300.0030.04320.86
5.5.290.0070.08720.93
5.5.280.0200.06720.93
5.5.270.0070.08320.81
5.5.260.0130.08320.77
5.5.250.0170.08020.75
5.5.240.0130.07720.20
5.5.230.0030.07020.20
5.5.220.0130.07720.22
5.5.210.0130.05320.23
5.5.200.0030.08020.25
5.5.190.0230.06720.24
5.5.180.0030.08720.23
5.5.160.0000.05020.23
5.5.150.0130.06320.14
5.5.140.0200.07720.31
5.5.130.0070.08020.25
5.5.120.0070.08320.00
5.5.110.0030.07720.16
5.5.100.0030.07720.08
5.5.90.0000.07020.09
5.5.80.0070.07020.07
5.5.70.0030.08320.11
5.5.60.0030.06720.10
5.5.50.0030.08720.17
5.5.40.0100.05720.16
5.5.30.0030.07319.97
5.5.20.0070.05320.05
5.5.10.0070.05319.99
5.5.00.0030.06720.11
5.4.450.0100.08019.54
5.4.440.0070.08319.36
5.4.430.0000.08719.52
5.4.420.0070.08319.45
5.4.410.0130.07319.32
5.4.400.0070.06319.11
5.4.390.0100.07719.09
5.4.380.0030.08319.13
5.4.370.0100.06319.12
5.4.360.0130.05319.16
5.4.350.0170.07019.02
5.4.340.0170.07019.23
5.4.320.0130.05318.90
5.4.310.0100.08019.13
5.4.300.0070.06019.04
5.4.290.0100.07019.03
5.4.280.0070.08318.96
5.4.270.0230.07019.23
5.4.260.0100.06719.12
5.4.250.0070.07018.87
5.4.240.0030.04318.86
5.4.230.0130.07319.12
5.4.220.0030.07319.11
5.4.210.0000.08019.11
5.4.200.0030.07319.09
5.4.190.0070.08319.03
5.4.180.0070.08018.86
5.4.170.0030.07318.88
5.4.160.0070.05719.02
5.4.150.0170.05019.14
5.4.140.0030.08016.46
5.4.130.0100.06716.51
5.4.120.0130.05016.45
5.4.110.0130.03716.45
5.4.100.0170.06716.55
5.4.90.0070.05016.58
5.4.80.0070.07316.39
5.4.70.0070.04316.55
5.4.60.0030.05016.39
5.4.50.0030.08016.40
5.4.40.0100.05316.37
5.4.30.0100.07016.30
5.4.20.0030.07316.47
5.4.10.0100.07716.44
5.4.00.0100.07015.86
5.3.290.0100.07714.80
5.3.280.0030.05714.59
5.3.270.0100.05314.58
5.3.260.0130.03714.70
5.3.250.0100.07714.60
5.3.240.0030.08014.55
5.3.230.0000.05314.54
5.3.220.0000.08314.55
5.3.210.0130.06014.59
5.3.200.0170.05314.57
5.3.190.0200.05314.61
5.3.180.0000.04314.69
5.3.170.0100.07714.50
5.3.160.0030.04314.53
5.3.150.0000.04014.61
5.3.140.0100.07314.57
5.3.130.0130.04714.66
5.3.120.0070.05014.48
5.3.110.0130.06714.57
5.3.100.0070.06014.00
5.3.90.0100.07014.09
5.3.80.0030.08314.14
5.3.70.0300.05714.05
5.3.60.0070.04314.08
5.3.50.0100.05014.08
5.3.40.0100.07713.85
5.3.30.0070.07713.94
5.3.20.0100.06013.82
5.3.10.0030.07313.65
5.3.00.0100.06713.71
5.2.170.0070.04312.19
5.2.160.0130.03012.19
5.2.150.0030.06312.19
5.2.140.0070.06012.19
5.2.130.0070.06012.19
5.2.120.0070.06012.19
5.2.110.0000.07012.19
5.2.100.0170.05312.19
5.2.90.0000.06312.19
5.2.80.0070.06012.19
5.2.70.0070.06312.19
5.2.60.0030.06712.19
5.2.50.0030.06312.19
5.2.40.0070.06012.19
5.2.30.0130.03712.19
5.2.20.0070.06312.19
5.2.10.0070.06312.19
5.2.00.0000.06312.19
5.1.60.0070.05012.19
5.1.50.0070.05312.19
5.1.40.0030.05312.19
5.1.30.0070.05712.19
5.1.20.0070.04712.19
5.1.10.0100.05312.19
5.1.00.0100.04312.19
5.0.50.0000.04312.19
5.0.40.0030.03012.19
5.0.30.0000.04712.19
5.0.20.0070.04312.19
5.0.10.0030.03712.19
5.0.00.0000.05012.19
4.4.90.0030.03312.19
4.4.80.0030.03712.19
4.4.70.0030.03312.19
4.4.60.0070.03012.19
4.4.50.0070.03012.19
4.4.40.0030.03312.19
4.4.30.0000.03712.19
4.4.20.0030.03012.19
4.4.10.0030.03712.19
4.4.00.0000.05712.19
4.3.110.0070.02312.19
4.3.100.0030.03312.19
4.3.90.0030.03712.19
4.3.80.0030.05312.19
4.3.70.0100.02312.19
4.3.60.0000.02712.19
4.3.50.0000.02012.19
4.3.40.0000.05712.19
4.3.30.0070.02712.19
4.3.20.0030.02312.19
4.3.10.0030.04312.19
4.3.00.0030.02012.19

preferences:
46.28 ms | 401 KiB | 5 Q