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.4.120.0150.00620.52
8.4.110.0100.01122.23
8.4.100.0100.00217.96
8.4.90.0070.00619.64
8.4.80.0090.01217.73
8.4.70.0100.00617.84
8.4.60.0090.01218.59
8.4.50.0110.00917.78
8.4.40.0070.01419.52
8.4.30.0040.01519.34
8.4.20.0030.00620.49
8.4.10.0130.00320.63
8.3.250.0100.00719.17
8.3.240.0120.00816.54
8.3.230.0120.00716.62
8.3.220.0110.00817.04
8.3.210.0080.01016.63
8.3.200.0030.00616.59
8.3.190.0140.00618.89
8.3.180.0080.01116.73
8.3.170.0110.00719.08
8.3.160.0060.01316.55
8.3.150.0090.00620.88
8.3.140.0100.01016.73
8.3.130.0200.00816.71
8.3.120.0240.00618.65
8.3.110.0200.00517.59
8.3.100.0240.00816.61
8.3.90.0220.00517.47
8.3.80.0190.00917.43
8.3.70.0200.01116.55
8.3.60.0250.00617.58
8.3.50.0080.01217.25
8.3.40.0190.00818.24
8.3.30.0250.00618.09
8.3.20.0180.00419.60
8.3.10.0160.00621.19
8.3.00.0110.00921.45
8.2.290.0120.00920.79
8.2.280.0090.00818.37
8.2.270.0110.00717.08
8.2.260.0140.00420.23
8.2.250.0200.00716.68
8.2.240.0240.00516.92
8.2.230.0210.00418.85
8.2.220.0170.00520.34
8.2.210.0200.00321.59
8.2.200.0150.00717.23
8.2.190.0150.01716.64
8.2.180.0240.00716.55
8.2.170.0190.00920.39
8.2.160.0170.01119.78
8.2.150.0170.00720.89
8.2.140.0210.00522.24
8.2.130.0160.00722.76
8.2.120.0160.00720.99
8.2.110.0190.00521.10
8.2.100.0130.00819.69
8.2.90.0180.00519.62
8.2.80.0160.00819.89
8.2.70.0150.01019.44
8.2.60.0160.00719.62
8.2.50.0140.00419.72
8.2.40.0120.00519.61
8.2.30.0110.00919.27
8.2.20.0150.00419.07
8.2.10.0110.00719.31
8.2.00.0140.00519.01
8.1.330.0100.01018.59
8.1.320.0140.00616.29
8.1.310.0030.00616.56
8.1.300.0200.00516.19
8.1.290.0140.01017.53
8.1.280.0230.00421.05
8.1.270.0160.00420.75
8.1.260.0140.00422.96
8.1.250.0130.00623.38
8.1.240.0150.00420.37
8.1.230.0180.00320.32
8.1.220.0160.00319.49
8.1.210.0190.00319.80
8.1.200.0130.00719.46
8.1.190.0100.00619.44
8.1.180.0140.00319.62
8.1.170.0130.00419.43
8.1.160.0140.00519.38
8.1.150.0140.00619.28
8.1.140.0130.00619.03
8.1.130.0100.00718.81
8.1.120.0140.00519.05
8.1.110.0140.00419.02
8.1.100.0120.00718.76
8.1.90.0120.00518.78
8.1.80.0120.00518.78
8.1.70.0120.00618.80
8.1.60.0140.00518.88
8.1.50.0120.00618.84
8.1.40.0140.00318.86
8.1.30.0120.00518.86
8.1.20.0110.00518.74
8.1.10.0120.00518.70
8.1.00.0120.00518.57
8.0.300.0140.00719.88
8.0.290.0170.00319.13
8.0.280.0120.00519.20
8.0.270.0100.00618.48
8.0.260.0090.00718.38
8.0.250.0100.00518.42
8.0.240.0100.00718.43
8.0.230.0130.00418.41
8.0.220.0130.00418.38
8.0.210.0110.00718.34
8.0.200.0110.00618.46
8.0.190.0110.00518.43
8.0.180.0100.00618.44
8.0.170.0100.00618.42
8.0.160.0100.00618.44
8.0.150.0120.00618.22
8.0.140.0110.00518.24
8.0.130.0130.00517.75
8.0.120.0120.00518.09
8.0.110.0080.00818.10
8.0.100.0100.00618.05
8.0.90.0090.00518.00
8.0.80.0120.00417.86
8.0.70.0100.00618.00
8.0.60.0100.00617.98
8.0.50.0120.00518.08
8.0.30.0130.00417.92
8.0.20.0130.00418.01
8.0.10.0110.00518.15
8.0.00.0130.00617.79
7.4.330.0130.00517.74
7.4.320.0140.00818.18
7.4.300.0160.00518.22
7.4.290.0190.00318.19
7.4.280.0170.00518.19
7.4.270.0120.00618.00
7.4.260.0120.00517.85
7.4.250.0140.00317.88
7.4.240.0130.00517.87
7.4.230.0100.00517.48
7.4.220.0130.00417.77
7.4.210.0130.00617.58
7.4.200.0130.00617.85
7.4.190.0130.00617.92
7.4.180.0130.00717.89
7.4.160.0140.00517.51
7.4.150.0140.00617.84
7.4.140.0140.00417.81
7.4.130.0150.00517.60
7.4.120.0130.00717.55
7.4.110.0160.00517.56
7.4.100.0160.00517.55
7.4.90.0130.00617.49
7.4.80.0150.00417.73
7.4.70.0150.00717.52
7.4.60.0150.00517.55
7.4.50.0120.00717.50
7.4.40.0120.00617.52
7.4.30.0150.00617.52
7.4.20.0150.00617.51
7.4.10.0150.00617.47
7.4.00.0120.00517.10
7.3.330.0150.00517.48
7.3.320.0120.00617.40
7.3.310.0170.00317.69
7.3.300.0160.00517.74
7.3.290.0140.00517.65
7.3.280.0130.00517.35
7.3.270.0160.00317.72
7.3.260.0160.00517.77
7.3.250.0150.00617.64
7.3.240.0130.00817.34
7.3.230.0150.00717.45
7.3.220.0160.00617.55
7.3.210.0160.00517.50
7.3.200.0170.00517.44
7.3.190.0170.00717.46
7.3.180.0150.00617.42
7.3.170.0140.00717.48
7.3.160.0170.00517.40
7.3.150.0170.00717.43
7.3.140.0170.00617.45
7.3.130.0150.00817.35
7.3.120.0160.00617.06
7.3.110.0160.00617.07
7.3.100.0140.00816.94
7.3.90.0150.00617.04
7.3.80.0170.00516.85
7.3.70.0150.00616.84
7.3.60.0140.00716.92
7.3.50.0140.00716.87
7.3.40.0140.00616.68
7.3.30.0130.00716.70
7.3.20.0150.00617.29
7.3.10.0150.00617.28
7.3.00.0160.00717.33
7.2.340.0150.00617.62
7.2.330.0150.00717.56
7.2.320.0150.00817.53
7.2.310.0150.00717.51
7.2.300.0160.00617.56
7.2.290.0160.00717.54
7.2.280.0150.00817.55
7.2.270.0150.00717.53
7.2.260.0160.00617.45
7.2.250.0130.00917.35
7.2.240.0150.00817.20
7.2.230.0130.00817.07
7.2.220.0150.00717.08
7.2.210.0130.00816.94
7.2.200.0130.00817.03
7.2.190.0130.00817.03
7.2.180.0120.00817.00
7.2.170.0130.00616.85
7.2.160.0140.00816.82
7.2.150.0190.00817.47
7.2.140.0150.00717.44
7.2.130.0140.00817.50
7.2.120.0160.00717.49
7.2.110.0160.00717.46
7.2.100.0140.00817.46
7.2.90.0140.00917.49
7.2.80.0150.00817.47
7.2.70.0160.00717.51
7.2.60.0150.00817.45
7.2.50.0130.00917.49
7.2.40.0150.00817.49
7.2.30.0190.00717.53
7.2.20.0190.00817.42
7.2.10.0150.00717.54
7.2.00.0140.00817.53
7.1.330.0130.00717.10
7.1.320.0140.00616.92
7.1.310.0140.00616.79
7.1.300.0150.00616.75
7.1.290.0130.00816.77
7.1.280.0140.00716.66
7.1.270.0130.00816.68
7.1.260.0140.00716.66
7.1.250.0140.00616.64
7.1.240.0150.00617.12
7.1.230.0160.00617.17
7.1.220.0150.00717.12
7.1.210.0150.00717.17
7.1.200.0160.00617.16
7.1.190.0190.00617.18
7.1.180.0130.00817.12
7.1.170.0190.00617.11
7.1.160.0130.00617.13
7.1.150.0150.00617.11
7.1.140.0160.00617.12
7.1.130.0140.00817.15
7.1.120.0160.00717.12
7.1.110.0130.00717.13
7.1.100.0140.00717.13
7.1.90.0150.00717.14
7.1.80.0160.00617.16
7.1.70.0140.00617.06
7.1.60.0130.00717.24
7.1.50.0160.00617.29
7.1.40.0140.00617.23
7.1.30.0170.00517.23
7.1.20.0160.00617.28
7.1.10.0170.00617.22
7.1.00.0140.00617.10

preferences:
29.36 ms | 403 KiB | 5 Q