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.3.60.0160.00618.56
8.3.50.0070.00716.63
8.3.40.0140.00718.97
8.3.30.0110.01118.77
8.3.20.0080.00823.00
8.3.10.0120.00323.64
8.3.00.0110.00526.04
8.2.180.0120.00618.17
8.2.170.0040.01122.96
8.2.160.0060.01020.34
8.2.150.0090.00723.58
8.2.140.0090.00724.19
8.2.130.0080.00426.05
8.2.120.0110.00522.58
8.2.110.0110.00722.03
8.2.100.0150.00720.33
8.2.90.0200.00719.91
8.2.80.0170.00920.13
8.2.70.0160.00634.32
8.2.60.0150.00723.41
8.2.50.0140.00623.80
8.2.40.0170.00323.18
8.2.30.0150.00623.10
8.2.20.0140.00623.19
8.2.10.0120.00723.19
8.2.00.0160.00523.17
8.1.280.0130.00325.92
8.1.270.0070.00624.48
8.1.260.0080.00625.22
8.1.250.0020.01125.86
8.1.240.0090.00420.13
8.1.230.0110.00420.92
8.1.220.0130.00419.73
8.1.210.0110.00520.42
8.1.200.0130.00626.04
8.1.190.0140.00623.19
8.1.180.0150.00523.36
8.1.170.0130.00523.06
8.1.160.0110.00723.03
8.1.150.0120.00523.46
8.1.140.0120.00723.05
8.1.130.0140.00622.92
8.1.120.0110.00722.60
8.1.110.0120.00621.91
8.1.100.0120.00721.71
8.1.90.0110.00521.51
8.1.80.0120.00521.55
8.1.70.0090.00621.32
8.1.60.0130.00521.38
8.1.50.0120.00520.98
8.1.40.0120.00520.88
8.1.30.0130.00520.67
8.1.20.0130.00520.72
8.1.10.0120.00620.39
8.1.00.0120.00620.25
8.0.300.0140.00419.56
8.0.290.0130.00725.31
8.0.280.0130.00522.39
8.0.270.0140.00422.40
8.0.260.0130.00522.43
8.0.250.0120.00521.96
8.0.240.0140.00421.12
8.0.230.0120.00521.21
8.0.220.0110.00620.82
8.0.210.0140.00420.82
8.0.200.0130.00620.67
8.0.190.0120.00720.75
8.0.180.0130.00520.48
8.0.170.0140.00420.19
8.0.160.0100.00720.01
8.0.150.0150.00419.86
8.0.140.0130.00519.64
8.0.130.0130.00519.45
8.0.120.0140.00519.57
8.0.110.0130.00519.63
8.0.100.0130.00619.54
8.0.90.0130.00519.36
8.0.80.0120.00619.29
8.0.70.0130.00519.41
8.0.60.0130.00519.40
8.0.50.0120.00619.36
8.0.30.0110.00718.94
8.0.20.0120.00718.86
8.0.10.0130.00618.95
8.0.00.0100.00719.41
7.4.330.0140.00321.91
7.4.320.0120.00620.87
7.4.300.0110.00620.71
7.4.290.0120.00620.46
7.4.280.0140.00519.79
7.4.270.0140.00419.52
7.4.260.0140.00519.31
7.4.250.0130.00419.29
7.4.240.0130.00419.19
7.4.230.0130.00619.30
7.4.220.0120.00519.25
7.4.210.0110.00618.81
7.4.200.0110.00519.27
7.4.190.0110.00519.17
7.4.180.0110.00519.16
7.4.160.0130.00518.77
7.4.150.0110.00618.72
7.4.140.0110.00618.55
7.4.130.0120.00618.34
7.4.120.0110.00718.19
7.4.110.0120.00618.06
7.4.100.0120.00818.04
7.4.90.0130.00718.01
7.4.80.0120.00718.00
7.4.70.0120.00717.96
7.4.60.0130.00617.91
7.4.50.0120.00717.88
7.4.40.0130.00717.86
7.4.30.0110.00717.86
7.4.20.0110.00817.79
7.4.10.0110.00817.69
7.4.00.0100.00717.52
7.3.330.0140.00519.07
7.3.320.0130.00619.05
7.3.310.0140.00519.15
7.3.300.0140.00519.20
7.3.290.0140.00518.96
7.3.280.0150.00518.58
7.3.270.0130.00618.48
7.3.260.0130.00618.31
7.3.250.0130.00618.38
7.3.240.0140.00718.10
7.3.230.0140.00617.99
7.3.220.0140.00717.94
7.3.210.0140.00717.90
7.3.200.0130.00717.91
7.3.190.0140.00717.88
7.3.180.0120.00817.84
7.3.170.0130.00717.80
7.3.160.0130.00717.83
7.3.150.0130.00717.78
7.3.140.0130.00717.70
7.3.130.0130.00717.62
7.3.120.0120.00717.37
7.3.110.0120.00717.28
7.3.100.0110.00817.07
7.3.90.0110.00817.02
7.3.80.0110.00816.89
7.3.70.0120.00716.76
7.3.60.0110.00716.70
7.3.50.0110.00716.66
7.3.40.0120.00716.62
7.3.30.0100.00816.61
7.3.20.0160.00717.10
7.3.10.0140.00817.08
7.3.00.0160.00717.07
7.2.340.0150.00718.12
7.2.330.0150.00718.05
7.2.320.0140.00718.08
7.2.310.0130.00817.98
7.2.300.0150.00717.99
7.2.290.0140.00717.95
7.2.280.0140.00717.90
7.2.270.0150.00617.84
7.2.260.0130.00817.74
7.2.250.0130.00717.60
7.2.240.0120.00817.46
7.2.230.0120.00817.26
7.2.220.0110.00817.09
7.2.210.0120.00717.04
7.2.200.0120.00816.97
7.2.190.0120.00816.90
7.2.180.0120.00816.83
7.2.170.0120.00816.84
7.2.160.0110.00816.80
7.2.150.0160.00817.38
7.2.140.0160.00817.34
7.2.130.0160.00817.33
7.2.120.0180.00717.31
7.2.110.0170.00717.29
7.2.100.0200.00817.23
7.2.90.0220.00717.26
7.2.80.0220.00817.21
7.2.70.0240.00817.22
7.2.60.0230.00817.23
7.2.50.0230.00817.24
7.2.40.0220.00817.25
7.2.30.0200.00817.26
7.2.20.0220.00817.25
7.2.10.0230.00817.27
7.2.00.0220.00817.24
7.1.330.0180.00717.09
7.1.320.0160.00816.72
7.1.310.0150.00816.63
7.1.300.0160.00816.47
7.1.290.0150.00716.48
7.1.280.0140.00816.45
7.1.270.0160.00716.39
7.1.260.0150.00816.41
7.1.250.0190.00716.24
7.1.240.0190.00816.21
7.1.230.0190.00816.23
7.1.220.0230.00816.17
7.1.210.0250.00716.15
7.1.200.0230.00816.16
7.1.190.0240.00716.16
7.1.180.0230.00716.15
7.1.170.0250.00816.18
7.1.160.0230.00716.14
7.1.150.0240.00716.14
7.1.140.0250.00816.17
7.1.130.0250.00716.16
7.1.120.0240.00716.15
7.1.110.0240.00816.19
7.1.100.0230.00716.19
7.1.90.0240.00716.20
7.1.80.0230.00716.22
7.1.70.0250.00816.16
7.1.60.0220.00816.70
7.1.50.0230.00716.69
7.1.40.0210.00816.71
7.1.30.0210.00716.70
7.1.20.0220.00816.68
7.1.10.0200.00716.22
7.1.00.0210.00816.21
7.0.330.0220.00615.96
7.0.320.0190.00715.91
7.0.310.0240.00715.86
7.0.300.0240.00715.86
7.0.290.0240.00715.86
7.0.280.0230.00715.88
7.0.270.0260.00815.86
7.0.260.0260.00715.87
7.0.250.0240.00715.94
7.0.240.0240.00715.94
7.0.230.0220.00715.94
7.0.220.0230.00715.92
7.0.210.0210.00715.94
7.0.200.0210.00815.91
7.0.190.0230.00715.94
7.0.180.0230.00715.93
7.0.170.0210.00715.95
7.0.160.0200.00815.92
7.0.150.0200.00715.90
7.0.140.0210.00715.92
7.0.130.0200.00715.94
7.0.120.0200.00815.95
7.0.110.0230.00715.92
7.0.100.0190.00815.92
7.0.90.0210.00815.88
7.0.80.0200.00815.87
7.0.70.0210.00715.88
7.0.60.0200.00815.91
7.0.50.0210.00715.90
7.0.40.0200.00715.91
7.0.30.0180.00815.91
7.0.20.0220.00715.86
7.0.10.0200.00815.88
7.0.00.0210.00815.86
5.6.400.0150.00816.41
5.6.390.0150.00916.26
5.6.380.0140.00916.10
5.6.370.0150.00916.70
5.6.360.0150.01016.74
5.6.350.0160.00816.74
5.6.340.0150.01016.68
5.6.330.0150.00916.74
5.6.320.0150.00916.71
5.6.310.0150.00916.69
5.6.300.0150.00916.65
5.6.290.0150.00916.71
5.6.280.0150.01016.69
5.6.270.0140.01016.69
5.6.260.0140.00916.68
5.6.250.0140.00916.69
5.6.240.0150.00916.73
5.6.230.0140.00916.73
5.6.220.0130.01016.72
5.6.210.0150.00816.73
5.6.200.0140.00916.75
5.6.190.0150.00916.74
5.6.180.0150.00816.69
5.6.170.0150.00916.71
5.6.160.0140.01016.73
5.6.150.0150.00916.73
5.6.140.0140.00916.71
5.6.130.0140.00916.72
5.6.120.0130.01016.73
5.6.110.0140.00916.69
5.6.100.0140.01016.70
5.6.90.0140.00916.65
5.6.80.0130.00916.60
5.6.70.0140.00816.63
5.6.60.0130.00916.66
5.6.50.0130.00916.63
5.6.40.0140.00916.64
5.6.30.0140.00916.66
5.6.20.0130.00916.61
5.6.10.0140.00916.61
5.6.00.0140.00916.61
5.5.380.0190.01116.84
5.5.370.0270.00717.06
5.5.360.0170.00816.82
5.5.350.0250.00616.68
5.5.340.0110.01516.86
5.5.330.0210.00716.86
5.5.320.0220.00316.89
5.5.310.0320.00417.04
5.5.300.0300.00316.98
5.5.290.0210.00316.84
5.5.280.0210.00316.88
5.5.270.0230.00616.74
5.5.260.0230.00516.42
5.5.250.0290.00316.92
5.5.240.0230.00817.13
5.5.230.0290.00616.87
5.5.220.0280.00616.68
5.5.210.0290.00617.11
5.5.200.0200.01016.87
5.5.190.0190.00816.82
5.5.180.0200.00316.95
5.5.170.0170.00716.80
5.5.160.0200.00416.77
5.5.150.0150.00816.79
5.5.140.0210.00316.58
5.5.130.0180.00616.80
5.5.120.0160.00816.74
5.5.110.0170.00716.71
5.5.100.0210.00316.99
5.5.90.0200.00417.04
5.5.80.0150.00917.12
5.5.70.0200.00317.15
5.5.60.0200.00417.11
5.5.50.0200.00316.89
5.5.40.0210.00316.86
5.5.30.0220.00716.66
5.5.20.0130.01016.90
5.5.10.0270.00816.81
5.5.00.0200.00416.62
5.4.450.0190.00014.18
5.4.440.0160.00314.18
5.4.430.0200.00014.18
5.4.420.0190.00014.18
5.4.410.0270.00014.18
5.4.400.0260.00714.18
5.4.390.0240.00614.18
5.4.380.0190.00314.18
5.4.370.0110.01114.18
5.4.360.0200.00314.18
5.4.350.0140.00814.18
5.4.340.0200.00014.18
5.4.330.0190.00014.18
5.4.320.0100.01014.18
5.4.310.0120.00614.18
5.4.300.0200.00014.18
5.4.290.0200.00014.18
5.4.280.0150.00914.18
5.4.270.0200.00614.18
5.4.260.0210.00414.18
5.4.250.0250.00314.18
5.4.240.0160.00414.18
5.4.230.0120.00814.18
5.4.220.0190.00014.18
5.4.210.0160.00314.18
5.4.200.0120.00614.18
5.4.190.0160.00314.18
5.4.180.0190.00014.18
5.4.170.0190.00014.18
5.4.160.0130.00614.18
5.4.150.0150.00414.18
5.4.140.0130.00614.18
5.4.130.0160.00314.18
5.4.120.0160.00314.18
5.4.110.0090.00914.18
5.4.100.0180.00014.18
5.4.90.0160.00314.18
5.4.80.0150.00414.18
5.4.70.0140.00514.18
5.4.60.0160.00414.18
5.4.50.0160.00314.18
5.4.40.0170.00314.18
5.4.30.0180.00314.18
5.4.20.0210.00914.18
5.4.10.0220.00014.18
5.4.00.0170.00614.18
5.3.290.0230.00314.18
5.3.280.0160.00814.18
5.3.270.0150.00414.18
5.3.260.0160.00314.18
5.3.250.0130.00714.18
5.3.240.0160.00314.18
5.3.230.0130.00614.18
5.3.220.0110.00814.18
5.3.210.0130.00614.18
5.3.200.0160.00314.18
5.3.190.0090.00914.18
5.3.180.0130.00614.18
5.3.170.0200.00014.18
5.3.160.0170.00614.18
5.3.150.0150.00414.18
5.3.140.0130.00614.18
5.3.130.0220.00414.18
5.3.120.0230.00414.18
5.3.110.0180.00314.18
5.3.100.0190.00614.18
5.3.90.0150.01114.18
5.3.80.0200.00714.18
5.3.70.0150.00614.18
5.3.60.0150.00414.18
5.3.50.0110.00714.18
5.3.40.0250.00014.18
5.3.30.0180.00714.18
5.3.20.0180.00714.18
5.3.10.0220.00314.18
5.3.00.0150.00914.18
5.2.170.0150.00314.18
5.2.160.0130.00614.18
5.2.150.0160.00614.18
5.2.140.0150.00714.18
5.2.130.0190.00014.18
5.2.120.0120.00814.18
5.2.110.0060.01114.18
5.2.100.0160.00014.18
5.2.90.0120.00414.18
5.2.80.0110.00414.18
5.2.70.0120.00314.18
5.2.60.0170.00014.18
5.2.50.0120.00414.18
5.2.40.0160.00014.18
5.2.30.0170.00014.18
5.2.20.0150.00014.18
5.2.10.0130.00914.18
5.2.00.0110.00414.18
5.1.60.0070.00714.18
5.1.50.0160.00414.18
5.1.40.0090.01314.18
5.1.30.0120.00314.18
5.1.20.0170.00014.18
5.1.10.0140.00014.18
5.1.00.0110.00414.18
5.0.50.0090.00314.18
5.0.40.0110.00014.18
5.0.30.0080.00314.18
5.0.20.0110.00014.18
5.0.10.0080.00814.18
5.0.00.0000.01114.18
4.4.90.0090.00014.18
4.4.80.0170.00014.18
4.4.70.0100.00014.18
4.4.60.0000.00914.18
4.4.50.0050.00514.18
4.4.40.0100.00014.18
4.4.30.0040.00414.18
4.4.20.0050.00214.18
4.4.10.0040.00214.18
4.4.00.0000.00914.18
4.3.110.0090.00014.18
4.3.100.0070.00214.18
4.3.90.0080.00014.18
4.3.80.0070.00014.18
4.3.70.0090.00314.18
4.3.60.0080.00314.18
4.3.50.0100.00014.18
4.3.40.0040.00414.18
4.3.30.0030.00314.18
4.3.20.0060.00014.18
4.3.10.0060.00014.18
4.3.00.0000.00714.18

preferences:
115.26 ms | 401 KiB | 5 Q