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, Exception $previous = null) { // some code // make sure everything is assigned properly parent::__construct($message, $code, $previous); } } // 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.0100.01018.30
8.3.50.0280.00521.94
8.3.40.0120.00318.70
8.3.30.0110.00418.96
8.3.20.0040.00420.36
8.3.10.0040.00423.43
8.3.00.0040.00420.55
8.2.180.0040.01116.75
8.2.170.0060.00922.96
8.2.160.0100.00722.26
8.2.150.0050.00324.18
8.2.140.0000.00824.66
8.2.130.0050.00326.16
8.2.120.0060.00317.63
8.2.110.0070.00319.45
8.2.100.0070.00417.78
8.2.90.0040.00418.86
8.2.80.0000.00817.97
8.2.70.0050.00317.38
8.2.60.0070.00017.80
8.2.50.0100.00018.07
8.2.40.0080.00318.22
8.2.30.0040.00418.00
8.2.20.0040.00417.54
8.2.10.0050.00219.28
8.2.00.0030.00617.55
8.1.280.0070.01425.92
8.1.270.0060.00323.66
8.1.260.0080.00026.35
8.1.250.0000.00728.09
8.1.240.0130.00019.07
8.1.230.0060.00617.42
8.1.220.0000.00817.74
8.1.210.0080.00018.77
8.1.200.0090.00017.23
8.1.190.0090.00416.98
8.1.180.0030.00618.10
8.1.170.0040.00418.50
8.1.160.0040.00421.86
8.1.150.0040.00418.58
8.1.140.0040.00417.38
8.1.130.0030.00317.76
8.1.120.0030.00517.38
8.1.110.0000.00717.32
8.1.100.0000.00717.32
8.1.90.0090.00017.23
8.1.80.0040.00417.37
8.1.70.0000.00717.31
8.1.60.0060.00317.34
8.1.50.0050.00317.36
8.1.40.0040.00417.31
8.1.30.0030.00517.53
8.1.20.0030.00617.42
8.1.10.0050.00317.40
8.1.00.0050.00217.21
8.0.300.0040.00418.77
8.0.290.0110.00016.58
8.0.280.0000.00718.25
8.0.270.0000.00717.18
8.0.260.0000.00716.82
8.0.250.0060.00016.79
8.0.240.0050.00216.91
8.0.230.0040.00416.79
8.0.220.0070.00016.81
8.0.210.0040.00416.82
8.0.200.0030.00316.84
8.0.190.0070.00016.83
8.0.180.0000.00816.92
8.0.170.0040.00416.84
8.0.160.0040.00416.84
8.0.150.0000.00716.84
8.0.140.0030.00316.62
8.0.130.0000.00513.28
8.0.120.0040.00416.70
8.0.110.0050.00216.84
8.0.100.0050.00316.82
8.0.90.0040.00416.77
8.0.80.0090.00716.79
8.0.70.0000.00716.90
8.0.60.0070.00016.78
8.0.50.0070.00016.80
8.0.30.0090.01016.83
8.0.20.0070.01117.40
8.0.10.0000.00717.01
8.0.00.0090.01216.84
7.4.330.0000.00515.08
7.4.320.0030.00316.39
7.4.300.0040.00416.54
7.4.290.0000.00716.33
7.4.280.0070.00016.56
7.4.270.0000.00716.37
7.4.260.0000.00716.42
7.4.250.0030.00616.57
7.4.240.0030.00416.43
7.4.230.0030.00316.66
7.4.220.0090.01316.49
7.4.210.0110.00316.51
7.4.200.0030.00316.68
7.4.190.0030.00316.28
7.4.160.0130.00316.37
7.4.150.0100.00717.40
7.4.140.0060.01217.86
7.4.130.0070.01016.63
7.4.120.0100.00916.50
7.4.110.0100.00716.53
7.4.100.0100.00716.44
7.4.90.0070.01016.40
7.4.80.0060.01316.41
7.4.70.0030.01716.59
7.4.60.0120.00616.18
7.4.50.0090.00016.38
7.4.40.0000.01322.77
7.4.30.0110.00516.31
7.4.00.0110.00714.96
7.3.330.0060.00013.13
7.3.320.0050.00013.30
7.3.310.0040.00416.36
7.3.300.0030.00316.18
7.3.290.0100.00616.27
7.3.280.0060.00816.26
7.3.270.0090.00917.40
7.3.260.0130.01016.32
7.3.250.0070.01216.42
7.3.240.0180.00016.53
7.3.230.0110.00616.39
7.3.210.0130.00316.51
7.3.200.0130.00619.39
7.3.190.0070.01016.48
7.3.180.0170.00716.41
7.3.170.0130.00316.52
7.3.160.0080.00816.34
7.3.120.0110.00814.89
7.3.110.0070.01114.77
7.3.100.0060.00914.81
7.3.90.0000.01414.78
7.3.80.0030.01414.51
7.3.70.0060.00814.84
7.3.60.0070.00714.78
7.3.50.0030.01014.85
7.3.40.0060.00314.63
7.3.30.0030.01214.71
7.3.20.0040.00716.68
7.3.10.0070.00516.34
7.3.00.0070.00916.63
7.2.330.0120.01216.47
7.2.320.0210.00316.65
7.2.310.0130.01016.64
7.2.300.0100.00716.58
7.2.290.0040.01316.60
7.2.250.0100.00714.92
7.2.240.0090.00314.67
7.2.230.0100.00714.88
7.2.220.0000.01314.88
7.2.210.0070.01114.82
7.2.200.0070.00714.48
7.2.190.0070.01114.83
7.2.180.0000.00914.80
7.2.170.0060.01014.76
7.2.160.0000.01614.88
7.2.150.0030.00916.65
7.2.140.0040.00816.59
7.2.130.0100.00316.87
7.2.120.0070.00516.82
7.2.110.0040.00816.66
7.2.100.0070.00516.79
7.2.90.0020.01116.85
7.2.80.0090.00716.78
7.2.70.0070.00516.59
7.2.60.0040.01016.66
7.2.50.0080.00716.84
7.2.40.0050.01016.69
7.2.30.0030.01016.68
7.2.20.0050.00916.79
7.2.10.0030.00816.72
7.2.00.0070.00617.56
7.1.330.0060.01215.55
7.1.320.0000.01515.49
7.1.310.0060.00315.69
7.1.300.0000.00915.48
7.1.290.0070.00315.65
7.1.280.0000.01415.55
7.1.270.0040.00415.46
7.1.260.0000.01015.36
7.1.250.0090.00515.48
7.1.240.0070.00415.67
7.1.230.0030.00615.65
7.1.220.0060.00615.57
7.1.210.0080.00615.67
7.1.200.0080.00515.72
7.1.190.0030.00715.61
7.1.180.0070.01115.80
7.1.170.0090.00915.74
7.1.160.0130.00315.68
7.1.150.0030.01015.45
7.1.140.0030.01215.77
7.1.130.0040.00815.70
7.1.120.0110.00415.69
7.1.110.0000.00815.71
7.1.100.0050.00716.67
7.1.90.0060.00615.47
7.1.80.0040.00915.61
7.1.70.0070.00516.19
7.1.60.0050.00817.55
7.1.50.0050.01116.16
7.1.40.0000.00915.81
7.1.30.0090.00915.77
7.1.20.0030.00615.60
7.1.10.0100.00315.65
7.1.00.0020.04219.12
7.0.330.0080.00815.27
7.0.320.0100.00015.17
7.0.310.0000.00915.41
7.0.300.0100.00715.20
7.0.290.0070.00715.33
7.0.280.0030.00915.11
7.0.270.0060.00315.09
7.0.260.0040.00415.27
7.0.250.0030.00815.48
7.0.240.0070.00715.54
7.0.230.0080.00315.01
7.0.220.0040.00415.37
7.0.210.0040.00415.35
7.0.200.0040.00916.01
7.0.190.0070.00415.36
7.0.180.0060.00615.01
7.0.170.0090.00615.37
7.0.160.0070.00315.04
7.0.150.0070.00715.23
7.0.140.0050.04318.76
7.0.130.0100.00315.35
7.0.120.0060.00615.20
7.0.110.0080.00815.12
7.0.100.0090.00315.53
7.0.90.0080.00615.43
7.0.80.0000.01015.36
7.0.70.0100.00315.21
7.0.60.0080.04217.67
7.0.50.0070.03716.50
7.0.40.0070.04716.71
7.0.30.0100.02416.86
7.0.20.0220.04216.67
7.0.10.0060.04216.76
7.0.00.0080.02816.81
5.6.400.0000.00914.27
5.6.390.0090.00614.53
5.6.380.0030.00714.27
5.6.370.0040.00814.50
5.6.360.0060.00914.09
5.6.350.0040.00914.26
5.6.340.0030.01014.05
5.6.330.0030.00614.49
5.6.320.0060.00313.94
5.6.310.0090.00613.94
5.6.300.0090.00514.27
5.6.290.0030.00913.98
5.6.280.0090.03917.68
5.6.270.0070.01014.25
5.6.260.0040.01114.22
5.6.250.0060.00613.84
5.6.240.0000.01414.41
5.6.230.0100.00614.20
5.6.220.0100.00313.95
5.6.210.0030.04717.48
5.6.200.0080.04616.18
5.6.190.0060.04817.47
5.6.180.0040.03117.30
5.6.170.0100.02517.46
5.6.160.0150.03917.22
5.6.150.0080.03216.13
5.6.140.0070.04316.30
5.6.130.0050.03816.12
5.6.120.0030.04717.67
5.6.110.0070.04517.66
5.6.100.0060.04517.52
5.6.90.0080.04517.56
5.6.80.0070.03717.16
5.6.70.0000.01514.22
5.6.60.0050.00813.92
5.6.50.0030.01013.93
5.6.40.0030.01213.96
5.6.30.0070.01014.30
5.6.20.0070.00713.79
5.6.10.0090.00614.18
5.6.00.0000.01014.01
5.5.380.0070.01014.09
5.5.370.0040.01114.25
5.5.360.0070.00414.44
5.5.350.0050.04717.31
5.5.340.0030.03216.16
5.5.330.0070.04417.26
5.5.320.0120.03717.26
5.5.310.0170.04617.10
5.5.300.0060.02615.97
5.5.290.0020.02616.11
5.5.280.0050.03117.50
5.5.270.0100.03117.40
5.5.260.0070.04317.31
5.5.250.0050.04017.42
5.5.240.0070.03717.09
5.5.230.0100.00013.94
5.5.220.0060.00913.99
5.5.210.0090.00614.08
5.5.200.0100.00713.66
5.5.190.0100.00714.12
5.5.180.0060.00613.94
5.5.170.0030.00913.88
5.5.160.0090.00014.04
5.5.150.0060.00814.16
5.5.140.0070.00713.76
5.5.130.0000.00814.09
5.5.120.0090.00414.00
5.5.110.0000.00913.74
5.5.100.0080.00813.83
5.5.90.0030.01013.58
5.5.80.0080.00813.98
5.5.70.0000.01114.01
5.5.60.0030.00713.99
5.5.50.0140.00313.86
5.5.40.0040.00713.67
5.5.30.0060.01013.78
5.5.20.0000.01413.93
5.5.10.0080.00313.72
5.5.00.0120.00313.86
5.4.450.0280.02615.71
5.4.440.0300.02215.67
5.4.430.0320.02015.83
5.4.420.0350.02215.77
5.4.410.0700.02115.71
5.4.400.0020.03715.38
5.4.390.0260.02115.23
5.4.380.0080.03015.37
5.4.370.0130.02615.24
5.4.360.0140.02415.37
5.4.350.0100.03015.37
5.4.340.0150.02315.40
5.4.330.0060.00611.99
5.4.320.0060.02312.26
5.4.310.0060.02712.25
5.4.300.0020.02412.25
5.4.290.0060.02512.25
5.4.280.0040.03312.20
5.4.270.0060.02012.20
5.4.260.0040.02412.20
5.4.250.0040.02312.20
5.4.240.0050.02212.20
5.4.230.0060.02612.20
5.4.220.0020.02312.20
5.4.210.0090.03312.20
5.4.200.0070.02512.20
5.4.190.0110.02512.19
5.4.180.0170.03112.19
5.4.170.0090.02612.20
5.4.160.0070.02812.19
5.4.150.0130.02712.19
5.4.140.0110.02712.03
5.4.130.0080.02612.03
5.4.120.0170.05012.01
5.4.110.0100.02612.01
5.4.100.0130.02512.00
5.4.90.0110.02512.00
5.4.80.0110.02512.00
5.4.70.0090.02512.00
5.4.60.0080.02712.00
5.4.50.0230.04712.00
5.4.40.0120.02312.00
5.4.30.0120.02712.00
5.4.20.0160.02711.99
5.4.10.0130.02112.00
5.4.00.0090.02311.74
5.3.290.0040.02312.40
5.3.280.0080.01812.35
5.3.270.0120.02312.36
5.3.260.0110.02312.36
5.3.250.0130.02212.36
5.3.240.0200.04712.36
5.3.230.0100.02412.35
5.3.220.0080.02712.34
5.3.210.0090.02612.33
5.3.200.0110.02412.34
5.3.190.0100.02712.34
5.3.180.0110.02312.33
5.3.170.0120.02312.33
5.3.160.0100.02612.33
5.3.150.0050.02912.33
5.3.140.0080.02812.33
5.3.130.0110.02612.32
5.3.120.0130.02512.33
5.3.110.0090.02412.32
5.3.100.0080.02612.06
5.3.90.0120.02412.06
5.3.80.0090.02612.05
5.3.70.0160.03612.05
5.3.60.0090.02512.04
5.3.50.0090.02612.01
5.3.40.0120.02412.01
5.3.30.0120.02312.00
5.3.20.0200.03311.89
5.3.10.0110.02311.87
5.3.00.0110.02211.86
5.2.170.0160.0319.23
5.2.160.0230.0279.23
5.2.150.0160.0349.23
5.2.140.0170.0609.23
5.2.130.0120.0349.19
5.2.120.0130.0379.18
5.2.110.0160.0349.20
5.2.100.0130.0359.20
5.2.90.0090.0379.20
5.2.80.0150.0339.19
5.2.70.0100.0389.19
5.2.60.0160.0329.14
5.2.50.0140.0339.11
5.2.40.0220.0569.08
5.2.30.0110.0369.07
5.2.20.0110.0369.06
5.2.10.0160.0308.96
5.2.00.0210.0578.81
5.1.60.0130.0278.10
5.1.50.0150.0268.09
5.1.40.0070.0368.08
5.1.30.0100.0338.43
5.1.20.0130.0318.46
5.1.10.0090.0338.17
5.1.00.0140.0338.18
5.0.50.0080.0276.66
5.0.40.0120.0246.51
5.0.30.0080.0376.33
5.0.20.0140.0186.30
5.0.10.0110.0216.27
5.0.00.0080.0366.27
4.4.90.0060.0194.78
4.4.80.0070.0184.75
4.4.70.0070.0204.76
4.4.60.0070.0194.76
4.4.50.0100.0164.77
4.4.40.0060.0294.71
4.4.30.0060.0224.76
4.4.20.0070.0184.84
4.4.10.0070.0184.85
4.4.00.0190.0774.75
4.3.110.0070.0184.67
4.3.100.0080.0184.66
4.3.90.0090.0184.64
4.3.80.0070.0304.58
4.3.70.0060.0194.63
4.3.60.0110.0174.63
4.3.50.0090.0164.63
4.3.40.0090.0264.54
4.3.30.0070.0173.29
4.3.20.0050.0203.28
4.3.10.0060.0173.24
4.3.00.0000.01315.44

preferences:
76.68 ms | 401 KiB | 5 Q