3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (!function_exists('interface_exists')) { die('PHP version too old'); } $throwables = listThrowableClasses(); $throwablesPerParent = splitInParents($throwables); printTree($throwablesPerParent); if (count($throwablesPerParent) !== 0) { die('ERROR!!!'); } function listThrowableClasses() { $result = []; $throwableExists = interface_exists('Throwable'); if ($throwableExists) { foreach (get_declared_classes() as $cn) { $implements = class_implements($cn); if (isset($implements['Throwable'])) { $result[] = $cn; } } } if (!$throwableExists || empty($result)) { foreach (get_declared_classes() as $cn) { if ($cn === 'Exception' || is_subclass_of($cn, 'Exception')) { $result[] = $cn; } } } return $result; } function splitInParents($classes) { $result = []; foreach ($classes as $cn) { $parent = (string) get_parent_class($cn); if (isset($result[$parent])) { $result[$parent][] = $cn; } else { $result[$parent] = [$cn]; } } return $result; } function printTree(&$tree) { if (!isset($tree[''])) { die('No root classes!!!'); } printLeaves($tree, '', 0); } function printLeaves(&$tree, $parent, $level) { if (isset($tree[$parent])) { $leaves = $tree[$parent]; unset($tree[$parent]); natcasesort($leaves); $leaves = array_values($leaves); $count = count($leaves); for ($i = 0; $i < $count; ++$i) { $leaf = $leaves[$i]; echo str_repeat(' ', $level), $leaf, "\n"; printLeaves($tree, $leaf, $level + 1); } } }

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.0090.00618.35
8.3.50.0070.01217.45
8.3.40.0090.00618.84
8.3.30.0120.00318.72
8.3.20.0080.00021.69
8.3.10.0070.00723.08
8.3.00.0100.00723.37
8.2.180.0140.00716.50
8.2.170.0000.01422.96
8.2.160.0040.01122.30
8.2.150.0050.00324.18
8.2.140.0150.00324.66
8.2.130.0110.00325.41
8.2.120.0050.00822.77
8.2.110.0110.00322.83
8.2.100.0090.00720.38
8.2.90.0110.00520.38
8.2.80.0080.00820.82
8.2.70.0070.00820.24
8.2.60.0090.00720.34
8.2.50.0110.00320.39
8.2.40.0110.00320.11
8.2.30.0100.00919.72
8.2.20.0130.00319.41
8.2.10.0060.00819.68
8.2.00.0100.00519.23
8.1.280.0110.00425.92
8.1.270.0070.00222.45
8.1.260.0070.00225.51
8.1.250.0020.00626.38
8.1.240.0100.00521.89
8.1.230.0140.00121.38
8.1.220.0090.00320.28
8.1.210.0120.00320.65
8.1.200.0070.00520.24
8.1.190.0060.00620.15
8.1.180.0110.00220.40
8.1.170.0100.00319.98
8.1.160.0110.00419.92
8.1.150.0080.00719.74
8.1.140.0080.00819.43
8.1.130.0080.00619.01
8.1.120.0100.00519.29
8.1.110.0110.00319.28
8.1.100.0090.00619.00
8.1.90.0080.00619.00
8.1.80.0090.00519.02
8.1.70.0100.00619.03
8.1.60.0110.00519.09
8.1.50.0100.00519.07
8.1.40.0110.00419.06
8.1.30.0090.00519.11
8.1.20.0100.00518.93
8.1.10.0100.00518.87
8.1.00.0100.00518.71
8.0.300.0070.00621.04
8.0.290.0110.00319.99
8.0.280.0120.00519.80
8.0.270.0110.00518.88
8.0.260.0070.00618.65
8.0.250.0080.00518.68
8.0.240.0080.00518.66
8.0.230.0110.00318.71
8.0.220.0100.00418.63
8.0.210.0080.00718.61
8.0.200.0080.00618.71
8.0.190.0070.00618.69
8.0.180.0080.00518.69
8.0.170.0080.00518.65
8.0.160.0070.00518.67
8.0.150.0090.00518.43
8.0.140.0090.00518.45
8.0.130.0120.00417.88
8.0.120.0100.00518.24
8.0.110.0060.00718.24
8.0.100.0080.00518.22
8.0.90.0080.00518.14
8.0.80.0110.00417.98
8.0.70.0080.00518.14
8.0.60.0080.00518.11
8.0.50.0110.00418.25
8.0.30.0110.00418.02
8.0.20.0110.00418.16
8.0.10.0090.00418.33
8.0.00.0120.00617.87
7.4.330.0110.00517.94
7.4.320.0130.00718.47
7.4.300.0150.00518.48
7.4.290.0170.00318.47
7.4.280.0160.00318.48
7.4.270.0100.00618.20
7.4.260.0110.00418.03
7.4.250.0130.00318.07
7.4.240.0110.00518.03
7.4.230.0090.00617.57
7.4.220.0110.00417.92
7.4.210.0120.00617.70
7.4.200.0120.00618.04
7.4.190.0120.00618.08
7.4.180.0100.00718.08
7.4.160.0130.00517.62
7.4.150.0130.00518.00
7.4.140.0120.00417.97
7.4.130.0140.00517.71
7.4.120.0110.00817.64
7.4.110.0150.00517.67
7.4.100.0150.00517.63
7.4.90.0120.00717.59
7.4.80.0150.00417.84
7.4.70.0140.00617.62
7.4.60.0140.00517.66
7.4.50.0120.00617.61
7.4.40.0120.00617.63
7.4.30.0150.00517.62
7.4.20.0150.00617.61
7.4.10.0150.00617.55
7.4.00.0120.00517.15
7.3.330.0140.00517.61
7.3.320.0120.00617.54
7.3.310.0150.00317.85
7.3.300.0150.00517.92
7.3.290.0130.00517.79
7.3.280.0120.00517.43
7.3.270.0150.00317.88
7.3.260.0150.00517.93
7.3.250.0140.00617.78
7.3.240.0130.00717.41
7.3.230.0140.00717.54
7.3.220.0150.00617.67
7.3.210.0150.00617.60
7.3.200.0170.00517.54
7.3.190.0170.00617.56
7.3.180.0140.00617.52
7.3.170.0140.00717.58
7.3.160.0170.00417.50
7.3.150.0160.00717.53
7.3.140.0160.00617.55
7.3.130.0140.00817.43
7.3.120.0150.00617.12
7.3.110.0150.00617.13
7.3.100.0130.00816.99
7.3.90.0140.00617.07
7.3.80.0160.00516.89
7.3.70.0150.00616.88
7.3.60.0130.00716.95
7.3.50.0130.00616.91
7.3.40.0140.00616.71
7.3.30.0120.00716.72
7.3.20.0140.00617.34
7.3.10.0150.00617.33
7.3.00.0150.00717.38
7.2.340.0140.00617.74
7.2.330.0140.00717.67
7.2.320.0140.00817.63
7.2.310.0140.00717.62
7.2.300.0150.00617.67
7.2.290.0160.00717.65
7.2.280.0140.00817.65
7.2.270.0150.00717.63
7.2.260.0150.00617.54
7.2.250.0120.00917.42
7.2.240.0140.00717.27
7.2.230.0120.00917.12
7.2.220.0140.00717.13
7.2.210.0120.00816.98
7.2.200.0120.00817.06
7.2.190.0120.00717.07
7.2.180.0120.00817.04
7.2.170.0130.00616.87
7.2.160.0130.00816.86
7.2.150.0190.00717.53
7.2.140.0150.00717.49
7.2.130.0140.00917.54
7.2.120.0150.00717.54
7.2.110.0160.00717.51
7.2.100.0130.00817.50
7.2.90.0140.00917.55
7.2.80.0140.00817.53
7.2.70.0150.00717.57
7.2.60.0140.00817.50
7.2.50.0120.00917.55
7.2.40.0150.00817.54
7.2.30.0190.00717.59
7.2.20.0190.00817.47
7.2.10.0140.00717.58
7.2.00.0130.00917.57
7.1.330.0130.00717.16
7.1.320.0130.00616.96
7.1.310.0130.00716.83
7.1.300.0150.00616.79
7.1.290.0130.00816.80
7.1.280.0140.00716.69
7.1.270.0120.00816.71
7.1.260.0140.00716.68
7.1.250.0140.00616.66
7.1.240.0150.00617.19
7.1.230.0160.00517.24
7.1.220.0160.00617.18
7.1.210.0150.00717.24
7.1.200.0150.00617.22
7.1.190.0170.00517.25
7.1.180.0120.00817.19
7.1.170.0140.00717.17
7.1.160.0140.00617.20
7.1.150.0140.00617.17
7.1.140.0160.00617.18
7.1.130.0140.00817.21
7.1.120.0160.00717.18
7.1.110.0130.00817.20
7.1.100.0140.00717.19
7.1.90.0150.00717.21
7.1.80.0150.00617.22
7.1.70.0140.00617.12
7.1.60.0130.00817.31
7.1.50.0160.00617.36
7.1.40.0140.00617.30
7.1.30.0170.00417.30
7.1.20.0150.00617.35
7.1.10.0170.00617.29
7.1.00.0130.00617.17

preferences:
51.3 ms | 401 KiB | 5 Q