3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<TAG <h1>This is my title</h1> <p>This is a text right under my h1 title.</p> <p>This is some more text under my h1 title</p> <h2>This is my level 2 heading</h2> <p>This is text right under my level 2 heading</p> <h3>First h3</h3> <p>First paragraph for the first h3</p> <h3>Second h3</h3> <p>First paragraph for the second h3</p> <h3>Third h3</h3> <p>First paragraph for the third h3</p> <p>Second paragraph for the third h3</p> <h2>This is my level 2 heading</h2> <p>This is text right under my level 2 heading</p> TAG; $dom = new DomDocument(); // Load the HTML, don't worry about it being a fragment $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); $xpath = new DOMXPath($dom); // Grab all H3 tags. This might need to be adjusted if there's more to the depth $results = $xpath->query("//h3"); foreach ($results as $result) { var_dump(sprintf('<h3>%1$s</h3>', $result->textContent)); // See if the next element is a P tag $next = $result->nextElementSibling; if ($next && 'p' === $next->nodeName) { var_dump(sprintf('<p>%1$s</p>', $next->textContent)); } }

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.140.0210.00817.97
8.4.130.0080.00418.04
8.4.120.0130.00721.05
8.4.110.0140.00619.50
8.4.100.0090.00918.43
8.4.90.0150.00617.91
8.4.80.0080.00620.00
8.4.70.0120.00918.20
8.4.60.0150.00718.35
8.4.50.0120.00918.24
8.4.40.0100.01018.13
8.4.30.0030.01719.08
8.4.20.0120.00919.89
8.4.10.0090.00020.02
8.3.270.0110.01216.98
8.3.260.0070.00217.20
8.3.250.0120.00719.27
8.3.240.0050.00417.16
8.3.230.0120.00917.19
8.3.220.0110.00817.16
8.3.210.0090.01117.22
8.3.200.0120.00716.79
8.3.190.0110.00917.54
8.3.180.0090.01017.23
8.3.170.0090.00917.34
8.3.160.0110.00720.45
8.3.150.0050.00517.16
8.3.140.0080.00017.86
8.3.130.0000.00818.86
8.3.120.0110.00019.32
8.3.110.0060.00320.94
8.3.100.0040.00424.06
8.3.90.0180.00026.77
8.3.80.0060.00316.88
8.3.70.0080.00816.75
8.3.60.0030.01218.81
8.3.50.0070.00720.32
8.3.40.0120.00321.35
8.3.30.0040.01219.25
8.3.20.0080.00024.18
8.3.10.0040.00424.66
8.3.00.0060.00326.16
8.2.290.0130.00819.26
8.2.280.0060.00418.74
8.2.270.0130.00717.86
8.2.260.0040.00418.86
8.2.250.0040.01418.70
8.2.240.0140.00419.24
8.2.230.0090.00022.58
8.2.220.0040.00437.54
8.2.210.0140.00326.77
8.2.200.0060.00317.00
8.2.190.0170.00316.75
8.2.180.0190.00525.92
8.2.170.0060.00919.29
8.2.160.0170.00322.96
8.2.150.0080.00025.66
8.2.140.0070.00024.66
8.2.130.0080.00026.16
8.2.120.0040.00421.42
8.2.110.0030.00621.56
8.2.100.0080.00417.97
8.2.90.0000.00818.00
8.2.80.0080.00019.11
8.2.70.0000.00918.00
8.2.60.0080.00018.13
8.2.50.0040.00417.98
8.2.40.0030.00718.09
8.2.30.0040.00418.13
8.2.20.0040.00420.76
8.2.10.0040.00418.16
8.2.00.0000.00719.63
8.1.330.0130.00616.39
8.1.320.0090.01016.57
8.1.310.0150.00018.84
8.1.300.0030.00617.95
8.1.290.0000.01018.88
8.1.280.0110.00425.92
8.1.270.0000.01022.46
8.1.260.0030.00526.35
8.1.250.0070.00028.09
8.1.240.0090.00024.13
8.1.230.0040.00823.00
8.1.220.0080.00018.05
8.1.210.0030.00518.77
8.1.200.0050.00317.72
8.1.190.0050.00317.73
8.1.180.0040.00418.10
8.1.170.0080.00018.03
8.1.160.0040.00421.06
8.1.150.0000.00918.99
8.1.140.0000.00817.87
8.1.130.0040.00419.39
8.1.120.0000.00717.78
8.1.110.0040.00517.76
8.1.100.0030.00517.83
8.1.90.0000.00717.88
8.1.80.0060.00317.84
8.1.70.0030.00317.86
8.1.60.0000.00818.02
8.1.50.0040.00417.90
8.1.40.0000.00817.98
8.1.30.0000.00818.02
8.1.20.0030.00717.96
8.1.10.0080.00017.98
8.1.00.0160.00317.97
8.0.300.0040.00418.77
8.0.290.0030.00517.25
8.0.280.0000.00918.90
8.0.270.0070.00017.28
8.0.260.0030.00318.88
8.0.250.0000.00717.40
8.0.240.0000.00717.46
8.0.230.0050.00317.41
8.0.220.0040.00417.27
8.0.210.0000.00817.24
8.0.200.0040.00417.30
8.0.190.0070.00017.45
8.0.180.0000.00817.37
8.0.170.0050.00517.41
8.0.160.0000.00717.41
8.0.150.0040.00417.39
8.0.140.0050.00317.29
8.0.130.0110.00617.19
8.0.120.0190.00317.29
8.0.110.0150.00617.36
8.0.100.0150.00617.37
8.0.90.0060.00617.31
8.0.80.0180.00317.24
8.0.70.0230.00017.20
8.0.60.0120.00817.18
8.0.50.0220.00017.32
8.0.30.0130.00917.24
8.0.20.0160.00617.38
8.0.10.0180.00517.46
8.0.00.0040.00717.38
7.4.330.0050.00015.55
7.4.320.0000.00616.98
7.4.300.0030.00316.90
7.4.290.0040.00416.74
7.4.280.0100.00316.99
7.4.270.0190.00617.01
7.4.260.0190.00816.90
7.4.250.0230.00017.00
7.4.240.0230.00016.92
7.4.230.0170.00716.94
7.4.220.0150.00516.92
7.4.210.0150.00616.85
7.4.200.0110.01116.83
7.4.190.0140.00717.06
7.4.180.0140.00716.91
7.4.160.0190.00017.06
7.4.150.0140.00716.84
7.4.140.0150.00416.81
7.4.130.0150.00516.70
7.4.120.0130.00916.81
7.4.110.0150.00616.86
7.4.100.0210.00016.87
7.4.90.0140.00716.87
7.4.80.0100.01016.76
7.4.70.0140.00616.82
7.4.60.0130.00716.86
7.4.50.0110.00916.84
7.4.40.0130.00716.66
7.4.30.0140.00516.90
7.4.20.0160.00316.65
7.4.10.0100.00716.82
7.4.00.0150.00316.70
7.3.330.0120.00916.83
7.3.320.0170.00616.67
7.3.310.0140.00016.71
7.3.300.0110.01116.77
7.3.290.0160.00516.84
7.3.280.0170.00516.75
7.3.270.0190.00316.81
7.3.260.0140.00816.61
7.3.250.0130.00916.87
7.3.240.0130.00816.75
7.3.230.0180.00416.81
7.3.220.0170.00616.76
7.3.210.0240.00016.60
7.3.200.0110.00616.63
7.3.190.0130.00716.76
7.3.180.0100.00516.65
7.3.170.0090.00016.56
7.3.160.0050.00516.64
7.3.150.0050.00516.66
7.3.140.0050.00316.77
7.3.130.0080.00316.75

preferences:
27.36 ms | 403 KiB | 5 Q