3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<h2>Spiders</h2> <h2>Beetles</h2> <h3>External morphology</h3> <h4>Head</h4> <h4>Thorax</h4> <h4>Legs</h4> <h5>Feet</h5> <h3>Anatomy and physiology</h3> <h2>Ants</h2>'; function push_values(&$k, $depth, $content) { $output = array(); $cdepth = $depth[$k]; while ($k < count($depth)) { if ($depth[$k] == $cdepth) { $output[$content[$k]] = ''; $k++; } elseif ($depth[$k] > $cdepth) { $output[$content[$k-1]] = push_values($k, $depth, $content); } else { return $output; } } return $output; } preg_match_all('/<h(\d)>([^<]+)/', $html, $matches); $key = 0; print_r(push_values($key, $matches[1], $matches[2]));

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.5.10.0110.00718.97
8.5.00.0130.01120.46
8.4.150.0020.00014.05
8.4.140.0110.01017.82
8.4.130.0050.00518.78
8.4.120.0110.00924.40
8.4.110.0090.00920.76
8.4.100.0120.00918.21
8.4.90.0180.00320.74
8.4.80.0050.00418.90
8.4.70.0120.01020.80
8.4.60.0020.00920.77
8.4.50.0070.00120.48
8.4.40.0160.00319.86
8.4.30.0030.00620.54
8.4.20.0100.01020.50
8.4.10.0060.00317.84
8.3.280.0120.00918.76
8.3.270.0110.01016.64
8.3.260.0090.01016.70
8.3.250.0060.00417.08
8.3.240.0110.00917.34
8.3.230.0030.00616.84
8.3.220.0040.00420.64
8.3.210.0120.00316.77
8.3.200.0070.00216.69
8.3.190.0050.00318.70
8.3.180.0100.01020.65
8.3.170.0060.00617.36
8.3.160.0120.00416.83
8.3.150.0030.00516.98
8.3.140.0040.00418.93
8.3.130.0090.00916.76
8.3.120.0040.00419.06
8.3.110.0090.00020.94
8.3.100.0030.01616.98
8.3.90.0080.00026.77
8.3.80.0030.00619.36
8.3.70.0090.00917.00
8.3.60.0070.00718.43
8.3.50.0120.00923.72
8.3.40.0060.00919.14
8.3.30.0110.01118.96
8.3.20.0000.00920.92
8.3.10.0110.00423.65
8.3.00.0040.00423.64
8.2.290.0090.00920.55
8.2.280.0140.00520.65
8.2.270.0090.00016.65
8.2.260.0120.00617.28
8.2.250.0130.00716.67
8.2.240.0060.00919.02
8.2.230.0080.00022.58
8.2.220.0080.00024.06
8.2.210.0030.00626.77
8.2.200.0090.00018.88
8.2.190.0110.00718.59
8.2.180.0180.00417.00
8.2.170.0100.01022.96
8.2.160.0030.01420.44
8.2.150.0030.00624.18
8.2.140.0000.00824.66
8.2.130.0050.00326.16
8.2.120.0040.00419.89
8.2.110.0110.00019.18
8.2.100.0130.00017.97
8.2.90.0000.00818.11
8.2.80.0000.01019.16
8.2.70.0030.00618.05
8.2.60.0040.00817.93
8.2.50.0040.00418.07
8.2.40.0000.00817.91
8.2.30.0030.00519.53
8.2.20.0000.00818.07
8.2.10.0080.00019.34
8.2.00.0030.00519.22
8.1.330.0130.00722.20
8.1.320.0080.01023.67
8.1.310.0140.00016.75
8.1.300.0040.00418.19
8.1.290.0060.00330.84
8.1.280.0000.01525.92
8.1.270.0080.00022.07
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00723.96
8.1.230.0070.00420.86
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0080.00017.48
8.1.190.0000.00817.48
8.1.180.0050.00318.10
8.1.170.0030.00618.55
8.1.160.0040.00418.88
8.1.150.0030.00618.97
8.1.140.0000.00720.72
8.1.130.0050.00320.26
8.1.120.0050.00517.62
8.1.110.0030.00517.66
8.1.100.0030.00617.57
8.1.90.0040.00417.61
8.1.80.0040.00417.65
8.1.70.0030.00317.68
8.1.60.0030.00617.73
8.1.50.0000.00817.65
8.1.40.0040.00417.58
8.1.30.0040.00417.75
8.1.20.0040.00417.81
8.1.10.0000.00817.73
8.1.00.0030.00617.60
8.0.300.0040.00420.13
8.0.290.0050.00316.88
8.0.280.0000.00818.39
8.0.270.0050.00318.29
8.0.260.0040.00420.11
8.0.250.0000.00817.19
8.0.240.0000.00817.20
8.0.230.0030.00317.24
8.0.220.0000.00717.12
8.0.210.0040.00417.16
8.0.200.0000.00717.16
8.0.190.0070.00017.05
8.0.180.0000.00817.18
8.0.170.0000.00917.11
8.0.160.0030.00517.07
8.0.150.0070.00017.10
8.0.140.0080.00017.08
8.0.130.0060.00013.59
8.0.120.0070.00016.96
8.0.110.0000.00817.18
8.0.100.0040.00417.13
8.0.90.0060.00316.91
8.0.80.0100.00517.04
8.0.70.0040.00416.99
8.0.60.0040.00417.09
8.0.50.0000.00717.11
8.0.30.0130.00317.13
8.0.20.0110.01417.45
8.0.10.0040.00417.21
8.0.00.0130.00716.92
7.4.330.0020.00216.78
7.4.320.0030.00316.88
7.4.300.0070.00016.72
7.4.290.0030.00516.73
7.4.280.0060.00316.82
7.4.270.0040.00416.65
7.4.260.0030.00313.55
7.4.250.0080.00016.75
7.4.240.0050.00216.67
7.4.230.0000.00816.66
7.4.220.0000.00716.90
7.4.210.0050.01416.79
7.4.200.0000.00716.73
7.4.130.0100.01016.96
7.4.120.0060.01216.68
7.4.110.0110.00716.80
7.4.100.0140.00316.64
7.4.90.0030.01316.73
7.4.80.0060.01719.39
7.4.70.0150.00616.70
7.4.60.0100.00716.72
7.4.50.0030.01116.77
7.4.40.0130.00316.71
7.4.10.0100.00616.61
7.4.00.0100.01316.73
7.3.330.0000.00716.54
7.3.320.0030.00313.35
7.3.310.0070.00016.55
7.3.300.0000.00716.48
7.3.290.0080.00616.45
7.3.280.0130.00716.44
7.3.260.0100.00716.51
7.3.240.0120.00616.72
7.3.230.0140.00316.47
7.3.210.0100.00716.62
7.3.200.0110.01116.68
7.3.190.0000.01716.61
7.3.180.0080.01216.63
7.3.170.0100.00816.55
7.3.160.0130.00316.67
7.3.130.0080.01016.69
7.3.120.0050.01016.42
7.3.110.0120.00616.41
7.3.100.0070.01116.32
7.3.90.0090.00816.75
7.3.80.0110.00716.32
7.3.70.0110.00816.41
7.3.60.0070.01616.48
7.3.50.0060.01316.50
7.3.40.0160.00616.48
7.3.30.0030.01316.43
7.3.20.0140.00416.44
7.3.10.0140.00416.43
7.3.00.0140.00416.48
7.2.330.0140.00616.74
7.2.320.0110.00716.83
7.2.310.0150.00916.80
7.2.300.0150.01116.80
7.2.290.0030.01416.88
7.2.260.0200.00316.63
7.2.250.0120.00616.77
7.2.240.0110.00816.73
7.2.230.0140.00516.76
7.2.220.0100.00816.55
7.2.210.0070.01016.64
7.2.200.0060.01616.71
7.2.190.0100.01416.82
7.2.180.0110.00816.57
7.2.170.0070.01116.56
7.2.160.0140.00316.60
7.2.150.0080.01116.86
7.2.140.0030.01316.76
7.2.130.0030.01416.63
7.2.120.0150.00316.73
7.2.110.0080.01016.71
7.2.100.0320.00416.82
7.2.90.0090.00916.70
7.2.80.0100.01016.77
7.2.70.0100.01316.82
7.2.60.0140.01016.66
7.2.50.0030.01416.68
7.2.40.0030.01316.79
7.2.30.0040.01316.71
7.2.20.0130.01016.57
7.2.10.0150.00916.50
7.2.00.0120.00616.78

preferences:
36.17 ms | 403 KiB | 5 Q