3v4l.org

run code in 300+ PHP versions simultaneously
<?php function exceptionHandler($exception) { // these are our templates $traceline = "#%s %s(%s): %s(%s)"; $msg = "PHP Fatal error: Uncaught exception '%s' with message '%s' in %s:%s\nStack trace:\n%s\n thrown in %s on line %s"; // alter your trace as you please, here $trace = $exception->getTrace(); foreach ($trace as $key => $stackPoint) { // I'm converting arguments to their type // (prevents passwords from ever getting logged as anything other than 'string') $trace[$key]['args'] = array_map('gettype', $trace[$key]['args']); } // build your tracelines $result = array(); foreach ($trace as $key => $stackPoint) { $result[] = sprintf( $traceline, $key, $stackPoint['file'], $stackPoint['line'], $stackPoint['function'], implode(', ', $stackPoint['args']) ); } // trace always ends with {main} $result[] = '#' . ++$key . ' {main}'; // write tracelines into main template $msg = sprintf( $msg, get_class($exception), $exception->getMessage(), $exception->getFile(), $exception->getLine(), implode("\n", $result), $exception->getFile(), $exception->getLine() ); // log or echo as you please print $msg; } set_exception_handler("exceptionHandler"); a("1"); function a($i) { throw new Exception("Just invoking the exception handler"); }

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.0100.01016.88
8.3.50.0100.00822.11
8.3.40.0150.00319.14
8.3.30.0070.00719.02
8.3.20.0070.00020.35
8.3.10.0110.00723.32
8.3.00.0080.00020.64
8.2.180.0060.00916.50
8.2.170.0150.00322.96
8.2.160.0070.01322.21
8.2.150.0060.00324.18
8.2.140.0050.00324.66
8.2.130.0070.00026.16
8.2.120.0040.00420.36
8.2.110.0030.00721.03
8.2.100.0080.00418.03
8.2.90.0030.00519.25
8.2.80.0000.00818.05
8.2.70.0040.00417.75
8.2.60.0050.00317.68
8.2.50.0080.00018.07
8.2.40.0000.00718.22
8.2.30.0000.00718.17
8.2.20.0040.00417.80
8.2.10.0000.00817.89
8.2.00.0070.00017.89
8.1.280.0110.00425.92
8.1.270.0080.00022.09
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0060.00319.09
8.1.230.0110.00020.84
8.1.220.0050.00317.74
8.1.210.0040.00418.77
8.1.200.0030.00617.35
8.1.190.0040.00417.54
8.1.180.0060.00318.10
8.1.170.0000.00818.59
8.1.160.0070.00021.96
8.1.150.0000.00718.71
8.1.140.0040.00417.49
8.1.130.0000.00717.92
8.1.120.0000.00717.55
8.1.110.0000.00717.47
8.1.100.0040.00417.38
8.1.90.0000.00817.55
8.1.80.0000.00717.48
8.1.70.0040.00417.36
8.1.60.0040.00417.61
8.1.50.0050.00317.40
8.1.40.0000.00817.47
8.1.30.0050.00317.63
8.1.20.0080.00017.67
8.1.10.0040.00417.61
8.1.00.0040.00417.51
8.0.300.0000.00818.77
8.0.290.0000.00717.18
8.0.280.0030.00318.52
8.0.270.0070.00017.28
8.0.260.0000.00716.91
8.0.250.0030.00316.94
8.0.240.0030.00316.92
8.0.230.0040.00416.93
8.0.220.0070.00017.06
8.0.210.0030.00317.00
8.0.200.0060.00017.03
8.0.190.0060.00316.93
8.0.180.0060.00617.02
8.0.170.0000.00717.03
8.0.160.0040.00416.86
8.0.150.0070.00016.85
8.0.140.0050.00316.96
8.0.130.0030.00313.37
8.0.120.0050.00316.85
8.0.110.0040.00416.88
8.0.100.0050.00316.88
8.0.90.0040.00416.97
8.0.80.0110.00416.92
8.0.70.0040.00416.85
8.0.60.0000.00717.05
8.0.50.0040.00416.89
8.0.30.0130.00817.16
8.0.20.0070.01217.40
8.0.10.0000.00717.12
8.0.00.0070.01216.94
7.4.330.0050.00015.09
7.4.320.0000.00616.54
7.4.300.0030.00316.66
7.4.290.0030.00316.46
7.4.280.0070.00416.42
7.4.270.0000.00716.68
7.4.260.0000.00716.45
7.4.250.0040.00416.59
7.4.240.0040.00416.55
7.4.230.0050.00516.63
7.4.220.0120.01216.57
7.4.210.0100.00616.54
7.4.200.0030.00316.55
7.4.190.0030.00316.52
7.4.160.0070.00716.39
7.4.150.0070.01017.40
7.4.140.0100.00817.86
7.4.130.0080.01416.55
7.4.120.0090.00816.52
7.4.110.0110.00616.60
7.4.100.0140.00716.49
7.4.90.0070.01516.61
7.4.80.0110.00716.59
7.4.70.0130.00316.57
7.4.60.0150.00316.59
7.4.50.0090.00016.37
7.4.40.0070.01122.77
7.4.30.0150.00316.66
7.4.00.0140.00014.78
7.3.330.0060.00013.45
7.3.320.0000.00513.41
7.3.310.0000.00716.55
7.3.300.0000.00716.41
7.3.290.0060.01216.43
7.3.280.0100.00716.45
7.3.270.0090.00917.40
7.3.260.0100.01416.50
7.3.250.0080.01116.48
7.3.240.0060.00916.37
7.3.230.0090.00916.51
7.3.210.0070.01016.32
7.3.200.0110.00719.39
7.3.190.0030.01316.67
7.3.180.0120.00316.47
7.3.170.0070.01116.62
7.3.160.0090.00616.46
7.3.120.0000.00714.92
7.2.330.0080.00916.88
7.2.320.0070.01016.45
7.2.310.0130.00316.85
7.2.300.0090.00616.71
7.2.290.0060.00916.52
7.2.00.0060.00319.49
7.1.100.0060.00318.27
7.1.70.0000.00717.25
7.1.60.0070.01619.27
7.1.50.0090.01316.99
7.1.00.0030.07722.40
7.0.200.0060.01016.55
7.0.140.0030.07322.08
7.0.60.0370.07319.80
7.0.50.0070.04017.87
7.0.40.0100.08020.11
7.0.30.0230.07020.30
7.0.20.0170.08720.25
7.0.10.0100.03720.17
7.0.00.0170.04720.19
5.6.280.0000.07720.87
5.6.210.0070.08020.68
5.6.200.0070.08318.19
5.6.190.0100.05720.50
5.6.180.0270.07020.55
5.6.170.0270.04320.55
5.6.160.0230.03320.46
5.6.150.0100.06018.19
5.6.140.0070.04318.24
5.6.130.0100.05318.17
5.6.120.0000.08721.13
5.6.110.0000.04321.05
5.6.100.0070.06021.00
5.6.90.0130.08021.02
5.6.80.0100.03320.39
5.5.350.0100.04020.40
5.5.340.0200.04017.96
5.5.330.0130.08020.33
5.5.320.0670.06320.36
5.5.310.0230.08020.27
5.5.300.0070.04017.95
5.5.290.0130.07717.95
5.5.280.0200.03320.90
5.5.270.0070.08020.67
5.5.260.0030.04320.77
5.5.250.0100.08320.59
5.5.240.0000.06720.25
5.4.450.0200.03719.39
5.4.440.0270.03719.29
5.4.430.0370.07319.25
5.4.420.0300.05319.25
5.4.410.0330.07019.34
5.4.400.0400.03019.15
5.4.390.0330.04319.14
5.4.380.0400.05019.16
5.4.370.0400.05719.14
5.4.360.0470.05719.05
5.4.350.0430.03718.93
5.4.340.0330.03319.19
5.4.320.0330.03718.95
5.4.310.0370.05719.13
5.4.300.0230.04319.00
5.4.290.0300.03719.16
5.4.280.0330.07019.10
5.4.270.0300.08019.14
5.4.260.0330.05719.10
5.4.250.0230.04319.14
5.4.240.0370.07018.96
5.4.230.0470.06019.15
5.4.220.0330.07019.16
5.4.210.0230.07319.22
5.4.200.0400.07019.21
5.4.190.0330.04019.04
5.4.180.0470.06019.05
5.4.170.0400.06719.17
5.4.160.0330.06018.91
5.4.150.0430.06719.09
5.4.140.0300.03716.49
5.4.130.0330.06316.36
5.4.120.0230.04316.52
5.4.110.0430.06016.61
5.4.100.0170.04016.54
5.4.90.0230.03316.57
5.4.80.0370.03016.56
5.4.70.0200.03316.48
5.4.60.0230.03716.21
5.4.50.0270.03016.43
5.4.40.0200.04016.45
5.4.30.0230.03716.49
5.4.20.0200.03716.39
5.4.10.0270.03316.43
5.4.00.0370.05315.89
5.3.290.0430.06014.75
5.3.280.0400.05314.69
5.3.270.0230.04314.52
5.3.260.0300.04714.77
5.3.250.0230.04314.70
5.3.240.0270.05014.69
5.3.230.0430.06014.50
5.3.220.0300.07314.62
5.3.210.0300.06714.63
5.3.200.0370.06014.50
5.3.190.0400.03014.58
5.3.180.0170.04014.63
5.3.170.0230.03714.64
5.3.160.0170.04014.65
5.3.150.0200.03714.61
5.3.140.0230.03714.59
5.3.130.0230.03714.59
5.3.120.0300.04014.57
5.3.110.0270.04014.45
5.3.100.0300.04014.22
5.3.90.0270.03314.11
5.3.80.0200.03314.05
5.3.70.0270.02714.18
5.3.60.0200.04014.02
5.3.50.0230.03714.02
5.3.40.0270.03314.02
5.3.30.0270.03314.09
5.3.20.0200.03713.76
5.3.10.0170.04713.71
5.3.00.0170.04713.66
5.2.170.0230.02711.32
5.2.160.0130.03011.16
5.2.150.0230.02311.09
5.2.140.0200.03011.11
5.2.130.0170.03011.08
5.2.120.0170.03011.04
5.2.110.0130.03011.13
5.2.100.0170.03011.07
5.2.90.0170.03311.14
5.2.80.0200.03011.09
5.2.70.0200.03011.10
5.2.60.0230.02711.12
5.2.50.0200.02711.05
5.2.40.0170.02311.02
5.2.30.0170.02711.15
5.2.20.0230.05310.97
5.2.10.0130.04310.93
5.2.00.0100.03310.74
5.1.60.0170.02310.00
5.1.50.0170.0239.92
5.1.40.0230.0439.97
5.1.30.0270.04710.35
5.1.20.0300.04310.38
5.1.10.0300.04310.15
5.1.00.0130.06010.14
5.0.50.0170.0438.92
5.0.40.0200.0278.92
5.0.30.0170.0478.92
5.0.20.0130.0308.92
5.0.10.0100.0238.92
5.0.00.0100.0408.92
4.4.90.0100.0138.92
4.4.80.0030.0138.92
4.4.70.0070.0178.92
4.4.60.0100.0138.92
4.4.50.0070.0178.92
4.4.40.0070.0238.92
4.4.30.0070.0178.92
4.4.20.0100.0378.92
4.4.10.0130.0278.92
4.4.00.0100.0578.92
4.3.110.0130.0338.92
4.3.100.0130.0308.92
4.3.90.0130.0238.92
4.3.80.0100.0238.92
4.3.70.0100.0378.92
4.3.60.0130.0208.92
4.3.50.0100.0238.92
4.3.40.0130.0438.92
4.3.30.0070.0338.92
4.3.20.0070.0378.92
4.3.10.0070.0378.92
4.3.00.0000.0278.92

preferences:
42 ms | 401 KiB | 5 Q