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 = []; if (interface_exists('Throwable')) { foreach (get_declared_classes() as $cn) { $implements = class_implements($cn); if (isset($implements['Throwable'])) { $result[] = $cn; } } } else { 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.20.0090.00018.75
8.4.10.0200.00019.45
8.3.150.0100.01020.56
8.3.140.0110.00716.64
8.3.130.0160.00816.77
8.3.120.0000.01018.96
8.3.110.0210.00617.15
8.3.100.0080.00024.06
8.3.90.0230.00521.68
8.3.80.0240.00616.44
8.3.70.0250.00816.61
8.3.60.0280.00817.71
8.3.50.0190.00919.61
8.3.40.0230.00918.09
8.3.30.0220.00619.73
8.3.20.0120.01123.21
8.3.10.0140.00623.49
8.3.00.0110.00923.36
8.2.270.0070.01317.35
8.2.260.0070.00716.85
8.2.250.0040.00418.48
8.2.240.0070.01018.78
8.2.230.0070.00320.94
8.2.220.0090.00037.54
8.2.210.0170.00721.56
8.2.200.0140.01616.62
8.2.190.0180.01217.25
8.2.180.0160.01521.01
8.2.170.0230.00518.25
8.2.160.0150.00921.14
8.2.150.0120.00624.09
8.2.140.0110.00723.66
8.2.130.0110.00723.83
8.2.120.0110.00723.11
8.2.110.0110.00722.59
8.2.100.0100.00822.74
8.2.90.0130.00722.86
8.2.80.0100.00822.77
8.2.70.0080.00922.70
8.2.60.0130.00623.04
8.2.50.0140.00321.41
8.2.40.0120.00621.59
8.2.30.0130.00521.35
8.2.20.0120.00621.17
8.2.10.0120.00621.17
8.2.00.0120.00521.09
8.1.310.0000.00917.00
8.1.300.0030.00620.37
8.1.290.0220.00719.77
8.1.280.0160.01420.96
8.1.270.0100.00423.78
8.1.260.0110.00524.03
8.1.250.0120.00424.24
8.1.240.0110.00622.63
8.1.230.0110.00623.02
8.1.220.0120.00422.71
8.1.210.0100.00822.78
8.1.200.0120.00622.67
8.1.190.0110.00721.65
8.1.180.0130.00621.39
8.1.170.0130.00721.49
8.1.160.0120.00721.15
8.1.150.0110.00621.11
8.1.140.0120.00621.17
8.1.130.0110.00520.40
8.1.120.0110.00620.43
8.1.110.0110.00519.82
8.1.100.0120.00419.81
8.1.90.0110.00620.07
8.1.80.0110.00519.97
8.1.70.0100.00519.69
8.1.60.0100.00719.76
8.1.50.0120.00419.72
8.1.40.0120.00619.46
8.1.30.0110.00619.46
8.1.20.0130.00519.36
8.1.10.0130.00419.18
8.1.00.0110.00619.28
8.0.300.0110.00422.69
8.0.290.0120.00722.35
8.0.280.0120.00520.19
8.0.270.0080.00720.88
8.0.260.0110.00520.11
8.0.250.0090.00620.19
8.0.240.0130.00419.82
8.0.230.0110.00619.83
8.0.220.0120.00419.89
8.0.210.0130.00519.66
8.0.200.0110.00619.37
8.0.190.0120.00619.40
8.0.180.0110.00519.40
8.0.170.0150.00519.09
8.0.160.0110.00719.01
8.0.150.0140.00518.89
8.0.140.0140.00418.86
8.0.130.0120.00618.73
8.0.120.0130.00618.48
8.0.110.0120.00518.48
8.0.100.0110.00718.46
8.0.90.0130.00418.28
8.0.80.0130.00518.37
8.0.70.0130.00518.42
8.0.60.0140.00518.41
8.0.50.0140.00518.42
8.0.30.0110.00618.29
8.0.20.0120.00618.24
8.0.10.0130.00618.37
8.0.00.0090.00718.37
7.4.330.0110.00518.77
7.4.320.0150.00419.72
7.4.300.0120.00619.27
7.4.290.0170.00419.26
7.4.280.0150.00518.80
7.4.270.0160.00418.73
7.4.260.0140.00518.72
7.4.250.0140.00518.33
7.4.240.0140.00518.33
7.4.230.0140.00518.34
7.4.220.0140.00518.20
7.4.210.0130.00618.21
7.4.200.0140.00618.25
7.4.190.0140.00618.31
7.4.180.0150.00618.29
7.4.160.0130.00618.09
7.4.150.0150.00518.05
7.4.140.0140.00518.05
7.4.130.0140.00617.93
7.4.120.0140.00617.82
7.4.110.0150.00617.82
7.4.100.0140.00617.82
7.4.90.0150.00617.79
7.4.80.0130.00717.81
7.4.70.0140.00617.76
7.4.60.0130.00717.78
7.4.50.0130.00617.64
7.4.40.0140.00617.65
7.4.30.0120.00717.64
7.4.20.0130.00717.56
7.4.10.0120.00717.51
7.4.00.0110.00717.50
7.3.330.0140.00519.20
7.3.320.0130.00518.13
7.3.310.0140.00418.23
7.3.300.0130.00518.23
7.3.290.0140.00618.10
7.3.280.0130.00717.92
7.3.270.0140.00518.00
7.3.260.0140.00518.01
7.3.250.0140.00617.88
7.3.240.0130.00717.87
7.3.230.0140.00617.73
7.3.220.0150.00617.78
7.3.210.0150.00617.75
7.3.200.0150.00617.74
7.3.190.0150.00617.67
7.3.180.0140.00617.72
7.3.170.0130.00717.60
7.3.160.0140.00717.59
7.3.150.0140.00617.63
7.3.140.0140.00617.55
7.3.130.0140.00617.49
7.3.120.0130.00717.42
7.3.110.0120.00717.18
7.3.100.0130.00617.10
7.3.90.0130.00717.20
7.3.80.0130.00717.05
7.3.70.0120.00716.99
7.3.60.0110.00816.90
7.3.50.0120.00816.94
7.3.40.0120.00716.81
7.3.30.0120.00716.75
7.3.20.0180.00817.22
7.3.10.0220.00717.22
7.3.00.0210.00817.19
7.2.340.0140.00717.86
7.2.330.0140.00817.83
7.2.320.0160.00717.84
7.2.310.0160.00617.82
7.2.300.0160.00717.80
7.2.290.0150.00717.71
7.2.280.0150.00617.73
7.2.270.0140.00717.66
7.2.260.0160.00717.61
7.2.250.0130.00817.61
7.2.240.0140.00817.32
7.2.230.0140.00717.26
7.2.220.0150.00617.26
7.2.210.0140.00817.20
7.2.200.0140.00817.17
7.2.190.0130.00717.10
7.2.180.0120.00817.06
7.2.170.0120.00816.98
7.2.160.0130.00716.90
7.2.150.0210.00717.41
7.2.140.0200.00717.43
7.2.130.0220.00817.46
7.2.120.0170.00717.41
7.2.110.0160.00817.40
7.2.100.0160.00817.39
7.2.90.0260.00717.34
7.2.80.0250.00817.28
7.2.70.0250.00817.31
7.2.60.0240.00817.29
7.2.50.0240.00817.29
7.2.40.0250.00717.30
7.2.30.0230.00817.30
7.2.20.0280.00817.29
7.2.10.0260.00817.29
7.2.00.0230.00717.32
7.1.330.0150.00716.95
7.1.320.0180.00716.95
7.1.310.0170.00716.87
7.1.300.0140.00816.77
7.1.290.0180.00716.75
7.1.280.0160.00716.67
7.1.270.0180.00716.59
7.1.260.0190.00716.55
7.1.250.0160.00716.46
7.1.240.0170.00716.46
7.1.230.0190.00716.45
7.1.220.0180.00716.43
7.1.210.0240.00716.39
7.1.200.0260.00716.33
7.1.190.0290.00716.33
7.1.180.0240.00816.30
7.1.170.0230.00816.32
7.1.160.0240.00816.32
7.1.150.0250.00816.30
7.1.140.0270.00716.32
7.1.130.0250.00816.31
7.1.120.0240.00716.27
7.1.110.0250.00716.34
7.1.100.0250.00816.34
7.1.90.0280.00716.31
7.1.80.0250.00716.34
7.1.70.0230.00716.32
7.1.60.0250.00817.07
7.1.50.0220.00717.10
7.1.40.0220.00717.07
7.1.30.0360.00717.07
7.1.20.0210.00717.05
7.1.10.0200.00716.30
7.1.00.0200.00716.31
7.0.330.0220.00716.16
7.0.320.0200.00716.16
7.0.310.0290.00716.06
7.0.300.0280.00716.03
7.0.290.0270.00816.05
7.0.280.0250.00716.12
7.0.270.0270.00716.06
7.0.260.0230.00716.07
7.0.250.0260.00716.11
7.0.240.0240.00716.11
7.0.230.0240.00716.12
7.0.220.0240.00716.08
7.0.210.0220.00816.11
7.0.200.0240.00716.07
7.0.190.0220.00716.12
7.0.180.0190.00716.12
7.0.170.0230.00616.10
7.0.160.0220.00716.07
7.0.150.0210.00716.06
7.0.140.0190.00716.10
7.0.130.0210.00716.09
7.0.120.0200.00716.10
7.0.110.0180.00816.09
7.0.100.0180.00716.09
7.0.90.0180.00716.05
7.0.80.0190.00716.06
7.0.70.0210.00716.03
7.0.60.0180.00716.06
7.0.50.0180.00816.05
7.0.40.0170.00716.08
7.0.30.0180.00616.09
7.0.20.0200.00716.03
7.0.10.0180.00816.06
7.0.00.0190.00616.07
5.6.400.0140.01116.41
5.6.390.0130.01116.38
5.6.380.0140.01116.30
5.6.370.0150.01116.65
5.6.360.0130.01216.69
5.6.350.0140.01116.65
5.6.340.0140.01116.66
5.6.330.0140.01216.63
5.6.320.0130.01216.66
5.6.310.0130.01116.63
5.6.300.0130.01016.54
5.6.290.0140.01116.55
5.6.280.0130.01116.58
5.6.270.0150.01016.57
5.6.260.0130.01116.56
5.6.250.0140.01116.55
5.6.240.0140.01116.55
5.6.230.0140.01016.60
5.6.220.0140.01116.59
5.6.210.0150.01116.57
5.6.200.0130.01116.59
5.6.190.0150.01116.61
5.6.180.0140.01116.60
5.6.170.0150.01116.58
5.6.160.0140.01116.61
5.6.150.0140.01216.60
5.6.140.0140.01116.59
5.6.130.0140.01116.60
5.6.120.0140.01116.62
5.6.110.0140.01116.56
5.6.100.0140.01016.55
5.6.90.0130.01116.55
5.6.80.0130.01116.46
5.6.70.0120.01116.52
5.6.60.0130.01216.53
5.6.50.0130.01116.49
5.6.40.0120.01216.51
5.6.30.0120.01216.50
5.6.20.0140.01016.52
5.6.10.0140.01016.49
5.6.00.0130.01116.50

preferences:
29.97 ms | 403 KiB | 5 Q