3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<'XML' <?xml version="1.0"?> <books> <book> <isbn>123456789098</isbn> <title>Harry Potter</title> <author>J K. Rowling</author> <edition>2005</edition> </book> <book> <placeItHere></placeItHere> <isbn>1</isbn> <title>stuffs</title> <author>DA</author> <edition>2014</edition> </book> </books> XML; $book = [ 'isbn' => 123456789099, 'title' => 'Harry & Potter 3', 'author' => 'J K. Rowling', 'edition' => '2007' ]; $dom = new DOMDocument(); $dom->formatOutput = true; $dom->preserveWhiteSpace = false; $dom->loadXML($xml); $xpath = new DOMXPath($dom); $placeItHere = $xpath->query('/books/book/placeItHere')->item(0); $newBook = $placeItHere->appendChild($dom->createElement('book')); foreach ($book as $part => $value) { $element = $newBook->appendChild($dom->createElement($part, $value)); } echo $dom->saveXML();

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.0110.00417.38
8.3.50.0120.00620.38
8.3.40.0070.00719.48
8.3.30.0070.00719.67
8.3.20.0040.00420.84
8.3.10.0050.00320.91
8.3.00.0060.00321.27
8.2.180.0130.00619.16
8.2.170.0150.00322.96
8.2.160.0110.00321.00
8.2.150.0050.00324.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0090.00019.98
8.2.110.0030.00621.35
8.2.100.0070.00418.16
8.2.90.0000.00819.64
8.2.80.0000.00818.43
8.2.70.0060.00317.88
8.2.60.0040.00418.15
8.2.50.0050.00318.10
8.2.40.0070.00020.92
8.2.30.0040.00419.77
8.2.20.0050.00318.06
8.2.10.0000.00718.50
8.2.00.0030.00618.20
8.1.280.0030.01625.92
8.1.270.0090.00624.29
8.1.260.0050.00326.35
8.1.250.0000.00828.09
8.1.240.0030.00721.68
8.1.230.0090.00318.02
8.1.220.0050.00318.16
8.1.210.0080.00018.77
8.1.200.0040.00417.72
8.1.190.0050.00317.60
8.1.180.0030.00518.10
8.1.170.0060.00319.01
8.1.160.0040.00422.55
8.1.150.0070.00019.36
8.1.140.0000.00917.82
8.1.130.0030.00518.23
8.1.120.0000.00817.92
8.1.110.0040.00417.95
8.1.100.0070.00017.71
8.1.90.0040.00417.77
8.1.80.0040.00417.87
8.1.70.0040.00417.86
8.1.60.0080.00018.06
8.1.50.0050.00317.83
8.1.40.0040.00817.89
8.1.30.0000.00817.82
8.1.20.0040.00418.15
8.1.10.0040.00417.83
8.1.00.0030.00618.02
8.0.300.0030.00618.77
8.0.290.0000.00817.13
8.0.280.0000.00718.89
8.0.270.0000.00717.73
8.0.260.0030.00317.63
8.0.250.0070.00017.24
8.0.240.0030.00517.39
8.0.230.0070.00017.23
8.0.220.0040.00417.22
8.0.210.0070.00017.22
8.0.200.0030.00317.27
8.0.190.0080.00017.49
8.0.180.0040.00417.47
8.0.170.0080.00017.45
8.0.160.0000.00717.32
8.0.150.0000.00817.17
8.0.140.0030.00717.38
8.0.130.0000.00913.80
8.0.120.0030.00617.39
8.0.110.0000.00817.44
8.0.100.0030.00517.30
8.0.90.0080.00017.26
8.0.80.0100.01017.39
8.0.70.0040.00417.24
8.0.60.0000.00817.25
8.0.50.0030.00617.25
8.0.30.0100.01017.30
8.0.20.0090.01317.60
8.0.10.0040.00417.56
8.0.00.0070.01117.29
7.4.330.0030.00315.43
7.4.320.0000.00716.69
7.4.300.0000.00616.88
7.4.290.0040.00416.70
7.4.280.0040.00417.03
7.4.270.0040.00416.88
7.4.260.0030.00316.86
7.4.250.0040.00416.91
7.4.240.0040.00316.90
7.4.230.0030.00516.91
7.4.220.0060.01216.97
7.4.210.0060.00917.11
7.4.200.0040.00416.92
7.4.160.0080.00816.86
7.4.150.0120.01217.40
7.4.140.0090.00917.86
7.4.130.0130.00517.03
7.4.120.0140.00416.77
7.4.110.0090.01216.98
7.4.100.0120.01216.86
7.4.90.0120.00616.87
7.4.80.0080.01119.39
7.4.70.0070.01016.85
7.4.60.0100.00616.94
7.4.50.0000.00517.04
7.4.40.0070.01116.85
7.4.30.0100.00717.12
7.4.00.0060.00915.22
7.3.330.0030.00313.55
7.3.320.0000.00513.70
7.3.310.0000.00716.48
7.3.300.0070.00016.88
7.3.290.0050.01116.74
7.3.280.0070.01016.79
7.3.270.0110.00717.40
7.3.260.0100.00917.05
7.3.250.0070.01016.92
7.3.240.0110.00517.03
7.3.230.0120.01216.82
7.3.210.0040.01416.77
7.3.200.0060.01619.39
7.3.190.0070.01116.67
7.3.180.0000.01516.80
7.3.170.0170.00016.94
7.3.160.0130.01016.73
7.2.330.0090.00917.02
7.2.320.0100.00716.91
7.2.310.0100.01317.05
7.2.300.0090.00817.01
7.2.290.0100.00716.89
7.2.00.0000.01319.56
7.1.100.0070.00718.22
7.1.70.0040.00417.43
7.1.60.0110.01419.34
7.1.50.0000.01617.04
7.1.00.0030.07722.63
7.0.200.0120.00017.11
7.0.140.0070.03022.23
7.0.60.0000.09320.20
7.0.50.0070.07018.11
7.0.40.0130.08320.59
7.0.30.0130.05020.36
7.0.20.0300.04720.48
7.0.10.0300.06720.41
7.0.00.0100.05020.48
5.6.280.0070.06321.33
5.6.210.0100.07720.79
5.6.200.0030.04018.50
5.6.190.0070.05020.89
5.6.180.0370.07020.49
5.6.170.0370.06320.55
5.6.160.0030.08320.76
5.6.150.0130.03318.37
5.6.140.0130.05018.39
5.6.130.0000.06718.27
5.6.120.0170.07021.26
5.6.110.0070.06721.25
5.6.100.0070.04321.30
5.6.90.0030.08021.19
5.6.80.0100.07720.67
5.6.70.4400.04320.69
5.5.350.0030.08720.56
5.5.340.0030.08318.14
5.5.330.0070.07320.64
5.5.320.0270.05020.47
5.5.310.0230.04720.50
5.5.300.0070.04018.25
5.5.290.0100.05018.25
5.5.280.0000.05720.97
5.5.270.0100.08020.95
5.5.260.0100.08021.05
5.5.250.0100.03320.95
5.5.240.0030.04320.36
5.4.450.0330.04337.84
5.4.440.0470.04337.83
5.4.430.0200.05037.83
5.4.420.0300.03737.83
5.4.410.0230.05337.77
5.4.400.0200.03035.77
5.4.390.0570.03333.82
5.4.380.0470.04332.09
5.4.370.0430.04330.13
5.4.360.0470.05329.28
5.4.350.0330.04314.06
5.4.340.0200.05013.95
5.4.320.0330.04714.55
5.4.310.0230.05314.55
5.4.300.0270.05314.36
5.4.290.0270.05314.46
5.4.280.0470.03714.29
5.4.270.0300.05314.48
5.4.260.0200.05014.32
5.4.250.0170.05014.47
5.4.240.0230.04014.44
5.4.230.0370.05014.30
5.4.220.0130.06014.44
5.4.210.0170.05314.46
5.4.200.0300.04314.32
5.4.190.0230.03714.35
5.4.180.0170.04314.29
5.4.170.0200.03714.30
5.4.160.0100.04714.43
5.4.150.0130.05014.34
5.4.140.0230.05014.16
5.4.130.0230.05014.13
5.4.120.0230.05014.06
5.4.110.0370.04013.93
5.4.100.0430.04314.07
5.4.90.0300.05013.93
5.4.80.0270.05013.92
5.4.70.0270.04013.94
5.4.60.0070.04713.94
5.4.50.0170.03313.93
5.4.40.0100.04013.96
5.4.30.0100.04313.91
5.4.20.0000.05314.03
5.4.10.0030.04313.98
5.4.00.0070.05013.48
5.3.290.0130.04714.71
5.3.280.0230.04714.49
5.3.270.0270.05014.50
5.3.260.0270.06714.62
5.3.250.0200.04314.60
5.3.240.0170.05714.48
5.3.230.0100.04714.63
5.3.220.0300.03314.48
5.3.210.0270.03714.46
5.3.200.0230.04314.44
5.3.190.0200.04014.60
5.3.180.0270.05014.60
5.3.170.0470.05314.45
5.3.160.0300.05014.48
5.3.150.0370.04314.40
5.3.140.0470.05014.59
5.3.130.0370.04314.45
5.3.120.0270.04714.61
5.3.110.0130.05714.44
5.3.100.0200.04713.97
5.3.90.0130.04313.91
5.3.80.0200.04013.86
5.3.70.0230.03013.91
5.3.60.0170.03713.91
5.3.50.0070.04313.86
5.3.40.0170.03713.80
5.3.30.0170.03313.82
5.3.20.0170.03713.68
5.3.10.0170.03713.49
5.3.00.0270.02713.59
5.2.170.0100.03311.14
5.2.160.0070.04310.98
5.2.150.0130.03311.23
5.2.140.0230.02711.12
5.2.130.0130.02711.10
5.2.120.0200.02710.94
5.2.110.0130.03310.98
5.2.100.0170.03011.01
5.2.90.0270.03711.08
5.2.80.0170.05311.01
5.2.70.0230.03711.05
5.2.60.0070.03711.05
5.2.50.0270.02010.90
5.2.40.0170.03010.98
5.2.30.0130.03310.92
5.2.20.0070.03710.83
5.2.10.0100.03010.85
5.2.00.0130.04010.63
5.1.60.0100.0339.98
5.1.50.0170.03010.07
5.1.40.0070.0379.93
5.1.30.0130.04010.24
5.1.20.0130.03010.38
5.1.10.0230.03310.02
5.1.00.0130.03710.18
5.0.50.0030.0308.57
5.0.40.0070.0308.42
5.0.30.0030.0408.25
5.0.20.0070.0238.16
5.0.10.0100.0208.19
5.0.00.0000.0378.19
4.4.90.0030.0205.82
4.4.80.0030.0235.83
4.4.70.0000.0275.92
4.4.60.0070.0205.83
4.4.50.0070.0205.88
4.4.40.0070.0305.78
4.4.30.0070.0235.88
4.4.20.0000.0235.88
4.4.10.0070.0205.89
4.4.00.0130.0205.86
4.3.110.0030.0205.77
4.3.100.0100.0175.71
4.3.90.0030.0205.78
4.3.80.0100.0235.75
4.3.70.0070.0175.83
4.3.60.0100.0135.75
4.3.50.0130.0135.73
4.3.40.0000.0375.77
4.3.30.0070.0204.46
4.3.20.0030.0174.50
4.3.10.0030.0174.54
4.3.00.0030.01728.21

preferences:
39.95 ms | 400 KiB | 5 Q