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); } 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.50
8.3.50.0120.00322.04
8.3.40.0040.01118.76
8.3.30.0070.00719.01
8.3.20.0030.00620.34
8.3.10.0030.00523.53
8.3.00.0030.00620.55
8.2.180.0150.00018.41
8.2.170.0070.00722.96
8.2.160.0030.01020.35
8.2.150.0000.00824.18
8.2.140.0000.00824.66
8.2.130.0050.00326.16
8.2.120.0000.00721.96
8.2.110.0030.00620.39
8.2.100.0040.00817.91
8.2.90.0050.00319.17
8.2.80.0080.00017.97
8.2.70.0080.00017.72
8.2.60.0000.00917.90
8.2.50.0050.00318.07
8.2.40.0060.00319.95
8.2.30.0040.00418.16
8.2.20.0030.00517.71
8.2.10.0000.00718.10
8.2.00.0000.00817.65
8.1.280.0110.00325.92
8.1.270.0040.00423.81
8.1.260.0110.00726.35
8.1.250.0090.00028.09
8.1.240.0090.00023.77
8.1.230.0120.00023.98
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0080.00417.35
8.1.190.0000.01017.35
8.1.180.0060.00319.01
8.1.170.0060.00318.56
8.1.160.0040.00421.93
8.1.150.0070.00018.59
8.1.140.0040.00417.49
8.1.130.0040.00417.82
8.1.120.0070.00017.54
8.1.110.0040.00417.42
8.1.100.0040.00417.55
8.1.90.0030.00517.50
8.1.80.0040.00417.55
8.1.70.0030.00617.38
8.1.60.0050.00517.46
8.1.50.0040.00717.34
8.1.40.0070.00417.46
8.1.30.0050.00317.70
8.1.20.0040.00417.69
8.1.10.0070.00017.65
8.1.00.0000.00717.55
8.0.300.0080.00018.77
8.0.290.0040.00417.16
8.0.280.0050.00318.53
8.0.270.0070.00017.18
8.0.260.0040.00417.28
8.0.250.0080.00017.10
8.0.240.0030.00617.01
8.0.230.0030.00517.04
8.0.220.0000.00717.00
8.0.210.0040.00416.89
8.0.200.0070.00017.04
8.0.190.0070.00016.95
8.0.180.0000.00817.02
8.0.170.0000.00817.05
8.0.160.0040.00417.07
8.0.150.0030.00516.93
8.0.140.0000.00716.86
8.0.130.0060.00013.48
8.0.120.0000.00816.95
8.0.110.0020.00516.82
8.0.100.0050.00316.89
8.0.90.0040.00416.78
8.0.80.0120.00316.98
8.0.70.0080.00017.05
8.0.60.0000.00716.93
8.0.50.0050.00516.98
8.0.30.0110.00917.33
8.0.20.0130.00517.46
8.0.10.0000.00717.16
8.0.00.0100.00816.78
7.4.330.0000.00515.00
7.4.320.0000.00716.50
7.4.300.0040.00416.45
7.4.290.0040.00416.44
7.4.280.0090.00016.62
7.4.270.0050.00316.63
7.4.260.0000.00716.55
7.4.250.0000.00816.50
7.4.240.0050.00216.56
7.4.230.0000.00816.71
7.4.220.0120.01316.64
7.4.210.0060.01016.63
7.4.200.0070.00016.76
7.4.190.0040.00416.77
7.4.160.0040.01116.82
7.4.150.0100.00617.40
7.4.140.0040.01317.86
7.4.130.0100.00716.63
7.4.120.0140.00416.58
7.4.110.0100.00716.58
7.4.100.0120.00616.34
7.4.90.0090.00916.62
7.4.80.0120.00619.39
7.4.70.0070.01116.61
7.4.60.0120.00916.59
7.4.50.0000.00416.56
7.4.40.0060.01016.59
7.4.30.0140.01116.77
7.4.00.0050.01115.13
7.3.330.0000.00713.23
7.3.320.0060.00013.27
7.3.310.0030.00316.43
7.3.300.0000.00716.43
7.3.290.0060.01216.41
7.3.280.0090.01016.46
7.3.270.0130.00717.40
7.3.260.0090.00916.29
7.3.250.0110.01116.49
7.3.240.0060.01616.62
7.3.230.0070.01116.39
7.3.210.0130.00616.64
7.3.200.0070.01119.39
7.3.190.0070.01316.32
7.3.180.0100.01016.43
7.3.170.0030.01416.27
7.3.160.0140.01116.37
7.3.120.0090.00815.02
7.3.110.0070.01114.91
7.3.100.0080.00314.62
7.3.90.0120.00414.77
7.3.80.0030.00915.14
7.3.70.0000.01614.80
7.3.60.0040.00814.98
7.3.50.0090.00314.97
7.3.40.0130.00314.70
7.3.30.0070.01014.94
7.3.20.0060.01216.67
7.3.10.0080.00616.82
7.3.00.0020.01016.60
7.2.330.0100.00716.89
7.2.320.0110.00516.46
7.2.310.0070.01016.89
7.2.300.0100.01016.76
7.2.290.0160.00316.82
7.2.250.0040.01515.00
7.2.240.0100.01014.89
7.2.230.0070.00714.91
7.2.220.0090.00615.02
7.2.210.0070.00715.04
7.2.200.0120.00314.97
7.2.190.0070.00714.98
7.2.180.0060.00914.86
7.2.170.0090.00614.82
7.2.130.0000.01416.77
7.2.120.0020.01117.03
7.2.110.0060.00716.97
7.2.100.0050.00716.91
7.2.90.0070.00716.90
7.2.80.0050.00717.11
7.2.70.0060.00617.01
7.2.60.0050.00616.92
7.2.50.0050.00817.05
7.2.40.0030.00817.09
7.2.30.0060.00616.85
7.2.20.0040.00717.00
7.2.10.0090.00216.75
7.2.00.0040.00917.78
7.1.330.0030.01015.54
7.1.320.0000.01515.82
7.1.310.0040.00815.61
7.1.300.0070.00815.71
7.1.290.0040.01115.43
7.1.280.0140.00015.63
7.1.270.0070.00415.60
7.1.260.0030.01015.52
7.1.250.0050.00515.61
7.1.100.0190.00718.07
7.1.70.0000.00817.18
7.1.60.0070.01419.46
7.1.50.0180.00716.91
7.1.00.0030.07722.54
7.0.200.0000.00716.76
7.0.140.0030.07022.03
7.0.100.0130.06319.93
7.0.90.0330.07720.17
7.0.80.0130.04019.93
7.0.70.0070.07319.91
7.0.60.0070.08019.89
7.0.50.0230.06320.33
7.0.40.0130.08720.00
7.0.30.0070.08020.12
7.0.20.0070.08720.00
7.0.10.0170.08020.06
7.0.00.0070.07720.04
5.6.280.0000.07720.91
5.6.250.0030.06720.65
5.6.240.0100.08720.71
5.6.230.0100.08320.59
5.6.220.0100.07720.67
5.6.210.0070.07720.69
5.6.200.0070.09021.05
5.6.190.0070.09321.11
5.6.180.0130.05721.12
5.6.170.0130.07321.17
5.6.160.0070.08021.05
5.6.150.0170.07720.98
5.6.140.0030.08721.03
5.6.130.0100.07721.08
5.6.120.0170.07721.13
5.6.110.0100.08021.03
5.6.100.0070.08321.06
5.6.90.0130.04321.02
5.6.80.0100.04020.32
5.6.70.0000.08020.54
5.6.60.0100.07320.45
5.6.50.0030.09020.34
5.6.40.0100.05720.38
5.6.30.0070.08320.32
5.6.20.0070.05720.46
5.6.10.0100.07320.54
5.6.00.0000.05720.47
5.5.380.0100.04320.46
5.5.370.0170.07020.44
5.5.360.0030.05020.55
5.5.350.0070.05020.43
5.5.340.0170.04020.95
5.5.330.0170.05320.89
5.5.320.0130.07720.66
5.5.310.0130.03720.90
5.5.300.0070.08720.88
5.5.290.0070.05020.78
5.5.280.0170.07020.90
5.5.270.0030.05020.82
5.5.260.0070.07720.88
5.5.250.0070.05320.60
5.5.240.0100.06320.33
5.5.230.0100.08020.13
5.5.220.0170.05020.32
5.5.210.0100.07720.16
5.5.200.0170.06720.17
5.5.190.0130.07020.11
5.5.180.0100.07320.10
5.5.160.0100.08320.11
5.5.150.0070.03720.26
5.5.140.0130.07320.27
5.5.130.0170.03020.23
5.5.120.0200.05720.23
5.5.110.0200.06720.25
5.5.100.0130.07320.00
5.5.90.0070.04020.14
5.5.80.0130.07320.10
5.5.70.0030.06720.13
5.5.60.0030.08020.01
5.5.50.0100.07319.95
5.5.40.0100.07020.05
5.5.30.0170.06720.17
5.5.20.0200.04020.16
5.5.10.0100.04720.16
5.5.00.0070.03720.05
5.4.450.0070.04719.37
5.4.440.0070.07019.42
5.4.430.0070.07719.45
5.4.420.0030.05719.27
5.4.410.0130.06019.04
5.4.400.0030.07019.21
5.4.390.0070.03719.23
5.4.380.0070.07719.06
5.4.370.0070.07719.03
5.4.360.0070.06719.16
5.4.350.0030.08018.88
5.4.340.0070.04319.21
5.4.320.0070.05718.91
5.4.310.0100.04018.95
5.4.300.0130.06019.18
5.4.290.0130.06019.03
5.4.280.0100.07319.09
5.4.270.0100.06718.84
5.4.260.0070.04719.03
5.4.250.0100.06718.84
5.4.240.0130.05719.25
5.4.230.0130.06719.04
5.4.220.0070.07019.21
5.4.210.0130.06318.93
5.4.200.0000.08019.13
5.4.190.0070.06319.02
5.4.180.0070.04719.11
5.4.170.0030.06319.01
5.4.160.0030.06719.03
5.4.150.0000.04319.16
5.4.140.0070.05316.47
5.4.130.0070.05716.51
5.4.120.0100.05316.55
5.4.110.0070.03316.44
5.4.100.0030.03716.42
5.4.90.0030.03716.54
5.4.80.0070.05316.38
5.4.70.0100.05716.47
5.4.60.0070.05316.41
5.4.50.0070.07016.48
5.4.40.0130.07716.55
5.4.30.0100.06716.27
5.4.20.0030.07016.46
5.4.10.0070.03316.48
5.4.00.0130.05015.86
5.3.290.0030.06314.75
5.3.280.0100.04014.59
5.3.270.0000.04314.58
5.3.260.0070.07314.63
5.3.250.0100.04714.67
5.3.240.0070.05314.71
5.3.230.0230.03014.75
5.3.220.0070.04714.59
5.3.210.0000.04314.59
5.3.200.0070.04014.59
5.3.190.0070.03714.51
5.3.180.0100.04714.64
5.3.170.0130.06314.67
5.3.160.0070.07714.69
5.3.150.0130.06014.64
5.3.140.0130.07014.69
5.3.130.0030.04014.62
5.3.120.0130.04014.57
5.3.110.0070.06314.63
5.3.100.0100.03714.01
5.3.90.0030.04014.05
5.3.80.0100.03714.02
5.3.70.0000.04013.97
5.3.60.0130.05313.94
5.3.50.0130.04313.95
5.3.40.0030.03713.97
5.3.30.0070.05013.89
5.3.20.0170.05713.82
5.3.10.0030.03713.72
5.3.00.0030.05313.59
5.2.170.0000.03711.67
5.2.160.0070.03011.67
5.2.150.0030.06011.67
5.2.140.0070.06011.67
5.2.130.0070.03011.67
5.2.120.0100.02711.67
5.2.110.0000.04311.67
5.2.100.0070.05711.67
5.2.90.0100.06011.67
5.2.80.0000.05311.67
5.2.70.0000.04011.67
5.2.60.0030.05311.67
5.2.50.0000.05311.67
5.2.40.0000.03011.67
5.2.30.0100.05311.67
5.2.20.0000.02711.67
5.2.10.0030.02711.67
5.2.00.0000.04011.67
5.1.60.0030.02011.67
5.1.50.0070.05311.67
5.1.40.0000.04011.67
5.1.30.0070.05711.67
5.1.20.0030.04011.67
5.1.10.0030.04311.67
5.1.00.0030.04011.67
5.0.50.0000.05311.67
5.0.40.0000.04011.67
5.0.30.0000.04011.67
5.0.20.0000.04711.67
5.0.10.0000.02711.67
5.0.00.0000.04711.67
4.4.90.0030.02711.67
4.4.80.0070.02711.67
4.4.70.0000.01711.67
4.4.60.0000.01711.67
4.4.50.0030.01311.67
4.4.40.0000.05011.67
4.4.30.0000.01311.67
4.4.20.0030.03011.67
4.4.10.0000.02011.67
4.4.00.0070.04011.67
4.3.110.0000.02311.67
4.3.100.0030.01311.67
4.3.90.0030.02311.67
4.3.80.0070.03711.67
4.3.70.0070.02011.67
4.3.60.0030.02711.67
4.3.50.0000.03311.67
4.3.40.0000.03711.67
4.3.30.0070.03011.67
4.3.20.0000.02711.67
4.3.10.0030.03311.67
4.3.00.0030.02311.67

preferences:
40.87 ms | 401 KiB | 5 Q