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 gettype($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.60.0070.00718.68
8.3.50.0110.00722.01
8.3.40.0150.00018.76
8.3.30.0040.01119.01
8.3.20.0000.00820.41
8.3.10.0090.00023.70
8.3.00.0000.00819.38
8.2.180.0110.00718.29
8.2.170.0150.00622.96
8.2.160.0030.01020.38
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0000.00826.16
8.2.120.0040.00422.34
8.2.110.0030.00619.14
8.2.100.0080.00318.03
8.2.90.0000.00819.35
8.2.80.0040.00417.97
8.2.70.0050.00317.61
8.2.60.0050.00318.18
8.2.50.0090.00018.07
8.2.40.0040.00420.00
8.2.30.0070.00018.21
8.2.20.0040.00417.82
8.2.10.0000.00718.09
8.2.00.0080.00317.91
8.1.280.0100.00625.92
8.1.270.0040.00423.83
8.1.260.0030.00626.35
8.1.250.0080.00028.09
8.1.240.0090.00021.47
8.1.230.0070.00717.52
8.1.220.0030.00517.74
8.1.210.0080.00018.77
8.1.200.0060.00317.23
8.1.190.0000.00817.35
8.1.180.0030.00618.10
8.1.170.0040.00418.69
8.1.160.0030.00522.06
8.1.150.0090.00018.66
8.1.140.0040.00417.39
8.1.130.0030.00317.77
8.1.120.0040.00417.52
8.1.110.0030.00517.50
8.1.100.0040.00417.54
8.1.90.0030.00317.55
8.1.80.0030.00517.44
8.1.70.0000.00717.40
8.1.60.0000.00817.63
8.1.50.0000.00817.52
8.1.40.0000.00917.52
8.1.30.0030.00617.55
8.1.20.0000.00817.60
8.1.10.0000.00817.61
8.1.00.0030.00617.55
8.0.300.0060.00618.77
8.0.290.0000.00716.75
8.0.280.0070.00018.38
8.0.270.0000.00717.29
8.0.260.0060.00017.30
8.0.250.0000.00717.06
8.0.240.0070.00016.89
8.0.230.0040.00416.96
8.0.220.0050.00216.99
8.0.210.0030.00516.88
8.0.200.0000.00617.03
8.0.190.0040.00417.00
8.0.180.0040.00417.03
8.0.170.0030.00516.88
8.0.160.0050.00316.85
8.0.150.0030.00516.86
8.0.140.0050.00216.91
8.0.130.0030.00313.45
8.0.120.0040.00416.84
8.0.110.0030.00617.01
8.0.100.0030.00516.96
8.0.90.0040.00416.95
8.0.80.0060.00916.99
8.0.70.0030.00616.90
8.0.60.0030.00517.02
8.0.50.0000.00717.01
8.0.30.0050.01416.82
8.0.20.0090.01017.40
8.0.10.0050.00317.07
8.0.00.0090.01116.96
7.4.330.0000.00515.14
7.4.320.0000.00716.61
7.4.300.0060.00016.43
7.4.290.0000.00716.59
7.4.280.0030.00516.46
7.4.270.0030.00616.66
7.4.260.0030.00316.62
7.4.250.0040.00416.42
7.4.240.0000.00716.68
7.4.230.0000.00816.63
7.4.220.0060.01216.52
7.4.210.0050.01316.53
7.4.200.0000.00716.45
7.4.190.0020.00516.70
7.4.160.0130.00716.75
7.4.150.0110.00717.40
7.4.140.0080.01317.86
7.4.130.0100.00716.55
7.4.120.0030.01416.56
7.4.110.0070.01616.44
7.4.100.0090.01516.47
7.4.90.0100.00716.30
7.4.80.0030.01519.39
7.4.70.0120.00616.77
7.4.60.0130.00316.53
7.4.50.0060.00016.45
7.4.40.0070.01716.61
7.4.30.0090.00916.48
7.4.00.0030.00914.84
7.3.330.0000.00713.48
7.3.320.0050.00013.27
7.3.310.0040.00416.40
7.3.300.0030.00316.36
7.3.290.0030.01616.34
7.3.280.0080.01016.38
7.3.270.0150.00317.40
7.3.260.0140.00316.60
7.3.250.0100.00816.51
7.3.240.0120.00916.51
7.3.230.0070.01016.57
7.3.210.0090.00916.53
7.3.200.0110.01119.39
7.3.190.0140.00516.57
7.3.180.0090.01216.56
7.3.170.0090.01216.41
7.3.160.0030.01216.52
7.3.120.0060.00614.79
7.3.10.0030.01016.35
7.3.00.0060.00916.80
7.2.330.0030.01516.86
7.2.320.0030.01416.73
7.2.310.0070.01716.87
7.2.300.0030.01316.48
7.2.290.0040.01316.59
7.2.130.0000.01416.88
7.2.120.0030.00617.02
7.2.110.0060.00616.85
7.2.100.0080.00016.95
7.2.90.0030.00816.73
7.2.80.0040.00816.64
7.2.70.0130.00017.08
7.2.60.0060.00616.89
7.2.50.0110.00416.80
7.2.40.0060.00317.06
7.2.30.0070.00717.00
7.2.20.0000.01416.95
7.2.10.0070.00316.92
7.2.00.0010.01118.31
7.1.250.0000.01316.02
7.1.200.0030.00615.83
7.1.100.0030.01317.95
7.1.70.0040.00416.87
7.1.60.0040.02219.46
7.1.50.0070.01716.89
7.1.00.0000.08322.48
7.0.200.0030.00616.78
7.0.140.0070.06022.01
7.0.60.0400.06319.98
7.0.50.0130.06018.00
7.0.40.0100.08020.23
7.0.30.0330.07720.08
7.0.20.0370.05720.23
7.0.10.0070.04720.07
7.0.00.0070.08320.20
5.6.280.0100.06721.09
5.6.210.0070.03720.73
5.6.200.0030.07018.24
5.6.190.0200.07320.77
5.6.180.0230.03720.39
5.6.170.0270.07320.56
5.6.160.0130.08020.46
5.6.150.0070.05318.27
5.6.140.0070.07718.15
5.6.130.0030.08718.13
5.6.120.0070.04321.16
5.6.110.0030.08720.99
5.6.100.0070.03721.00
5.6.90.0170.07720.98
5.6.80.0000.08320.39
5.5.350.0100.08320.34
5.5.340.0130.03718.08
5.5.330.0130.07320.21
5.5.320.0300.08020.42
5.5.310.0300.07320.39
5.5.300.0070.08017.97
5.5.290.0270.05717.93
5.5.280.0030.04020.79
5.5.270.0130.08020.90
5.5.260.0000.09020.98
5.5.250.0100.07720.63
5.5.240.0300.07020.30
5.4.450.0170.05719.60
5.4.440.0230.05019.61
5.4.430.0100.06019.58
5.4.420.0130.05719.55
5.4.410.0200.04719.07
5.4.400.0130.05719.13
5.4.390.0300.04319.38
5.4.380.0170.05018.72
5.4.370.0070.06018.63
5.4.360.0100.06318.84
5.4.350.0200.04718.84
5.4.340.0100.05318.79
5.4.320.0060.04412.52
5.4.310.0040.04212.52
5.4.300.0040.04012.52
5.4.290.0060.04512.51
5.4.280.0060.03512.41
5.4.270.0060.03712.41
5.4.260.0050.04212.41
5.4.250.0150.06912.41
5.4.240.0130.08712.41
5.4.230.0070.05412.40
5.4.220.0090.03912.40
5.4.210.0100.04912.41
5.4.200.0090.06912.40
5.4.190.0090.05112.40
5.4.180.0090.03712.39
5.4.170.0060.05412.41
5.4.160.0090.04912.40
5.4.150.0110.06112.40
5.4.140.0040.05512.08
5.4.130.0060.03612.07
5.4.120.0130.04512.03
5.4.110.0120.05512.02
5.4.100.0150.06512.03
5.4.90.0130.06112.02
5.4.80.0130.05212.03
5.4.70.0080.06212.02
5.4.60.0170.04712.02
5.4.50.0080.05812.02
5.4.40.0050.05512.02
5.4.30.0080.07712.01
5.4.20.0110.04812.01
5.4.10.0050.05512.01
5.4.00.0100.04911.50
5.3.290.0110.05212.80
5.3.280.0110.04812.72
5.3.270.0080.04812.73
5.3.260.0100.04312.73
5.3.250.0080.04612.73
5.3.240.0120.04312.73
5.3.230.0100.09212.72
5.3.220.0130.08712.70
5.3.210.0060.05912.70
5.3.200.0080.06712.70
5.3.190.0280.05912.70
5.3.180.0120.08312.69
5.3.170.0100.06912.70
5.3.160.0110.05412.69
5.3.150.0130.06212.69
5.3.140.0080.05512.68
5.3.130.0090.05512.68
5.3.120.0110.07312.67
5.3.110.0070.05812.68
5.3.100.0110.06912.16
5.3.90.0110.05012.14
5.3.80.0120.07312.13
5.3.70.0090.05412.13
5.3.60.0140.07412.12
5.3.50.0130.06012.07
5.3.40.0070.07212.07
5.3.30.0140.07912.03
5.3.20.0290.08111.80
5.3.10.0220.06211.77
5.3.00.0130.07211.76
5.2.170.0110.0649.18
5.2.160.0130.0719.18
5.2.150.0080.0729.18
5.2.140.0070.0339.18
5.2.130.0080.0299.14
5.2.120.0050.0339.14
5.2.110.0090.0459.15
5.2.100.0090.0469.14
5.2.90.0040.0489.14
5.2.80.0040.0499.14
5.2.70.0100.0559.14
5.2.60.0090.0539.09
5.2.50.0250.1329.07
5.2.40.0160.0749.04
5.2.30.0120.0489.01
5.2.20.0140.0549.01
5.2.10.0080.0388.93
5.2.00.0050.0308.79
5.1.60.0070.0258.07
5.1.50.0190.0698.07
5.1.40.0070.0228.05
5.1.30.0050.0288.39
5.1.20.0070.0318.42
5.1.10.0040.0408.15
5.1.00.0110.0498.15
5.0.50.0070.0406.63
5.0.40.0150.0856.48
5.0.30.0060.0516.30
5.0.20.0090.0316.27
5.0.10.0090.0316.25
5.0.00.0030.0426.23
4.4.90.0030.0184.77
4.4.80.0030.0234.75
4.4.70.0080.0324.75
4.4.60.0050.0184.76
4.4.50.0080.0394.77
4.4.40.0080.0374.71
4.4.30.0070.0214.76
4.4.20.0220.0384.84
4.4.10.0030.0234.85
4.4.00.0220.0754.76
4.3.110.0030.0184.67
4.3.100.0100.0404.67
4.3.90.0040.0214.63
4.3.80.0070.0344.58
4.3.70.0030.0234.63
4.3.60.0030.0224.63
4.3.50.0020.0234.63
4.3.40.0060.0514.54
4.3.30.0030.0223.28
4.3.20.0030.0163.26
4.3.10.0010.0183.22
4.3.00.0030.0207.53

preferences:
41.15 ms | 401 KiB | 5 Q