3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyDOMDocument extends DOMDocument { const HTML_EXPORT_CHILDREN = 1; public function saveHTML($node = null, $flags = 0) { $result = ''; if ($node === null) { $node = $this->documentElement; } if ($flags & self::HTML_EXPORT_CHILDREN) { foreach ($node->childNodes as $child) { $result .= parent::saveHTML($child); } } else { $result = parent::saveHTML($node); } return $result; } } $html = <<<HTML <div>hello</div> <div>world</div> HTML; $doc = new DOMDocument; $doc->loadHTML($html); $frag = $doc->createDocumentFragment(); $body = $doc->getElementsByTagName('body')->item(0); while ($body->firstChild) { $frag->appendChild($body->removeChild($body->firstChild)); } echo $doc->saveHTML() . "\n"; echo $doc->saveHTML($frag);

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.0180.00016.88
8.3.50.0120.00523.01
8.3.40.0110.00418.92
8.3.30.0060.00919.17
8.3.20.0040.00420.41
8.3.10.0000.00723.94
8.3.00.0030.00617.71
8.2.180.0090.00616.88
8.2.170.0120.00622.96
8.2.160.0070.00720.77
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0000.00826.16
8.2.120.0050.00321.17
8.2.110.0050.00522.38
8.2.100.0120.00021.22
8.2.90.0000.00817.75
8.2.80.0040.00418.91
8.2.70.0050.00318.29
8.2.60.0000.00817.75
8.2.50.0000.00817.88
8.2.40.0030.00618.00
8.2.30.0030.00618.00
8.2.20.0000.00817.88
8.2.10.0040.00418.31
8.2.00.0040.00417.92
8.1.280.0100.00725.92
8.1.270.0080.00024.15
8.1.260.0000.00726.35
8.1.250.0000.00728.09
8.1.240.0060.00324.08
8.1.230.0040.00719.41
8.1.220.0030.00518.04
8.1.210.0020.00718.77
8.1.200.0080.00017.72
8.1.190.0000.00917.48
8.1.180.0060.00618.10
8.1.170.0000.00817.62
8.1.160.0000.00819.13
8.1.150.0000.00819.21
8.1.140.0070.00017.72
8.1.130.0040.00417.64
8.1.120.0000.00717.77
8.1.110.0040.00417.66
8.1.100.0000.00717.71
8.1.90.0000.00717.65
8.1.80.0030.00317.76
8.1.70.0060.00317.66
8.1.60.0030.00517.92
8.1.50.0040.00417.71
8.1.40.0030.00517.81
8.1.30.0040.00417.88
8.1.20.0000.00817.86
8.1.10.0030.00617.88
8.1.00.0050.00317.72
8.0.300.0030.00518.77
8.0.290.0040.00417.13
8.0.280.0040.00418.22
8.0.270.0030.00318.23
8.0.260.0030.00317.04
8.0.250.0000.00717.24
8.0.240.0030.00517.30
8.0.230.0070.00017.14
8.0.220.0060.00317.26
8.0.210.0030.00517.14
8.0.200.0000.00717.29
8.0.190.0050.00317.27
8.0.180.0000.00717.20
8.0.170.0070.00017.25
8.0.160.0000.00717.25
8.0.150.0070.00017.13
8.0.140.0030.00517.10
8.0.130.0060.00313.58
8.0.120.0040.00417.14
8.0.110.0080.00017.14
8.0.100.0050.00317.21
8.0.90.0000.00717.12
8.0.80.0030.01917.03
8.0.70.0030.00517.11
8.0.60.0000.00716.92
8.0.50.0020.00516.91
8.0.30.0100.01017.48
8.0.20.0120.00917.44
8.0.10.0070.00017.12
8.0.00.0100.00716.92
7.4.330.0000.00615.17
7.4.320.0040.00416.77
7.4.300.0030.00316.83
7.4.290.0000.00716.88
7.4.280.0070.00016.70
7.4.270.0000.00816.73
7.4.260.0070.00316.85
7.4.250.0000.00816.82
7.4.240.0020.00516.65
7.4.230.0050.00316.97
7.4.220.0120.00716.89
7.4.210.0000.01616.95
7.4.200.0000.00716.75
7.4.160.0080.00816.62
7.4.150.0140.00417.40
7.4.140.0060.01217.86
7.4.130.0100.00716.86
7.4.120.0090.00816.85
7.4.110.0100.00716.44
7.4.100.0210.00016.81
7.4.90.0040.01416.73
7.4.80.0120.00919.39
7.4.70.0060.01616.84
7.4.60.0070.01616.66
7.4.50.0040.00416.83
7.4.40.0110.00716.96
7.4.30.0080.00816.91
7.4.00.0100.00915.11
7.3.330.0000.00613.50
7.3.320.0000.00613.57
7.3.310.0070.00016.59
7.3.300.0000.00716.40
7.3.290.0110.00416.62
7.3.280.0120.00516.60
7.3.270.0120.00617.40
7.3.260.0080.01016.85
7.3.250.0120.00816.68
7.3.240.0150.00616.84
7.3.230.0060.00916.58
7.3.210.0130.00317.05
7.3.200.0070.01419.39
7.3.190.0030.02016.77
7.3.180.0130.00316.61
7.3.170.0130.00916.71
7.3.160.0080.00816.57
7.3.120.0040.01214.99
7.3.110.0040.01114.92
7.3.100.0070.00715.33
7.3.90.0040.01415.02
7.3.80.0070.00714.91
7.3.70.0070.01015.02
7.3.60.0060.00314.60
7.3.50.0040.01114.95
7.3.40.0030.00614.94
7.3.30.0060.00314.72
7.3.20.0030.00916.70
7.3.10.0080.00516.63
7.3.00.0030.01016.63
7.2.330.0100.00817.11
7.2.320.0090.00916.83
7.2.310.0030.01316.55
7.2.300.0170.00016.92
7.2.290.0160.00616.77
7.2.250.0090.00915.05
7.2.240.0090.00915.01
7.2.230.0030.00914.99
7.2.220.0030.01515.34
7.2.210.0040.00814.85
7.2.200.0030.01315.26
7.2.190.0070.00314.98
7.2.180.0030.01415.11
7.2.170.0000.01715.15
7.2.130.0030.00917.02
7.2.120.0030.00717.04
7.2.110.0070.00716.82
7.2.100.0080.00817.13
7.2.90.0060.00917.07
7.2.80.0060.00317.14
7.2.70.0110.00017.12
7.2.60.0000.01117.02
7.2.50.0000.00917.16
7.2.40.0030.00916.87
7.2.30.0030.00917.18
7.2.20.0030.00616.79
7.2.10.0120.00617.04
7.2.00.0060.00718.31
7.1.330.0070.01115.92
7.1.320.0080.00616.12
7.1.310.0030.01015.86
7.1.300.0110.00415.59
7.1.290.0040.00815.68
7.1.280.0030.01015.99
7.1.270.0090.00615.82
7.1.260.0060.00615.80
7.1.250.0080.00415.86
7.1.100.0080.00318.19
7.1.70.0040.00417.26
7.1.60.0100.01419.40
7.1.50.0040.00817.08
7.1.00.0070.07322.38
7.0.200.0030.00516.77
7.0.140.0030.07022.12
7.0.60.0130.05719.87
7.0.50.0100.04718.04
7.0.40.0000.07020.13
7.0.30.0330.08020.23
7.0.20.0230.06720.13
7.0.10.0030.09020.25
7.0.00.0130.08020.15
5.6.210.0030.09020.76
5.6.200.0100.04018.25
5.6.190.0030.05720.41
5.6.180.0200.08020.70
5.6.170.0230.07320.56
5.6.160.0030.08320.63
5.6.150.0000.04318.21
5.6.140.0100.07718.26
5.6.130.0030.04018.23
5.6.120.0070.08321.06
5.6.110.0100.08721.16
5.6.100.0170.07321.06
5.6.90.0130.08321.07
5.6.80.0100.06720.48
5.5.350.0000.08020.50
5.5.340.0100.04718.11
5.5.330.0100.06320.54
5.5.320.0330.07020.31
5.5.310.0100.04720.43
5.5.300.0130.03717.99
5.5.290.0000.09018.02
5.5.280.0030.06721.04
5.5.270.0030.09320.97
5.5.260.0130.07721.05
5.5.250.0130.07320.77
5.5.240.0300.06720.20
5.4.450.0030.08019.72
5.4.440.0030.04019.49
5.4.430.0030.06019.39
5.4.420.0070.08719.64
5.4.410.0100.07019.50
5.4.400.0000.08019.30
5.4.390.0030.05719.16
5.4.380.0100.07319.24
5.4.370.0030.06719.14
5.4.360.0070.07719.21
5.4.350.0070.07719.14
5.4.340.0000.04019.32
5.4.320.0030.04319.29
5.4.310.0100.07019.13
5.4.300.0030.08019.38
5.4.290.0000.06319.13
5.4.280.0070.05718.99
5.4.270.0070.07019.14
5.4.260.0070.03719.33
5.4.250.0000.08019.02
5.4.240.0070.07719.20
5.4.230.0030.05719.27
5.4.220.0100.06719.16
5.4.210.0030.04719.29
5.4.200.0070.05719.16
5.4.190.0030.07719.38
5.4.180.0030.07019.03
5.4.170.0000.04019.21
5.4.160.0030.04719.14
5.4.150.0130.07019.25
5.4.140.0070.06316.51
5.4.130.0030.07016.63
5.4.120.0100.06316.47
5.4.110.0000.07716.50
5.4.100.0000.06716.58
5.4.90.0000.07316.70
5.4.80.0000.07316.36
5.4.70.0000.07016.46
5.4.60.0000.05716.66
5.4.50.0100.06716.38
5.4.40.0000.07716.37
5.4.30.0030.07016.66
5.4.20.0000.06716.47
5.4.10.0100.05316.64
5.4.00.0070.07016.02
5.3.290.0030.04014.82
5.3.280.0000.06014.61
5.3.270.0070.04314.77
5.3.260.0100.07014.61
5.3.250.0030.04314.62
5.3.240.0030.06014.92
5.3.230.0030.04314.62
5.3.220.0030.07714.63
5.3.210.0000.08714.65
5.3.200.0000.08014.74
5.3.190.0000.07714.58
5.3.180.0070.06714.57
5.3.170.0000.04714.65
5.3.160.0070.07314.64
5.3.150.0030.05314.84
5.3.140.0000.05714.83
5.3.130.0100.07314.82
5.3.120.0000.05714.71
5.3.110.0070.06314.74
5.3.100.0030.06714.09
5.3.90.0070.06714.15
5.3.80.0070.06014.20
5.3.70.0000.07714.02
5.3.60.0000.04714.12
5.3.50.0070.07014.12
5.3.40.0000.07313.96
5.3.30.0030.05713.98
5.3.20.0000.07013.95
5.3.10.0030.04713.84
5.3.00.0030.05313.95
5.2.170.0030.05011.87
5.2.160.0070.03011.87
5.2.150.0070.06311.87
5.2.140.0030.06011.87
5.2.130.0030.05011.87
5.2.120.0000.06711.87
5.2.110.0030.04311.87
5.2.100.0030.05311.87
5.2.90.0030.04011.87
5.2.80.0030.03711.87
5.2.70.0070.02311.87
5.2.60.0000.05711.87
5.2.50.0130.02311.87
5.2.40.0000.04011.87
5.2.30.0000.03311.87
5.2.20.0030.03011.87
5.2.10.0000.03311.87
5.2.00.0030.02711.87
5.1.60.0000.02311.87
5.1.50.0000.02711.87
5.1.40.0000.02311.87
5.1.30.0000.02711.87
5.1.20.0000.02711.87
5.1.10.0070.02011.87
5.1.00.0030.02011.87
5.0.50.0000.02011.87
5.0.40.0000.02011.87
5.0.30.0000.03011.87
5.0.20.0030.01711.87
5.0.10.0000.02011.87
5.0.00.0000.03311.87
4.4.90.0070.03011.87
4.4.80.0030.03011.87
4.4.70.0070.01011.87
4.4.60.0000.02311.87
4.4.50.0000.01711.87
4.4.40.0070.02011.87
4.4.30.0000.01311.87
4.4.20.0000.01311.87
4.4.10.0000.01711.87
4.4.00.0000.02311.87
4.3.110.0000.01311.87
4.3.100.0030.01011.87
4.3.90.0000.01311.87
4.3.80.0000.02711.87
4.3.70.0000.01311.87
4.3.60.0000.01711.87
4.3.50.0000.01311.87
4.3.40.0030.02011.87
4.3.30.0030.01311.87
4.3.20.0000.01711.87
4.3.10.0000.01311.87
4.3.00.0000.02311.87

preferences:
60.24 ms | 401 KiB | 5 Q