3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Symfony\Component\Debug; if (!defined('ENT_SUBSTITUTE')) { define('ENT_SUBSTITUTE', 8); } class ExceptionHandler { private $debug; private $charset; private $handler; private $caughtOutput = 0; public function __construct($debug = true, $charset = 'UTF-8') { $this->debug = $debug; $this->charset = $charset; } public static function register($debug = true) { $handler = new static($debug); set_exception_handler(array($handler, 'handle')); return $handler; } public function setHandler($handler) { if (isset($handler) && !is_callable($handler)) { throw new \LogicException('The exception handler must be a valid PHP callable.'); } $old = $this->handler; $this->handler = $handler; return $old; } public function handle(\Exception $exception) { $caughtOutput = 0; $this->caughtOutput = false; ob_start(array($this, 'catchOutput')); echo $exception->getMessage(); if (false === $this->caughtOutput) { ob_end_clean(); echo 456; echo $this->caughtOutput; } if (isset($this->caughtOutput[0])) { ob_start(array($this, 'cleanOutput')); echo $this->caughtOutput; $caughtOutput = ob_get_length(); } $this->caughtOutput = 0; if (!empty($this->handler)) { try { call_user_func($this->handler, $exception); if ($caughtOutput) { $this->caughtOutput = $caughtOutput; } ob_end_flush(); } catch (\Exception $e) { if (!$caughtOutput) { // All handlers failed. Let PHP handle that now. throw $exception; } } } } public function catchOutput($buffer) { $this->caughtOutput = $buffer; return ''; } public function cleanOutput($buffer) { if ($this->caughtOutput) { // use substr_replace() instead of substr() for mbstring overloading resistance $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtOutput); if (isset($cleanBuffer[0])) { $buffer = $cleanBuffer; } } return $buffer; } } ExceptionHandler::register(); throw new \Exception('foo msg');

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.70.0160.00616.88
8.3.60.0070.01416.61
8.3.50.0070.00922.11
8.3.40.0140.00318.76
8.3.30.0110.00319.21
8.3.20.0040.00420.34
8.3.10.0060.00323.66
8.3.00.0040.00419.38
8.2.180.0110.00718.28
8.2.170.0110.01122.96
8.2.160.0100.00320.52
8.2.150.0030.00524.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0030.00522.11
8.2.110.0160.00622.20
8.2.100.0040.00817.99
8.2.90.0040.00419.17
8.2.80.0040.00417.97
8.2.70.0000.00917.75
8.2.60.0060.00317.93
8.2.50.0090.00018.07
8.2.40.0080.00019.89
8.2.30.0000.00818.08
8.2.20.0040.00417.89
8.2.10.0040.00418.20
8.2.00.0100.00017.96
8.1.280.0140.00725.92
8.1.270.0040.00423.71
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0050.00523.96
8.1.230.0050.00519.09
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0060.00317.25
8.1.190.0040.00417.66
8.1.180.0090.00018.10
8.1.170.0080.00018.53
8.1.160.0020.00521.97
8.1.150.0030.00718.60
8.1.140.0000.00817.34
8.1.130.0030.00317.84
8.1.120.0050.00317.39
8.1.110.0030.00517.47
8.1.100.0040.00417.53
8.1.90.0040.00417.36
8.1.80.0000.00717.35
8.1.70.0030.00317.48
8.1.60.0080.00017.44
8.1.50.0050.00317.50
8.1.40.0060.00317.55
8.1.30.0060.00317.59
8.1.20.0040.00417.61
8.1.10.0030.00517.49
8.1.00.0040.00417.48
8.0.300.0030.00519.22
8.0.290.0030.00517.03
8.0.280.0070.00018.49
8.0.270.0000.00817.18
8.0.260.0030.00317.29
8.0.250.0040.00417.04
8.0.240.0030.00316.91
8.0.230.0000.00717.06
8.0.220.0020.00516.89
8.0.210.0050.00317.03
8.0.200.0030.00317.05
8.0.190.0090.00017.04
8.0.180.0050.00217.02
8.0.170.0040.00416.99
8.0.160.0040.00417.00
8.0.150.0000.00716.87
8.0.140.0080.00016.97
8.0.130.0060.00013.44
8.0.120.0030.00616.96
8.0.110.0000.00817.00
8.0.100.0060.00317.02
8.0.90.0000.00716.80
8.0.80.0120.00317.04
8.0.70.0040.00417.01
8.0.60.0000.00716.96
8.0.50.0070.00016.88
8.0.30.0110.00817.07
8.0.20.0090.01117.40
8.0.10.0000.00717.11
8.0.00.0090.01116.87
7.4.330.0060.00015.10
7.4.320.0000.00816.61
7.4.300.0060.00016.54
7.4.290.0040.00416.63
7.4.280.0040.00416.46
7.4.270.0000.00716.46
7.4.260.0080.00016.55
7.4.250.0000.00816.63
7.4.240.0040.00416.55
7.4.230.0000.00716.43
7.4.220.0060.01216.59
7.4.210.0090.00916.49
7.4.200.0050.00216.60
7.4.190.0000.00716.71
7.4.160.0120.01216.46
7.4.150.0060.01217.40
7.4.140.0120.01117.86
7.4.130.0080.01216.57
7.4.120.0110.00516.53
7.4.110.0140.00316.66
7.4.100.0040.01416.55
7.4.90.0070.01016.57
7.4.80.0030.01619.39
7.4.70.0100.00716.36
7.4.60.0130.00316.51
7.4.50.0030.00516.45
7.4.40.0070.01016.43
7.4.30.0080.00816.58
7.4.10.0040.01315.05
7.4.00.0090.00914.95
7.3.330.0030.00313.46
7.3.320.0000.00613.25
7.3.310.0030.00316.46
7.3.300.0030.00316.39
7.3.290.0070.01316.41
7.3.280.0110.00816.37
7.3.270.0030.01317.40
7.3.260.0090.00916.61
7.3.250.0050.01116.53
7.3.240.0060.01216.56
7.3.230.0090.00916.56
7.3.210.0100.01316.31
7.3.200.0100.00919.39
7.3.190.0090.00916.41
7.3.180.0030.01216.54
7.3.170.0110.00516.41
7.3.160.0060.01016.50
7.3.130.0100.01014.99
7.3.120.0090.00714.77
7.3.110.0090.00914.74
7.3.100.0000.01514.77
7.3.90.0090.00714.73
7.3.80.0030.00814.93
7.3.70.0050.00814.93
7.3.60.0020.00914.93
7.3.50.0020.00814.88
7.3.40.0020.00814.81
7.3.30.0060.00814.67
7.3.20.0040.00816.85
7.3.10.0070.00516.70
7.3.00.0070.00916.70
7.2.330.0110.01416.85
7.2.320.0120.00916.74
7.2.310.0160.00316.52
7.2.300.0060.01016.69
7.2.290.0080.00816.64
7.2.260.0080.00914.94
7.2.250.0120.00615.06
7.2.240.0050.00915.02
7.2.230.0070.00915.26
7.2.220.0100.00515.11
7.2.210.0090.00514.90
7.2.200.0050.00515.10
7.2.190.0080.00414.99
7.2.180.0060.00515.07
7.2.170.0060.00615.19
7.2.160.0070.00615.02
7.2.150.0040.00816.91
7.2.140.0050.00516.87
7.2.130.0060.00416.99
7.2.120.0110.00416.95
7.2.110.0080.00716.87
7.2.100.0050.00816.88
7.2.90.0090.00716.90
7.2.80.0060.00716.94
7.2.70.0060.00916.95
7.2.60.0060.00617.03
7.2.50.0050.00717.02
7.2.40.0040.00816.88
7.2.30.0020.00916.89
7.2.20.0050.01117.05
7.2.10.0020.01316.89
7.2.00.0050.00817.77
7.1.330.0050.00715.79
7.1.320.0100.00715.77
7.1.310.0060.00915.75
7.1.300.0050.00515.77
7.1.290.0030.01015.85
7.1.280.0070.00515.73
7.1.270.0050.00915.76
7.1.260.0060.00416.00
7.1.250.0060.00415.63
7.1.240.0090.00415.77
7.1.230.0070.00615.83
7.1.220.0010.00915.80
7.1.210.0020.00915.68
7.1.200.0030.01215.63
7.1.190.0020.00815.81
7.1.180.0030.01115.92
7.1.170.0050.00515.69
7.1.160.0050.01115.87
7.1.150.0070.00815.88
7.1.140.0040.00915.80
7.1.130.0060.00615.49
7.1.120.0100.00315.77
7.1.110.0080.00715.79
7.1.100.0060.00816.54
7.1.90.0090.00615.90
7.1.80.0080.00415.61
7.1.70.0040.00516.22
7.1.60.0050.01316.97
7.1.50.0080.00915.93
7.1.40.0080.00515.80
7.1.30.0060.00315.73
7.1.20.0080.00615.53
7.1.10.0080.00615.78
7.1.00.0030.03317.90
7.0.330.0050.00815.45
7.0.320.0050.00915.35
7.0.310.0090.00515.50
7.0.300.0070.00215.34
7.0.290.0060.00915.40
7.0.280.0050.00615.41
7.0.270.0080.00515.42
7.0.260.0060.00515.40
7.0.250.0030.01115.52
7.0.240.0080.00515.39
7.0.230.0110.00315.48
7.0.220.0040.00815.50
7.0.210.0070.00715.31
7.0.200.0070.00615.87
7.0.190.0040.00915.47
7.0.180.0080.00515.26
7.0.170.0050.00715.47
7.0.160.0050.00715.41
7.0.150.0040.00715.44
7.0.140.0050.03017.52
7.0.130.0030.00815.49
7.0.120.0070.00515.48
7.0.110.0050.00915.47
7.0.100.0020.00815.24
7.0.90.0010.00915.43
7.0.80.0100.00515.36
7.0.70.0030.00915.46
7.0.60.0060.01717.00
7.0.50.0020.02116.32
7.0.40.0060.02215.68
7.0.30.0190.02015.57
7.0.20.0130.03115.58
7.0.10.0120.01615.76
7.0.00.0050.02015.68
5.6.400.0050.00814.54
5.6.390.0070.00314.47
5.6.380.0060.01014.25
5.6.370.0050.01014.51
5.6.360.0050.00514.41
5.6.350.0070.00714.42
5.6.340.0110.00214.45
5.6.330.0000.01014.41
5.6.320.0060.00914.29
5.6.310.0060.00814.36
5.6.300.0060.00714.69
5.6.290.0080.00614.54
5.6.280.0030.03216.79
5.6.270.0050.00614.72
5.6.260.0040.01114.45
5.6.250.0070.00814.65
5.6.240.0040.01114.46
5.6.230.0070.00414.36
5.6.220.0050.00714.33
5.6.210.0050.03416.42
5.6.200.0070.01915.61
5.6.190.0100.02016.47
5.6.180.0100.02016.39
5.6.170.0100.02616.42
5.6.160.0080.02916.35
5.6.150.0020.03415.65
5.6.140.0040.01815.67
5.6.130.0070.02915.74
5.6.120.0030.02516.77
5.6.110.0090.02816.58
5.6.100.0070.03016.68
5.6.90.0120.02816.60
5.6.80.0040.02016.49
5.6.70.0040.00914.29
5.6.60.0080.00514.45
5.6.50.0050.01014.19
5.6.40.0070.00414.38
5.6.30.0070.00714.19
5.6.20.0040.01014.34
5.6.10.0050.00914.29
5.6.00.0020.00914.44
5.5.380.0090.00414.29
5.5.370.0070.00714.29
5.5.360.0050.00614.54
5.5.350.0060.02116.42
5.5.340.0030.03415.53
5.5.330.0060.01916.21
5.5.320.0120.03116.45
5.5.310.0070.01916.45
5.5.300.0050.03315.49
5.5.290.0060.01715.44
5.5.280.0020.02216.40
5.5.270.0080.03016.48
5.5.260.0100.02616.47
5.5.250.0050.02916.29
5.5.240.0050.02816.12
5.5.230.0090.00414.23
5.5.220.0020.01214.21
5.5.210.0000.01414.30
5.5.200.0050.00914.32
5.5.190.0050.01014.32
5.5.180.0020.01014.28
5.5.170.0030.01114.13
5.5.160.0100.00314.22
5.5.150.0070.00514.47
5.5.140.0020.01214.48
5.5.130.0120.00314.19
5.5.120.0020.01014.44
5.5.110.0060.01114.28
5.5.100.0070.00914.21
5.5.90.0080.00414.29
5.5.80.0080.00514.23
5.5.70.0060.01014.30
5.5.60.0070.00914.16
5.5.50.0070.00714.12
5.5.40.0080.00614.34
5.5.30.0020.00714.21
5.5.20.0050.01114.37
5.5.10.0080.00914.18
5.5.00.0030.00814.06
5.4.450.0060.02314.52
5.4.440.0080.02214.62
5.4.430.0090.02314.43
5.4.420.0090.02014.63
5.4.410.0060.02314.46
5.4.400.0090.02114.38
5.4.390.0100.02114.52
5.4.380.0030.02614.19
5.4.370.0080.02214.16
5.4.360.0050.02314.15
5.4.350.0060.02414.23
5.4.340.0060.02214.22
5.4.330.0050.00912.02
5.4.320.0060.01512.10
5.4.310.0060.01512.13
5.4.300.0070.01712.24
5.4.290.0090.01712.18
5.4.280.0060.01612.09
5.4.270.0040.01812.19
5.4.260.0060.01912.18
5.4.250.0050.01512.05
5.4.240.0040.01912.14
5.4.230.0040.02012.07
5.4.220.0050.01612.12
5.4.210.0060.01712.19
5.4.200.0050.01912.01
5.4.190.0030.02412.20
5.4.180.0060.02912.15
5.4.170.0070.02212.03
5.4.160.0070.01812.13
5.4.150.0090.01311.99
5.4.140.0090.01412.01
5.4.130.0040.02211.93
5.4.120.0050.01912.05
5.4.110.0060.01811.97
5.4.100.0080.01612.07
5.4.90.0040.02212.06
5.4.80.0050.02011.95
5.4.70.0060.02112.13
5.4.60.0030.02012.04
5.4.50.0060.01412.09
5.4.40.0040.01712.00
5.4.30.0060.01611.98
5.4.20.0070.02112.06
5.4.10.0100.02112.07
5.4.00.0050.02811.91
5.3.290.0060.01612.18
5.3.280.0130.05212.09
5.3.270.0080.03112.10
5.3.260.0070.03312.13
5.3.250.0090.04112.10
5.3.240.0080.02912.12
5.3.230.0100.03312.12
5.3.220.0080.02712.09
5.3.210.0090.03912.11
5.3.200.0080.03012.08
5.3.190.0080.02812.09
5.3.180.0090.03112.12
5.3.170.0060.03812.08
5.3.160.0050.03112.13
5.3.150.0050.02212.14
5.3.140.0070.02812.12
5.3.130.0120.04112.11
5.3.120.0100.04412.08
5.3.110.0060.03012.11
5.3.100.0020.02011.93
5.3.90.0050.02411.96
5.3.80.0110.02711.90
5.3.70.0100.03211.90
5.3.60.0080.03011.89
5.3.50.0070.01911.88
5.3.40.0090.02511.88
5.3.30.0080.02311.89
5.3.20.0070.02611.79
5.3.10.0080.02711.78
5.3.00.0080.02811.77
5.2.170.0040.0379.18
5.2.160.0140.0449.18
5.2.150.0060.0329.18
5.2.140.0070.0379.18
5.2.130.0090.0379.14
5.2.120.0120.0709.14
5.2.110.0060.0519.15
5.2.100.0130.0599.14
5.2.90.0050.0669.14
5.2.80.0130.0879.14
5.2.70.0110.0629.14
5.2.60.0120.0769.10
5.2.50.0190.1059.07
5.2.40.0060.0359.04
5.2.30.0080.0689.01
5.2.20.0180.0699.01
5.2.10.0100.0538.93
5.2.00.0070.0388.79
5.1.60.0060.0318.07
5.1.50.0040.0268.07
5.1.40.0060.0368.05
5.1.30.0060.0318.40
5.1.20.0090.0498.42
5.1.10.0070.0328.14
5.1.00.0080.0558.14
5.0.50.0110.0486.62
5.0.40.0090.0466.48
5.0.30.0110.0616.30
5.0.20.0030.0336.26
5.0.10.0060.0336.24
5.0.00.0060.0736.24
4.4.90.0170.0444.78
4.4.80.0050.0354.76
4.4.70.0080.0614.75
4.4.60.0030.0204.75
4.4.50.0240.0724.77
4.4.40.0100.0464.71
4.4.30.0040.0224.76
4.4.20.0060.0204.84
4.4.10.0090.0394.85
4.4.00.0040.0574.76
4.3.110.0080.0444.67
4.3.100.0060.0284.67
4.3.90.0050.0294.63
4.3.80.0080.0284.59
4.3.70.0040.0204.63
4.3.60.0090.0334.62
4.3.50.0120.0284.63
4.3.40.0030.0334.53
4.3.30.0040.0213.29
4.3.20.0030.0203.27
4.3.10.0030.0203.22
4.3.00.0000.0237.52

preferences:
41.35 ms | 401 KiB | 5 Q