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(); } 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.0060.00818.52
8.3.50.0070.01121.95
8.3.40.0120.00318.65
8.3.30.0170.00319.23
8.3.20.0040.00420.25
8.3.10.0070.00423.61
8.3.00.0040.00419.51
8.2.180.0160.00316.35
8.2.170.0110.01122.96
8.2.160.0090.00620.35
8.2.150.0060.00324.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0090.00022.24
8.2.110.0050.00522.23
8.2.100.0090.00317.91
8.2.90.0000.00819.30
8.2.80.0050.00318.04
8.2.70.0040.00417.75
8.2.60.0040.00418.05
8.2.50.0040.00418.07
8.2.40.0000.00919.84
8.2.30.0080.00018.11
8.2.20.0000.00817.69
8.2.10.0040.00418.13
8.2.00.0000.00917.75
8.1.280.0090.00625.92
8.1.270.0040.00423.92
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0030.00624.02
8.1.230.0110.00019.15
8.1.220.0000.00817.74
8.1.210.0060.00318.77
8.1.200.0040.00417.50
8.1.190.0040.00417.66
8.1.180.0060.00318.10
8.1.170.0050.00318.58
8.1.160.0040.00421.93
8.1.150.0040.00818.54
8.1.140.0040.00417.49
8.1.130.0000.00717.84
8.1.120.0030.00517.53
8.1.110.0030.00517.47
8.1.100.0070.00017.48
8.1.90.0040.00417.36
8.1.80.0080.00017.49
8.1.70.0030.00317.44
8.1.60.0090.00017.56
8.1.50.0080.00017.50
8.1.40.0030.00517.49
8.1.30.0040.00417.59
8.1.20.0000.00817.66
8.1.10.0000.00817.58
8.1.00.0040.00417.53
8.0.300.0060.00320.64
8.0.290.0070.00017.04
8.0.280.0030.00318.34
8.0.270.0000.00717.32
8.0.260.0030.00317.29
8.0.250.0000.00717.00
8.0.240.0000.00716.95
8.0.230.0030.00317.08
8.0.220.0000.00716.85
8.0.210.0030.00316.96
8.0.200.0030.00317.05
8.0.190.0030.00516.94
8.0.180.0020.00517.05
8.0.170.0080.00016.89
8.0.160.0070.00017.04
8.0.150.0040.00416.93
8.0.140.0000.00716.91
8.0.130.0060.00013.33
8.0.120.0000.00816.95
8.0.110.0000.00716.98
8.0.100.0040.00416.88
8.0.90.0050.00317.02
8.0.80.0040.01116.96
8.0.70.0050.00316.97
8.0.60.0000.00716.83
8.0.50.0000.00816.93
8.0.30.0060.01317.22
8.0.20.0150.00317.43
8.0.10.0040.00416.97
8.0.00.0060.01516.89
7.4.330.0000.00515.00
7.4.320.0040.00416.63
7.4.300.0000.00616.50
7.4.290.0070.00016.45
7.4.280.0050.00216.52
7.4.270.0000.00716.42
7.4.260.0040.00416.50
7.4.250.0030.00516.46
7.4.240.0020.00516.52
7.4.230.0000.00616.63
7.4.220.0100.00716.72
7.4.210.0080.00916.63
7.4.200.0030.00516.47
7.4.190.0050.00316.48
7.4.160.0090.00916.69
7.4.150.0070.01117.40
7.4.140.0130.00517.86
7.4.130.0110.00816.57
7.4.120.0110.00616.63
7.4.110.0110.00616.54
7.4.100.0080.00916.56
7.4.90.0070.01016.50
7.4.80.0030.01519.39
7.4.70.0100.00716.49
7.4.60.0090.00916.52
7.4.50.0000.00516.29
7.4.40.0100.01416.63
7.4.30.0130.00716.63
7.4.00.0090.00615.16
7.3.330.0030.00313.41
7.3.320.0030.00313.34
7.3.310.0040.00416.36
7.3.300.0070.00016.41
7.3.290.0100.00716.39
7.3.280.0110.00816.40
7.3.270.0100.00717.40
7.3.260.0110.00516.52
7.3.250.0080.01016.59
7.3.240.0140.00316.58
7.3.230.0110.00616.52
7.3.210.0090.00916.59
7.3.200.0070.01419.39
7.3.190.0040.01816.42
7.3.180.0150.00016.62
7.3.170.0080.00916.54
7.3.160.0090.00616.36
7.3.120.0030.00914.80
7.2.330.0100.01416.81
7.2.320.0090.00816.63
7.2.310.0090.00916.60
7.2.300.0090.00916.83
7.2.290.0080.01116.84
7.2.00.0060.00919.16
7.1.200.0120.00015.92
7.1.100.0000.01418.14
7.1.70.0000.00716.86
7.1.60.0070.01719.46
7.1.50.0000.02316.86
7.1.00.0100.07022.27
7.0.200.0000.00716.54
7.0.140.0030.07322.12
7.0.60.0130.06719.93
7.0.50.0000.08017.93
7.0.40.0070.08020.30
7.0.30.0170.06720.25
7.0.20.0300.05320.24
7.0.10.0070.06320.15
7.0.00.0000.09020.30
5.6.280.0070.07321.05
5.6.210.0000.06320.71
5.6.200.0030.07718.16
5.6.190.0130.05720.63
5.6.180.0430.07720.63
5.6.170.0170.04320.55
5.6.160.0030.04320.43
5.6.150.0070.08018.16
5.6.140.0070.08018.27
5.6.130.0030.04018.28
5.6.120.0130.05021.03
5.6.110.0130.08020.91
5.6.100.0130.07320.99
5.6.90.0030.06321.04
5.6.80.0070.06320.40
5.5.350.4170.04720.36
5.5.340.0070.07717.99
5.5.330.0070.06320.27
5.5.320.0170.04320.22
5.5.310.0370.04020.24
5.5.300.0000.04318.08
5.5.290.0070.06718.05
5.5.280.0030.04320.89
5.5.270.0030.08720.81
5.5.260.0100.07020.74
5.5.250.0230.07320.66
5.5.240.0030.08020.27
5.4.450.0230.05019.31
5.4.440.0230.04719.17
5.4.430.0270.05719.48
5.4.420.0230.05319.44
5.4.410.0200.06319.47
5.4.400.0170.05319.02
5.4.390.0200.05018.83
5.4.380.0100.05718.79
5.4.370.0170.05018.61
5.4.360.0070.05718.68
5.4.350.0270.04318.62
5.4.340.0100.05318.76
5.4.320.0070.04312.52
5.4.310.0040.04012.51
5.4.300.0100.03512.52
5.4.290.0060.05512.51
5.4.280.0090.07312.41
5.4.270.0060.05312.41
5.4.260.0040.04812.41
5.4.250.0090.04812.41
5.4.240.0090.05112.41
5.4.230.0100.04812.40
5.4.220.0080.03712.41
5.4.210.0070.03512.40
5.4.200.0070.04012.40
5.4.190.0050.03912.39
5.4.180.0090.03712.40
5.4.170.0080.03812.41
5.4.160.0080.03812.41
5.4.150.0110.03512.40
5.4.140.0100.05312.09
5.4.130.0120.04712.08
5.4.120.0090.06312.03
5.4.110.0190.11512.03
5.4.100.0140.04712.03
5.4.90.0120.05612.03
5.4.80.0080.05412.03
5.4.70.0210.09412.03
5.4.60.0060.06512.02
5.4.50.0140.05012.02
5.4.40.0080.04312.01
5.4.30.0080.04512.00
5.4.20.0130.07912.01
5.4.10.0070.06112.01
5.4.00.0100.04811.50
5.3.290.0040.04212.80
5.3.280.0080.05112.71
5.3.270.0080.05512.73
5.3.260.0060.05012.73
5.3.250.0180.07212.73
5.3.240.0070.07412.73
5.3.230.0080.04812.72
5.3.220.0040.05312.70
5.3.210.0240.10512.69
5.3.200.0150.05412.69
5.3.190.0160.07512.70
5.3.180.0060.05512.70
5.3.170.0090.04312.69
5.3.160.0070.05512.69
5.3.150.0100.04812.70
5.3.140.0100.04412.68
5.3.130.0100.05212.68
5.3.120.0160.09912.68
5.3.110.0140.06812.68
5.3.100.0100.08812.16
5.3.90.0120.05812.14
5.3.80.0090.06212.13
5.3.70.0160.05812.13
5.3.60.0060.04612.12
5.3.50.0080.04112.07
5.3.40.0040.04212.06
5.3.30.0070.04412.02
5.3.20.0080.04611.80
5.3.10.0060.04011.77
5.3.00.0050.04311.75
5.2.170.0110.0559.19
5.2.160.0080.0639.18
5.2.150.0130.0419.18
5.2.140.0080.0419.18
5.2.130.0100.0509.14
5.2.120.0080.0419.14
5.2.110.0030.0349.15
5.2.100.0050.0359.14
5.2.90.0070.0309.14
5.2.80.0030.0329.14
5.2.70.0040.0439.14
5.2.60.0070.0399.10
5.2.50.0050.0309.06
5.2.40.0050.0299.04
5.2.30.0070.0289.01
5.2.20.0090.0359.01
5.2.10.0040.0468.93
5.2.00.0050.0338.78
5.1.60.0040.0278.07
5.1.50.0070.0298.07
5.1.40.0040.0398.05
5.1.30.0060.0378.40
5.1.20.0040.0398.43
5.1.10.0050.0378.14
5.1.00.0080.0358.14
5.0.50.0040.0296.62
5.0.40.0080.0226.48
5.0.30.0040.0376.29
5.0.20.0030.0246.27
5.0.10.0030.0206.25
5.0.00.0040.0416.24
4.4.90.0020.0244.77
4.4.80.0040.0214.75
4.4.70.0020.0234.75
4.4.60.0030.0214.76
4.4.50.0040.0244.77
4.4.40.0040.0474.71
4.4.30.0030.0274.76
4.4.20.0040.0184.84
4.4.10.0120.0604.85
4.4.00.0040.0364.76
4.3.110.0070.0214.67
4.3.100.0030.0184.66
4.3.90.0030.0214.63
4.3.80.0040.0344.59
4.3.70.0030.0234.63
4.3.60.0040.0254.62
4.3.50.0070.0284.63
4.3.40.0070.0424.54
4.3.30.0040.0293.29
4.3.20.0100.0603.27
4.3.10.0040.0463.22
4.3.00.0070.0207.53

preferences:
40.03 ms | 401 KiB | 5 Q