3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <!DOCTYPE HTML> <html> <body> <div></div> </body> </html> HTML; $dom = new DOMDocument(); $dom->loadHTML($html); $divs = iterator_to_array($dom->getElementsByTagName('div')->getIterator()); foreach ($divs as $div) { $fragment = $dom->createDocumentFragment(); $fragment->appendXML('<p>Hi!</p>'); $div->replaceWith($fragment); } echo $dom->saveHTML();

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.0080.01019.75
8.5.00.0120.01120.39
8.4.160.0120.00924.02
8.4.150.0030.00014.05
8.4.140.0140.00717.91
8.4.130.0100.01018.20
8.4.120.0120.00920.68
8.4.110.0110.01022.83
8.4.100.0130.00817.84
8.4.90.0140.00717.81
8.4.80.0140.00517.75
8.4.70.0170.00818.01
8.4.60.0150.00817.89
8.4.50.0050.00617.96
8.4.40.0130.00617.78
8.4.30.0130.00720.84
8.4.20.0130.00720.76
8.4.10.0030.00624.05
8.3.280.0150.00418.79
8.3.270.0100.01016.74
8.3.260.0120.00616.80
8.3.250.0140.00519.13
8.3.240.0120.00716.67
8.3.230.0130.00716.84
8.3.220.0080.01117.43
8.3.210.0160.00716.74
8.3.200.0100.01016.79
8.3.190.0140.00417.36
8.3.180.0140.00618.46
8.3.170.0150.00319.14
8.3.160.0140.00316.86
8.3.150.0040.00420.97
8.3.140.0040.01216.87
8.3.130.0030.00618.67
8.3.120.0030.00721.03
8.3.110.0030.01720.94
8.3.100.0000.01018.59
8.3.90.0120.00618.71
8.3.80.0070.00718.68
8.3.70.0120.00318.68
8.3.60.0100.00718.79
8.3.50.0120.00416.81
8.3.40.0070.00720.42
8.3.30.0070.00720.53
8.3.20.0080.00024.18
8.3.10.0050.00324.66
8.3.00.0040.00426.16
8.2.290.0050.00420.72
8.2.280.0130.00619.00
8.2.270.0030.01417.68
8.2.260.0090.00919.00
8.2.250.0030.00619.27
8.2.240.0070.01319.30
8.2.230.0060.00322.58
8.2.220.0000.01024.06
8.2.210.0080.00026.77
8.2.200.0060.00316.75
8.2.190.0070.01017.13
8.2.180.0120.00616.75
8.2.170.0140.00719.25
8.2.160.0030.01022.96
8.2.150.0030.00625.66
8.2.140.0000.00824.66
8.2.130.0080.00026.16
8.2.120.0050.00322.45
8.2.110.0090.00022.56
8.2.100.0070.00417.97
8.2.90.0000.00818.09
8.2.80.0000.00919.41
8.2.70.0180.00079.33
8.2.60.0160.00479.33
8.2.50.0200.00079.33
8.2.40.0050.01179.33
8.2.30.0140.00379.33
8.2.20.0080.00879.33
8.2.10.0160.00079.33
8.2.00.0050.01179.33
8.1.330.0120.00716.86
8.1.320.0090.01116.36
8.1.310.0120.00617.04
8.1.300.0120.00318.03
8.1.290.0030.00618.88
8.1.280.0110.00425.92
8.1.270.0090.00024.11
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00324.04
8.1.230.0070.00421.16
8.1.220.0030.00517.91
8.1.210.0040.00419.04
8.1.200.0060.01179.33
8.1.190.0090.00979.33
8.1.180.0170.00079.33
8.1.170.0120.00479.33
8.1.160.0110.00779.33
8.1.150.0170.00079.33
8.1.140.0170.00079.33
8.1.130.0110.00679.33
8.1.120.0060.01179.33
8.1.110.0080.00879.33
8.1.100.0120.00379.33
8.1.90.0050.01179.33
8.1.80.0110.00579.33
8.1.70.0140.00379.33
8.1.60.0120.00679.33
8.1.50.0070.01279.33
8.1.40.0180.00079.33
8.1.30.0080.00879.33
8.1.20.0160.00479.33
8.1.10.0200.00079.33
8.1.00.0160.00379.33
8.0.300.0030.00520.41
8.0.290.0150.00379.33
8.0.280.0120.00779.33
8.0.270.0130.00479.33
8.0.260.0110.00779.33
8.0.250.0150.00379.33
8.0.240.0140.00379.33
8.0.230.0100.00779.33
8.0.220.0160.00079.33
8.0.210.0080.00879.33
8.0.200.0140.00379.33
8.0.190.0080.00879.33
8.0.180.0140.00379.33
8.0.170.0170.00079.33
8.0.160.0180.00479.33
8.0.150.0180.00079.33
8.0.140.0140.00379.33
8.0.130.0120.00579.33
8.0.120.0170.00079.33
8.0.110.0150.00079.33
8.0.100.0170.00079.33
8.0.90.0080.00879.33
8.0.80.0120.00279.33
8.0.70.0170.00079.33
8.0.60.0090.00979.33
8.0.50.0100.00679.33
8.0.30.0100.00779.33
8.0.20.0100.00779.33
8.0.10.0140.00479.33

preferences:
44.42 ms | 403 KiB | 5 Q