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')); try { echo $exception->getMessage(); } catch (\Exception $e) { // Ignore this $e exception, we have to deal with $exception } 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.40.0150.00018.77
8.3.30.0150.00019.16
8.3.20.0040.00420.25
8.3.10.0080.00023.52
8.3.00.0080.00019.50
8.2.170.0120.00322.96
8.2.160.0170.00320.39
8.2.150.0040.01124.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0050.00322.27
8.2.110.0040.01422.08
8.2.100.0090.00317.97
8.2.90.0040.00418.97
8.2.80.0000.00818.05
8.2.70.0110.00417.38
8.2.60.0070.00318.05
8.2.50.0090.00018.07
8.2.40.0000.00820.07
8.2.30.0040.00418.11
8.2.20.0000.00817.75
8.2.10.0030.00519.78
8.2.00.0030.00717.87
8.1.270.0030.00524.02
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0050.00523.80
8.1.230.0080.00419.11
8.1.220.0000.00817.74
8.1.210.0030.00518.77
8.1.200.0050.00517.35
8.1.190.0030.00617.66
8.1.180.0090.00018.10
8.1.170.0000.00818.56
8.1.160.0040.00422.04
8.1.150.0030.00918.68
8.1.140.0040.00417.40
8.1.130.0000.00717.77
8.1.120.0000.00817.38
8.1.110.0000.00717.53
8.1.100.0040.00417.44
8.1.90.0040.00417.40
8.1.80.0000.00817.45
8.1.70.0070.00017.46
8.1.60.0000.00817.59
8.1.50.0000.00817.59
8.1.40.0000.00717.43
8.1.30.0030.00517.61
8.1.20.0040.00417.64
8.1.10.0040.00417.54
8.1.00.0060.00317.43
8.0.300.0050.00318.77
8.0.290.0000.00716.92
8.0.280.0000.00718.38
8.0.270.0030.00317.17
8.0.260.0000.00617.16
8.0.250.0070.00017.06
8.0.240.0030.00317.04
8.0.230.0000.00717.06
8.0.220.0030.00316.95
8.0.210.0030.00317.01
8.0.200.0000.00717.06
8.0.190.0040.00416.93
8.0.180.0070.00017.00
8.0.170.0000.00917.01
8.0.160.0040.00416.90
8.0.150.0070.00016.95
8.0.140.0030.00616.93
8.0.130.0000.00613.39
8.0.120.0030.00516.88
8.0.110.0000.00817.04
8.0.100.0070.00017.02
8.0.90.0000.00817.02
8.0.80.0120.00317.02
8.0.70.0050.00316.93
8.0.60.0060.00316.86
8.0.50.0020.00516.96
8.0.30.0150.00317.03
8.0.20.0050.01417.40
8.0.10.0000.00816.99
8.0.00.0130.00616.92
7.4.330.0000.00515.00
7.4.320.0080.00016.62
7.4.300.0000.00616.68
7.4.290.0000.00716.58
7.4.280.0050.00316.64
7.4.270.0080.00016.55
7.4.260.0000.00716.59
7.4.250.0040.00416.50
7.4.240.0020.00616.66
7.4.230.0030.00316.62
7.4.220.0040.01616.49
7.4.210.0060.01016.59
7.4.200.0040.00416.64
7.4.190.0000.00716.59
7.4.160.0060.01016.60
7.4.150.0030.01417.40
7.4.140.0150.00817.86
7.4.130.0050.01416.44
7.4.120.0130.00516.50
7.4.110.0100.00716.50
7.4.100.0070.01016.43
7.4.90.0150.00316.50
7.4.80.0070.01019.39
7.4.70.0100.00716.61
7.4.60.0100.01016.50
7.4.50.0030.00616.30
7.4.40.0060.01616.72
7.4.30.0090.00616.33
7.4.10.0030.01616.59
7.4.00.0120.00315.72
7.3.330.0030.00313.42
7.3.320.0000.00513.38
7.3.310.0040.00416.35
7.3.300.0030.00316.27
7.3.290.0050.00816.47
7.3.280.0110.00616.32
7.3.270.0030.01417.40
7.3.260.0100.01316.66
7.3.250.0030.01416.54
7.3.240.0170.00016.51
7.3.230.0060.01016.39
7.3.210.0090.00916.61
7.3.200.0060.01719.39
7.3.190.0180.00416.47
7.3.180.0120.00416.41
7.3.170.0030.01716.60
7.3.160.0160.00016.58
7.3.130.0080.01116.49
7.3.120.0070.00915.63
7.3.110.0040.00916.33
7.3.100.0120.00316.39
7.3.90.0050.00516.25
7.3.80.0070.00716.26
7.3.70.0040.01116.40
7.3.60.0080.01116.47
7.3.50.0070.01016.45
7.3.40.0030.01116.41
7.3.30.0060.00616.54
7.3.20.0070.01018.16
7.3.10.0030.01318.24
7.3.00.0090.00318.21
7.2.330.0130.01016.55
7.2.320.0140.00316.80
7.2.310.0130.00316.61
7.2.300.0130.00716.86
7.2.290.0080.01616.80
7.2.260.0060.01016.43
7.2.250.0100.00716.92
7.2.240.0080.00816.82
7.2.230.0090.00616.76
7.2.220.0060.01016.80
7.2.210.0120.00616.63
7.2.200.0080.00416.64
7.2.190.0040.01216.71
7.2.180.0070.00316.65
7.2.170.0040.00816.59
7.2.160.0040.00816.58
7.2.150.0070.01318.38
7.2.140.0030.01018.42
7.2.130.0060.00918.31
7.2.120.0070.01018.51
7.2.110.0070.01018.57
7.2.100.0090.00318.49
7.2.90.0060.00618.23
7.2.80.0030.01018.45
7.2.70.0040.01118.49
7.2.60.0080.01017.68
7.2.50.0070.00718.43
7.2.40.0140.00018.31
7.2.30.0060.00318.57
7.2.20.0110.00018.35
7.2.10.0040.01118.41
7.2.00.0050.01018.99
7.1.330.0100.00317.40
7.1.320.0070.01017.39
7.1.310.0140.00017.70
7.1.300.0040.01417.29
7.1.290.0060.00617.30
7.1.280.0000.01117.50
7.1.270.0030.01417.46
7.1.260.0030.00717.45
7.1.250.0070.00717.27
7.1.240.0030.01317.18
7.1.230.0030.01417.34
7.1.220.0060.01017.33
7.1.210.0030.01217.29
7.1.200.0040.00516.52
7.1.190.0070.01117.38
7.1.180.0030.01217.27
7.1.170.0060.00917.34
7.1.160.0070.00717.18
7.1.150.0090.00617.31
7.1.140.0070.00717.36
7.1.130.0160.00017.32
7.1.120.0030.00917.33
7.1.110.0100.00317.24
7.1.100.0070.00817.56
7.1.90.0130.00617.35
7.1.80.0030.00917.30
7.1.70.0050.00617.33
7.1.60.0100.00918.46
7.1.50.0050.01517.20
7.1.40.0030.01317.28
7.1.30.0000.01017.15
7.1.20.0030.00617.32
7.1.10.0040.01117.46
7.1.00.0060.03819.86
7.0.330.0100.00317.05
7.0.320.0030.01216.90
7.0.310.0070.00716.98
7.0.300.0040.01117.01
7.0.290.0060.00617.07
7.0.280.0050.00517.05
7.0.270.0060.00616.98
7.0.260.0100.00317.11
7.0.250.0130.00317.09
7.0.240.0030.01016.92
7.0.230.0100.00717.13
7.0.220.0030.00917.13
7.0.210.0080.00417.13
7.0.200.0050.00716.82
7.0.190.0060.01017.09
7.0.180.0060.00317.15
7.0.170.0090.00317.00
7.0.160.0000.01417.13
7.0.150.0060.00316.99
7.0.140.0000.04519.63
7.0.130.0030.01216.78
7.0.120.0060.00917.11
7.0.110.0100.00317.09
7.0.100.0030.00916.91
7.0.90.0170.04818.58
7.0.80.0120.03518.52
7.0.70.0180.03118.47
7.0.60.0180.02818.49
7.0.50.0120.04118.68
7.0.40.0060.02517.66
7.0.30.0090.04417.51
7.0.20.0120.03517.53
7.0.10.0070.04217.58
7.0.00.0070.03917.63
5.6.400.0030.01016.18
5.6.390.0070.01016.09
5.6.380.0070.00416.12
5.6.370.0030.01016.14
5.6.360.0030.01016.12
5.6.350.0090.00616.08
5.6.340.0030.01015.94
5.6.330.0030.01015.94
5.6.320.0030.01715.76
5.6.310.0030.01016.09
5.6.300.0090.00616.19
5.6.290.0030.01316.01
5.6.280.0080.03818.58
5.6.270.0030.01016.03
5.6.260.0100.00316.03
5.6.250.0040.01115.96
5.6.240.0100.00016.02
5.6.230.0080.02618.31
5.6.220.0030.02818.32
5.6.210.0050.03418.30
5.6.200.0110.04118.60
5.6.190.0110.02918.43
5.6.180.0100.04218.51
5.6.170.0080.04418.37
5.6.160.0090.03918.54
5.6.150.0020.05018.69
5.6.140.0060.04318.56
5.6.130.0070.03818.42
5.6.120.0080.04518.35
5.6.110.0050.04218.44
5.6.100.0050.04518.46
5.6.90.0090.02518.31
5.6.80.0080.04318.22
5.6.70.0100.03218.21
5.6.60.0050.04118.02
5.6.50.0020.02918.26
5.6.40.0050.04418.08
5.6.30.0030.03418.19
5.6.20.0020.03718.17
5.6.10.0040.02518.24
5.6.00.0120.04218.20
5.5.380.0070.00415.70
5.5.370.0070.03418.04
5.5.360.0080.04317.97
5.5.350.0030.03118.22
5.5.340.0080.02618.27
5.5.330.0100.04018.41
5.5.320.0070.02718.18
5.5.310.0140.04018.33
5.5.300.0050.04718.31
5.5.290.0080.04718.42
5.5.280.0070.04718.29
5.5.270.0070.03718.49
5.5.260.0030.04518.41
5.5.250.0070.03818.27
5.5.240.0060.04117.91
5.5.230.0060.02317.98
5.5.220.0030.03017.99
5.5.210.0040.04018.08
5.5.200.0020.04318.01
5.5.190.0040.02818.03
5.5.180.0090.02217.95
5.5.170.0080.00415.82
5.5.160.0100.03218.06
5.5.150.0020.04218.08
5.5.140.0120.04218.00
5.5.130.0130.02117.88
5.5.120.0080.02318.10
5.5.110.0100.04218.02
5.5.100.0100.04017.97
5.5.90.0070.03318.06
5.5.80.0030.02517.90
5.5.70.0050.04417.99
5.5.60.0080.03717.91
5.5.50.0060.04317.97
5.5.40.0090.01917.95
5.5.30.0050.02918.06
5.5.20.0030.03117.96
5.5.10.0090.03518.00
5.5.00.0000.03717.82
5.4.450.0080.04016.27
5.4.440.0050.04216.11
5.4.430.0050.02016.13
5.4.420.0100.03816.23
5.4.410.0070.03216.11
5.4.400.0120.03716.08
5.4.390.0060.03616.05
5.4.380.0050.04016.12
5.4.370.0050.04015.95
5.4.360.0030.02316.10
5.4.350.0070.04016.02
5.4.340.0080.04016.02
5.4.330.0040.00413.00
5.4.320.0070.04116.08
5.4.310.0120.03316.07
5.4.300.0050.03315.94
5.4.290.0060.02316.09
5.4.280.0080.04016.11
5.4.270.0030.02816.01
5.4.260.0060.02316.01
5.4.250.0020.02915.92
5.4.240.0040.02215.93
5.4.230.0070.03015.93
5.4.220.0020.04716.06
5.4.210.0070.02216.01
5.4.200.0030.04216.03
5.4.190.0100.02216.09
5.4.180.0020.02916.05
5.4.170.0050.03816.05
5.4.160.0090.02516.05
5.4.150.0080.02316.00
5.4.140.0060.03814.71
5.4.130.0030.02814.60
5.4.120.0070.04214.70
5.4.110.0000.02714.72
5.4.100.0110.02614.72
5.4.90.0070.03814.73
5.4.80.0070.03314.75
5.4.70.0070.03714.72
5.4.60.0080.02014.75
5.4.50.0070.03114.63
5.4.40.0080.03914.74
5.4.30.0050.02514.71
5.4.20.0030.04014.71
5.4.10.0090.01814.73
5.4.00.0030.02814.45
5.3.290.0070.07314.67
5.3.280.0070.04714.75
5.3.270.0030.07714.63
5.3.260.0070.07714.73
5.3.250.0000.07714.68
5.3.240.0130.07014.74
5.3.230.0100.07314.75
5.3.220.0100.07314.73
5.3.210.0130.06714.56
5.3.200.0030.06714.70
5.3.190.0070.08014.57
5.3.180.0000.04714.57
5.3.170.0070.06314.70
5.3.160.0070.04014.66
5.3.150.0070.04314.60
5.3.140.0100.07014.61
5.3.130.0070.07014.69
5.3.120.0030.05314.63
5.3.110.0030.06714.64
5.3.100.0130.07014.07
5.3.90.0030.06314.02
5.3.80.0100.06314.13
5.3.70.0130.05014.12
5.3.60.0100.05314.12
5.3.50.0030.07313.92
5.3.40.0070.03314.02
5.3.30.0100.05014.04
5.3.20.0070.07013.70
5.3.10.0000.07013.80
5.3.00.0070.07013.70
5.2.170.0030.05713.70
5.2.160.0070.05713.70
5.2.150.0100.04713.70
5.2.140.0000.04013.70
5.2.130.0030.06313.70
5.2.120.0070.04313.70
5.2.110.0000.06013.70
5.2.100.0030.03013.70
5.2.90.0030.04013.70
5.2.80.0100.05013.70
5.2.70.0030.05713.70
5.2.60.0070.06313.70
5.2.50.0070.04013.70
5.2.40.0070.05313.70
5.2.30.0030.04713.70
5.2.20.0070.05013.70
5.2.10.0030.06013.70
5.2.00.0000.06013.70
5.1.60.0030.05713.70
5.1.50.0030.04713.70
5.1.40.0000.04013.70
5.1.30.0000.03013.70
5.1.20.0030.05313.70
5.1.10.0000.06013.70
5.1.00.0000.03713.70
5.0.50.0100.03713.70
5.0.40.0030.04013.70
5.0.30.0070.06713.70
5.0.20.0070.04313.70
5.0.10.0100.03713.70
5.0.00.0100.06013.70
4.4.90.0100.03013.70
4.4.80.0030.02713.70
4.4.70.0070.03013.70
4.4.60.0030.03713.70
4.4.50.0000.02013.70
4.4.40.0030.03713.70
4.4.30.0000.02313.70
4.4.20.0030.02013.70
4.4.10.0000.01313.70
4.4.00.0000.03713.70
4.3.110.0030.03313.70
4.3.100.0000.01713.70
4.3.90.0000.02013.70
4.3.80.0070.04713.70
4.3.70.0000.03313.70
4.3.60.0030.01713.70
4.3.50.0000.02013.70
4.3.40.0000.04313.70
4.3.30.0000.03313.70
4.3.20.0000.02713.70
4.3.10.0030.01713.70
4.3.00.0030.02013.70

preferences:
45.02 ms | 400 KiB | 5 Q