3v4l.org

run code in 300+ PHP versions simultaneously
<?php try { if (!function_exists('handleException')) { /** * @param \Exception $e * @return string readable message */ function logException(\Exception $e) { $type = get_class($e); $msg = $e->getMessage(); $trace = $e->getTraceAsString(); global $logger; if (isset($logger)) { $logger->error(sprintf("%s: %s\n%s", $type, $msg, $trace)); if (method_exists($logger, 'newrelicLog')) { $logger->newrelicLog($e); } } return sprintf("<h1>%s</h1><pre>%s<br/><h2>Debug Trace:</h2>%s</pre>", $type, $msg, $trace); } function handleException(\Exception $e) { $message = logException($e); if (!headers_sent()) { header('HTTP/1.1 500 Internal Server Error'); } $foo = APPLICATION_PATH; exit(); } } if (!isset($shutdownFunction)) { $shutdownFunction = function () { try { $error = error_get_last(); if (isset($error)) { throw new \Exception( $error['message'] . ' in ' . $error['file'] . ' at line ' . $error['line'], $error['type'] ); } } catch (Exception $e) { handleException($e); } }; register_shutdown_function($shutdownFunction); } if (!isset($errorHandler)) { $errorHandler = function ($errno, $errstr, $errfile = null, $errline = null, $errcontext = []) { // prevent exception to be thrown when error_reporting is turned off or suppressed with @ if (error_reporting() !== 0) { throw new \Exception("$errstr in $errfile at line $errline", $errno); } else { echo "log $errstr in $errfile at line $errline"; } }; set_error_handler($errorHandler); } throw new \Exception('after first'); define('APPLICATION_PATH', 'foo'); if (!function_exists('handleException')) { /** * @param \Exception $e * @return string readable message */ function logException(\Exception $e) { $type = get_class($e); $msg = $e->getMessage(); $trace = $e->getTraceAsString(); global $logger; if (isset($logger)) { $logger->error(sprintf("%s: %s\n%s", $type, $msg, $trace)); if (method_exists($logger, 'newrelicLog')) { $logger->newrelicLog($e); } } return sprintf("<h1>%s</h1><pre>%s<br/><h2>Debug Trace:</h2>%s</pre>", $type, $msg, $trace); } function handleException(\Exception $e) { $message = logException($e); if (!headers_sent()) { header('HTTP/1.1 500 Internal Server Error'); } $foo = APPLICATION_PATH; exit(); } } if (!isset($shutdownFunction)) { $shutdownFunction = function () { try { $error = error_get_last(); if (isset($error)) { throw new \Exception( $error['message'] . ' in ' . $error['file'] . ' at line ' . $error['line'], $error['type'] ); } } catch (Exception $e) { handleException($e); } }; register_shutdown_function($shutdownFunction); } if (!isset($errorHandler)) { $errorHandler = function ($errno, $errstr, $errfile = null, $errline = null, $errcontext = []) { // prevent exception to be thrown when error_reporting is turned off or suppressed with @ if (error_reporting() !== 0) { throw new \Exception("$errstr in $errfile at line $errline", $errno); } else { echo "log $errstr in $errfile at line $errline"; } }; set_error_handler($errorHandler); } throw new \Exception('after both'); } catch (\Exception $e) { handleException($e); }

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.00716.88
8.3.50.0080.00922.04
8.3.40.0100.00718.69
8.3.30.0100.00319.09
8.3.20.0030.00620.39
8.3.10.0040.00423.65
8.3.00.0000.00820.96
8.2.180.0120.00318.41
8.2.170.0070.00722.96
8.2.160.0080.00620.18
8.2.150.0030.00624.18
8.2.140.0100.00624.66
8.2.130.0040.00426.16
8.2.120.0040.00422.27
8.2.110.0060.00322.30
8.2.100.0120.00019.64
8.2.90.0030.00519.17
8.2.80.0040.00417.97
8.2.70.0060.00317.50
8.2.60.0000.00917.80
8.2.50.0050.00318.07
8.2.40.0030.00519.94
8.2.30.0050.00218.36
8.2.20.0040.00417.90
8.2.10.0040.00418.07
8.2.00.0060.00517.84
8.1.280.0150.00325.92
8.1.270.0080.00023.97
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0030.00623.75
8.1.230.0090.00319.08
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0030.00717.48
8.1.190.0030.00617.22
8.1.180.0030.00619.14
8.1.170.0080.00018.46
8.1.160.0040.00422.09
8.1.150.0040.00418.59
8.1.140.0030.00617.47
8.1.130.0000.00717.91
8.1.120.0070.00017.55
8.1.110.0040.00417.42
8.1.100.0000.00717.45
8.1.90.0040.00417.56
8.1.80.0000.00817.40
8.1.70.0040.00417.46
8.1.60.0090.00017.57
8.1.50.0040.00717.46
8.1.40.0100.00017.55
8.1.30.0050.00317.71
8.1.20.0040.00417.79
8.1.10.0040.00417.59
8.1.00.0080.00017.47
8.0.300.0040.00418.77
8.0.290.0060.00317.30
8.0.280.0000.00818.54
8.0.270.0030.00317.28
8.0.260.0030.00317.37
8.0.250.0000.00817.02
8.0.240.0070.00417.06
8.0.230.0040.00417.01
8.0.220.0030.00316.98
8.0.210.0000.00716.98
8.0.200.0000.00717.03
8.0.190.0080.00017.11
8.0.180.0020.00517.07
8.0.170.0080.00017.06
8.0.160.0070.00017.03
8.0.150.0050.00216.95
8.0.140.0070.00016.98
8.0.130.0030.00313.53
8.0.120.0080.00017.09
8.0.110.0000.00816.93
8.0.100.0060.00316.87
8.0.90.0000.00717.00
8.0.80.0100.00717.04
8.0.70.0080.00016.86
8.0.60.0040.00417.09
8.0.50.0030.00617.11
8.0.30.0110.01017.06
8.0.20.0090.01117.40
8.0.10.0040.00417.05
8.0.00.0050.01216.79
7.4.330.0030.00315.00
7.4.320.0000.00716.57
7.4.300.0030.00316.68
7.4.290.0070.00016.66
7.4.280.0070.00016.68
7.4.270.0020.00516.47
7.4.260.0000.00716.63
7.4.250.0000.00816.67
7.4.240.0000.00716.52
7.4.230.0030.00316.55
7.4.220.0070.01116.60
7.4.210.0070.00816.67
7.4.200.0070.00016.41
7.4.190.0000.00816.43
7.4.160.0030.01316.82
7.4.150.0150.00317.40
7.4.140.0080.00817.86
7.4.130.0110.00816.73
7.4.120.0050.01316.58
7.4.110.0140.00716.59
7.4.100.0070.01716.77
7.4.90.0130.00516.57
7.4.80.0060.01519.39
7.4.70.0060.01716.63
7.4.60.0030.01316.55
7.4.50.0020.00216.68
7.4.40.0110.01116.65
7.4.30.0150.00316.46
7.4.00.0070.01115.09
7.3.330.0000.00613.50
7.3.320.0000.00513.35
7.3.310.0000.00716.49
7.3.300.0040.00416.36
7.3.290.0130.00516.55
7.3.280.0110.00716.52
7.3.270.0030.01417.40
7.3.260.0120.00616.47
7.3.250.0060.01516.66
7.3.240.0130.00516.54
7.3.230.0140.00416.62
7.3.210.0070.01016.57
7.3.200.0040.01419.39
7.3.190.0090.00916.49
7.3.180.0130.00716.53
7.3.170.0110.00516.66
7.3.160.0080.00816.63
7.3.120.0030.01315.13
7.3.110.0030.01014.89
7.3.100.0060.00314.72
7.3.90.0100.00614.75
7.3.80.0040.01114.95
7.3.70.0080.00814.94
7.3.60.0110.00914.96
7.3.50.0040.01914.59
7.3.40.0080.01114.85
7.3.30.0090.00614.85
7.3.20.0090.00616.77
7.3.10.0120.00616.59
7.3.00.0060.00916.82
7.2.330.0090.00916.89
7.2.320.0140.00416.76
7.2.310.0070.01816.84
7.2.300.0090.01016.66
7.2.290.0100.00716.93
7.2.240.0060.00615.21
7.2.230.0040.01415.03
7.2.220.0040.01115.26
7.2.210.0060.00914.76
7.2.200.0070.00415.25
7.2.190.0120.00914.75
7.2.180.0140.00815.03
7.2.170.0030.01514.95
7.2.160.0000.01514.88
7.2.150.0110.00717.07
7.2.140.0100.00716.91
7.2.130.0030.01017.09
7.2.120.0070.00716.94
7.2.110.0110.00716.93
7.2.100.0060.00617.01
7.2.90.0130.00316.80
7.2.80.0030.01016.74
7.2.70.0000.01817.02
7.2.60.0080.00816.98
7.2.50.0110.00716.65
7.2.40.0100.00316.94
7.2.30.0080.00816.95
7.2.20.0070.01116.99
7.2.10.0070.01017.00
7.2.00.0080.00718.23
7.1.330.0040.01115.82
7.1.320.0080.00415.74
7.1.310.0060.01015.91
7.1.300.0110.01115.87
7.1.290.0060.01315.96
7.1.280.0040.01215.79
7.1.270.0090.00615.81
7.1.260.0040.01215.94
7.1.250.0000.01715.58
7.1.200.0080.00815.85
7.1.100.0420.00411.50
7.1.70.0090.00617.01
7.1.60.0070.01019.46
7.1.50.0140.01016.84
7.1.00.0000.08022.48
7.0.200.0000.01116.78
7.0.140.0070.07021.93
7.0.60.0000.08320.05
7.0.50.0070.07717.89
7.0.40.0100.08320.38
7.0.30.0270.07320.11
7.0.20.0230.06020.34
7.0.10.0030.06320.10
7.0.00.0170.06320.20
5.6.280.0070.07021.04
5.6.210.0070.06320.74
5.6.200.0030.08318.17
5.6.190.0030.04320.64
5.6.180.0570.06320.61
5.6.170.0270.03020.47
5.6.160.0200.03720.54
5.6.150.0030.04718.18
5.6.140.0030.04018.19
5.6.130.0100.08018.27
5.6.120.0230.05321.06
5.6.110.0130.06021.04
5.6.100.0270.06721.16
5.6.90.0100.04320.93
5.6.80.0100.07320.40
5.5.350.4300.04020.34
5.5.340.0200.05717.94
5.5.330.0070.08020.37
5.5.320.0070.05320.31
5.5.310.0300.07720.51
5.5.300.0070.03717.94
5.5.290.0030.06018.03
5.5.280.0130.07721.02
5.5.270.0070.08720.81
5.5.260.0030.08720.70
5.5.250.0100.06720.71
5.5.240.0300.07320.10
5.4.450.0230.04019.50
5.4.440.0200.05019.41
5.4.430.0330.07319.55
5.4.420.0330.03319.64
5.4.410.0300.04019.14
5.4.400.0300.07019.21
5.4.390.0170.04318.87
5.4.380.0300.04019.17
5.4.370.0270.04318.86
5.4.360.0300.06719.09
5.4.350.0270.07719.08
5.4.340.0300.04319.32
5.4.320.0330.05319.16
5.4.310.0370.07019.11
5.4.300.0270.04719.22
5.4.290.0300.07019.20
5.4.280.0400.05319.00
5.4.270.0400.05719.22
5.4.260.0300.06319.22
5.4.250.0370.06319.19
5.4.240.0300.05719.01
5.4.230.0270.07019.22
5.4.220.0400.06019.31
5.4.210.0400.06019.14
5.4.200.0170.04318.87
5.4.190.0230.07319.23
5.4.180.0200.06019.23
5.4.170.0330.07019.23
5.4.160.0270.04018.96
5.4.150.0230.04019.07
5.4.140.0330.06716.34
5.4.130.0330.05716.55
5.4.120.0270.06016.39
5.4.110.0300.06316.56
5.4.100.0270.04016.31
5.4.90.0330.04016.45
5.4.80.0230.07316.59
5.4.70.0270.04316.59
5.4.60.0230.07316.49
5.4.50.0400.05016.61
5.4.40.0200.08316.53
5.4.30.0430.03016.39
5.4.20.0300.07016.53
5.4.10.0300.05016.59
5.4.00.0330.05715.82
5.3.290.0270.05314.76
5.3.280.0270.05714.72
5.3.270.0270.07714.61
5.3.260.0200.04714.77
5.3.250.0270.03314.66
5.3.240.0400.06314.84
5.3.230.0270.06314.69
5.3.220.0200.07014.55
5.3.210.0370.03714.49
5.3.200.0270.04014.51
5.3.190.0330.07014.63
5.3.180.0370.03714.64
5.3.170.0300.04314.70
5.3.160.0270.04714.58
5.3.150.0230.04714.75
5.3.140.0300.04314.65
5.3.130.0300.07314.47
5.3.120.0300.05014.49
5.3.110.0300.05714.47
5.3.100.0330.06713.97
5.3.90.0270.06714.05
5.3.80.0300.05013.95
5.3.70.0330.06713.95
5.3.60.0270.05714.14
5.3.50.0270.05314.02
5.3.40.0300.06714.08
5.3.30.0430.05314.08
5.3.20.0270.05013.64
5.3.10.0330.06013.58
5.3.00.0270.07013.57
5.2.170.0270.04712.22
5.2.160.0300.05312.22
5.2.150.0300.05012.22
5.2.140.0200.06312.22
5.2.130.0300.04012.22
5.2.120.0300.05012.22
5.2.110.0270.05312.22
5.2.100.0230.03712.22
5.2.90.0230.05712.22
5.2.80.0230.05712.22
5.2.70.0270.05712.22
5.2.60.0230.05712.22
5.2.50.0300.04312.22
5.2.40.0270.04012.22
5.2.30.0230.05712.22
5.2.20.0230.05712.22
5.2.10.0230.04012.22
5.2.00.0170.03712.22
5.1.60.0200.02712.22
5.1.50.0200.05312.22
5.1.40.0230.04012.22
5.1.30.0170.03312.22
5.1.20.0330.04312.22
5.1.10.0130.04312.22
5.1.00.0230.04712.22
5.0.50.0130.03712.22
5.0.40.0130.02312.22
5.0.30.0100.06712.22
5.0.20.0130.04012.22
5.0.10.0170.04012.22
5.0.00.0070.05012.22
4.4.90.0100.03712.22
4.4.80.0130.02712.22
4.4.70.0100.02012.22
4.4.60.0070.02012.22
4.4.50.0130.02312.22
4.4.40.0100.03012.22
4.4.30.0100.03712.22
4.4.20.0100.02312.22
4.4.10.0070.02712.22
4.4.00.0070.02712.22
4.3.110.0170.02312.22
4.3.100.0130.03012.22
4.3.90.0100.02712.22
4.3.80.0100.05312.22
4.3.70.0070.03712.22
4.3.60.0130.02312.25
4.3.50.0070.03012.25
4.3.40.0130.03312.25
4.3.30.0030.03712.25
4.3.20.0030.03712.25
4.3.10.0030.02312.25
4.3.00.0070.03312.25

preferences:
46.55 ms | 401 KiB | 5 Q