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 = array(); 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 = array(); foreach ($classes as $cn) { $parent = (string) get_parent_class($cn); if (isset($result[$parent])) { $result[$parent][] = $cn; } else { $result[$parent] = array($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.10.0090.00019.53
8.3.140.0120.00316.87
8.3.130.0150.00917.72
8.3.120.0260.00817.10
8.3.110.0280.00617.38
8.3.100.0280.01021.28
8.3.90.0310.00621.77
8.3.80.0320.00621.64
8.3.70.0310.00821.62
8.3.60.0300.00623.11
8.3.50.0210.00822.48
8.3.40.0270.00422.98
8.3.30.0250.00922.86
8.3.20.0210.00823.29
8.3.10.0230.00823.48
8.3.00.0170.00724.76
8.2.250.0230.00516.44
8.2.240.0200.00516.64
8.2.230.0180.00517.67
8.2.220.0190.00623.54
8.2.210.0200.00821.68
8.2.200.0240.00521.58
8.2.190.0230.00621.67
8.2.180.0250.00622.37
8.2.170.0230.00723.44
8.2.160.0240.00523.18
8.2.150.0220.00823.51
8.2.140.0240.00823.68
8.2.130.0220.00724.53
8.2.120.0260.00723.21
8.2.110.0210.00822.81
8.2.100.0220.00721.72
8.2.90.0260.00821.75
8.2.80.0250.00721.78
8.2.70.0210.00830.31
8.2.60.0210.00723.42
8.2.50.0200.00623.66
8.2.40.0210.00623.29
8.2.30.0200.00623.23
8.2.20.0190.00723.28
8.2.10.0190.00723.28
8.2.00.0200.00623.27
8.1.300.0290.00616.49
8.1.290.0190.00923.40
8.1.280.0230.00623.09
8.1.270.0230.00623.69
8.1.260.0210.00824.03
8.1.250.0230.00924.15
8.1.240.0190.00421.85
8.1.230.0160.00722.13
8.1.220.0190.00821.54
8.1.210.0210.00521.88
8.1.200.0220.00624.86
8.1.190.0210.00623.23
8.1.180.0200.00623.34
8.1.170.0200.00623.17
8.1.160.0190.00723.13
8.1.150.0190.00623.42
8.1.140.0180.00723.15
8.1.130.0190.00623.07
8.1.120.0170.00722.87
8.1.110.0170.00722.33
8.1.100.0170.00722.17
8.1.90.0150.00522.00
8.1.80.0150.00622.03
8.1.70.0140.00721.83
8.1.60.0170.00521.90
8.1.50.0150.00521.55
8.1.40.0160.00521.46
8.1.30.0160.00621.26
8.1.20.0170.00621.29
8.1.10.0150.00621.00
8.1.00.0160.00620.87
8.0.300.0200.00521.24
8.0.290.0170.00824.28
8.0.280.0170.00622.57
8.0.270.0180.00522.56
8.0.260.0170.00622.59
8.0.250.0160.00622.29
8.0.240.0180.00621.61
8.0.230.0170.00621.70
8.0.220.0160.00621.37
8.0.210.0190.00521.39
8.0.200.0170.00621.27
8.0.190.0150.00621.35
8.0.180.0150.00621.08
8.0.170.0170.00520.83
8.0.160.0140.00720.66
8.0.150.0170.00520.53
8.0.140.0150.00620.32
8.0.130.0150.00520.16
8.0.120.0160.00520.24
8.0.110.0150.00520.29
8.0.100.0160.00620.23
8.0.90.0150.00620.04
8.0.80.0150.00619.95
8.0.70.0150.00720.07
8.0.60.0150.00620.05
8.0.50.0150.00720.02
8.0.30.0140.00719.55
8.0.20.0140.00619.45
8.0.10.0150.00619.56
8.0.00.0120.00719.94
7.4.330.0180.00422.81
7.4.320.0160.00521.40
7.4.300.0160.00621.21
7.4.290.0160.00621.05
7.4.280.0170.00620.46
7.4.270.0160.00520.20
7.4.260.0160.00520.00
7.4.250.0150.00519.98
7.4.240.0170.00419.88
7.4.230.0160.00620.00
7.4.220.0140.00519.91
7.4.210.0140.00619.49
7.4.200.0140.00519.94
7.4.190.0140.00619.87
7.4.180.0140.00619.83
7.4.160.0150.00519.41
7.4.150.0140.00619.35
7.4.140.0130.00719.14
7.4.130.0130.00618.94
7.4.120.0130.00718.79
7.4.110.0140.00718.65
7.4.100.0140.00718.61
7.4.90.0140.00718.58
7.4.80.0130.00718.56
7.4.70.0130.00718.50
7.4.60.0140.00618.44
7.4.50.0130.00718.41
7.4.40.0140.00718.40
7.4.30.0120.00718.39
7.4.20.0120.00818.30
7.4.10.0120.00818.18
7.4.00.0110.00718.00
7.3.330.0150.00519.80
7.3.320.0150.00619.77
7.3.310.0150.00519.85
7.3.300.0160.00519.89
7.3.290.0160.00519.66
7.3.280.0160.00519.26
7.3.270.0160.00619.13
7.3.260.0150.00618.95
7.3.250.0140.00619.02
7.3.240.0150.00718.71
7.3.230.0150.00618.57
7.3.220.0150.00718.52
7.3.210.0160.00618.47
7.3.200.0150.00618.47
7.3.190.0150.00718.43
7.3.180.0140.00718.37
7.3.170.0140.00718.34
7.3.160.0140.00718.36
7.3.150.0140.00718.30
7.3.140.0140.00718.21
7.3.130.0150.00718.11
7.3.120.0140.00717.84
7.3.110.0130.00717.75
7.3.100.0120.00817.52
7.3.90.0130.00717.45
7.3.80.0120.00817.31
7.3.70.0120.00717.17
7.3.60.0120.00717.11
7.3.50.0120.00717.06
7.3.40.0120.00717.02
7.3.30.0110.00817.00
7.3.20.0170.00717.51
7.3.10.0150.00817.48
7.3.00.0170.00717.47
7.2.340.0160.00718.70
7.2.330.0160.00718.61
7.2.320.0150.00718.63
7.2.310.0140.00818.51
7.2.300.0160.00718.52
7.2.290.0150.00718.48
7.2.280.0150.00718.42
7.2.270.0160.00618.34
7.2.260.0150.00818.21
7.2.250.0150.00718.08
7.2.240.0130.00817.92
7.2.230.0130.00817.69
7.2.220.0120.00817.51
7.2.210.0130.00717.46
7.2.200.0130.00817.37
7.2.190.0130.00817.29
7.2.180.0130.00717.22
7.2.170.0130.00817.23
7.2.160.0120.00817.18
7.2.150.0170.00817.79
7.2.140.0160.00817.74
7.2.130.0160.00817.74
7.2.120.0190.00717.70
7.2.110.0170.00717.68
7.2.100.0200.00817.63
7.2.90.0220.00717.65
7.2.80.0220.00817.60
7.2.70.0240.00817.61
7.2.60.0230.00817.62
7.2.50.0230.00817.63
7.2.40.0220.00817.65
7.2.30.0210.00817.64
7.2.20.0220.00817.64
7.2.10.0230.00817.66
7.2.00.0230.00817.63
7.1.330.0190.00717.62
7.1.320.0160.00817.21
7.1.310.0160.00817.12
7.1.300.0170.00716.93
7.1.290.0160.00716.93
7.1.280.0150.00816.88
7.1.270.0170.00716.83
7.1.260.0160.00816.84
7.1.250.0190.00716.67
7.1.240.0190.00816.63
7.1.230.0190.00816.65
7.1.220.0230.00816.58
7.1.210.0250.00716.57
7.1.200.0230.00816.58
7.1.190.0240.00716.57
7.1.180.0230.00716.56
7.1.170.0250.00816.60
7.1.160.0230.00716.56
7.1.150.0240.00716.55
7.1.140.0250.00816.58
7.1.130.0240.00716.57
7.1.120.0240.00716.57
7.1.110.0230.00816.60
7.1.100.0230.00716.60
7.1.90.0240.00716.62
7.1.80.0230.00716.63
7.1.70.0240.00716.57
7.1.60.0220.00817.08
7.1.50.0230.00717.07
7.1.40.0210.00817.10
7.1.30.0210.00717.09
7.1.20.0210.00817.06
7.1.10.0200.00716.63
7.1.00.0210.00816.62
7.0.330.0220.00616.39
7.0.320.0190.00716.35
7.0.310.0240.00716.28
7.0.300.0240.00716.29
7.0.290.0240.00716.29
7.0.280.0230.00716.30
7.0.270.0250.00716.29
7.0.260.0260.00716.29
7.0.250.0240.00716.36
7.0.240.0240.00716.36
7.0.230.0220.00716.36
7.0.220.0230.00716.34
7.0.210.0210.00716.37
7.0.200.0210.00816.33
7.0.190.0230.00716.36
7.0.180.0230.00716.34
7.0.170.0210.00716.37
7.0.160.0200.00816.35
7.0.150.0200.00716.33
7.0.140.0210.00716.34
7.0.130.0200.00716.36
7.0.120.0200.00816.37
7.0.110.0230.00716.34
7.0.100.0190.00816.34
7.0.90.0210.00816.31
7.0.80.0200.00816.30
7.0.70.0210.00716.30
7.0.60.0200.00816.33
7.0.50.0210.00716.31
7.0.40.0200.00716.33
7.0.30.0180.00716.33
7.0.20.0220.00716.28
7.0.10.0200.00816.29
7.0.00.0210.00716.27
5.6.400.0150.00816.80
5.6.390.0150.00816.67
5.6.380.0150.00816.48
5.6.370.0160.00917.16
5.6.360.0150.00917.20
5.6.350.0160.00817.20
5.6.340.0150.00917.15
5.6.330.0160.00917.19
5.6.320.0150.00917.17
5.6.310.0160.00917.16
5.6.300.0150.00917.11
5.6.290.0150.00917.16
5.6.280.0150.01017.14
5.6.270.0140.01017.15
5.6.260.0150.00817.14
5.6.250.0150.00917.14
5.6.240.0150.00917.18
5.6.230.0150.00917.19
5.6.220.0140.01017.18
5.6.210.0160.00817.19
5.6.200.0150.00917.21
5.6.190.0150.00817.20
5.6.180.0160.00817.15
5.6.170.0150.00917.16
5.6.160.0150.00917.19
5.6.150.0150.00917.18
5.6.140.0140.00917.16
5.6.130.0140.00917.18
5.6.120.0140.00917.19
5.6.110.0150.00917.15
5.6.100.0140.01017.15
5.6.90.0140.00917.11
5.6.80.0130.00917.06
5.6.70.0150.00817.10
5.6.60.0140.00817.13
5.6.50.0140.00917.09
5.6.40.0140.00917.10
5.6.30.0140.00917.12
5.6.20.0140.00917.07
5.6.10.0140.00917.07
5.6.00.0140.00917.08

preferences:
50.76 ms | 403 KiB | 5 Q