3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = <<<XML <?xml version="1.0" encoding="ISO-8859-1"?> <PersonList> <Person> <Name>Sonu Kapoor</Name> <Age>24</Age> <Gender>M</Gender> <PostalCode>54879</PostalCode> </Person> <Person> <Name>Jasmin</Name> <Age>28</Age> <Gender>M</Gender> <PostalCode>78745</PostalCode> </Person> <Person> <Name>Josef</Name> <Age>232</Age> <Gender>F</Gender> <PostalCode>53454</PostalCode> </Person> </PersonList> XML; echo phpversion(); $doc = new DOMDocument(); $doc->loadXML($content); $xp = new DOMXPath($doc); $nodeList = $xp->query('/PersonList/Person[./Name="Jasmin"]/*'); for($i = 0; $i < $nodeList->length; $i++) { $nodeName = $nodeList->item($i)->nodeName; switch ($nodeName) { case 'Age': $nodeList->item($i)->nodeValue = 33; break; case 'Gender': $nodeList->item($i)->nodeValue = 'F'; break; } } $doc->formatOutput = true; echo $doc->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)
7.1.70.0060.00317.18
7.1.60.0070.01419.32
7.1.50.0130.01016.98
7.1.00.0000.05022.61
7.0.200.0510.00315.18
7.0.140.0130.06722.20
7.0.70.0100.08021.96
7.0.60.0030.08021.90
7.0.50.0030.09022.30
7.0.40.0100.07720.29
7.0.30.0100.08320.28
7.0.20.0070.08320.27
7.0.10.0030.08320.31
7.0.00.0100.08020.25
5.6.280.0030.07721.18
5.6.220.0000.06320.71
5.6.210.0070.05020.94
5.6.200.0100.06321.30
5.6.190.0030.08321.30
5.6.180.0070.07021.21
5.6.170.0070.07021.23
5.6.160.0030.08721.18
5.6.150.0030.09021.24
5.6.140.0170.07721.20
5.6.130.0030.06321.24
5.6.120.0070.06321.19
5.6.110.0030.04721.17
5.6.100.0070.05021.20
5.6.90.0070.08321.21
5.6.80.0070.04720.59
5.6.70.0030.05320.72
5.6.60.0030.08320.64
5.6.50.0070.04320.59
5.6.40.0030.07320.59
5.6.30.0070.08020.66
5.6.20.0030.08720.57
5.6.10.0070.07720.57
5.6.00.0100.06720.50
5.5.360.0130.07720.68
5.5.350.0000.09020.58
5.5.340.0030.08320.88
5.5.330.0100.08021.13
5.5.320.0030.08320.96
5.5.310.0000.06321.08
5.5.300.0100.08021.00
5.5.290.0070.08320.97
5.5.280.0070.07321.09
5.5.270.0070.04721.04
5.5.260.0070.08321.04
5.5.250.0070.08320.89
5.5.240.0070.08020.31
5.5.230.0030.08320.46
5.5.220.0030.08320.34
5.5.210.0000.05020.49
5.5.200.0030.06020.27
5.5.190.0070.08320.40
5.5.180.0070.07720.37
5.5.160.0030.08320.41
5.5.150.0100.05720.34
5.5.140.0070.07320.24
5.5.130.0100.05320.32
5.5.120.0030.08020.23
5.5.110.0000.05320.27
5.5.100.0030.05720.32
5.5.90.0070.05320.34
5.5.80.0070.07720.23
5.5.70.0130.06720.16
5.5.60.0130.04020.34
5.5.50.0070.04020.19
5.5.40.0000.07020.20
5.5.30.0070.07720.23
5.5.20.0170.07020.25
5.5.10.0100.07320.25
5.5.00.0000.05020.18
5.4.450.0070.07719.51
5.4.440.0000.07719.59
5.4.430.0000.05319.57
5.4.420.0000.08319.72
5.4.410.0000.07319.38
5.4.400.0100.06719.11
5.4.390.0000.06319.25
5.4.380.0000.08319.31
5.4.370.0070.06719.28
5.4.360.0100.07019.25
5.4.350.0030.07019.18
5.4.340.0130.07319.41
5.4.320.0070.05719.03
5.4.310.0000.07019.20
5.4.300.0030.06019.20
5.4.290.0070.06319.09
5.4.280.0030.07319.45
5.4.270.0130.06319.02
5.4.260.0000.07719.10
5.4.250.0000.05019.24
5.4.240.0030.08019.02
5.4.230.0070.04319.25
5.4.220.0030.08019.23
5.4.210.0030.04319.24
5.4.200.0000.04018.99
5.4.190.0030.07319.02
5.4.180.0130.07019.43
5.4.170.0070.04019.02
5.4.160.0030.07719.23
5.4.150.0030.06319.43
5.4.140.0000.07716.48
5.4.130.0000.04316.64
5.4.120.0000.07716.65
5.4.110.0030.07716.55
5.4.100.0030.07316.68
5.4.90.0030.07016.55
5.4.80.0000.07716.47
5.4.70.0070.06016.63
5.4.60.0030.05016.63
5.4.50.0070.07316.60
5.4.40.0100.07016.48
5.4.30.0000.08016.64
5.4.20.0030.07016.52
5.4.10.0030.07716.57
5.4.00.0030.06016.11
5.3.290.0000.08314.80
5.3.280.0030.07714.74
5.3.270.0000.06314.80
5.3.260.0100.07014.72
5.3.250.0070.07314.73
5.3.240.0030.04714.75
5.3.230.0000.08314.73
5.3.220.0000.04314.61
5.3.210.0000.04714.79
5.3.200.0000.07314.75
5.3.190.0070.07714.69
5.3.180.0070.07314.71
5.3.170.0000.06714.60
5.3.160.0070.05314.71
5.3.150.0070.05714.62
5.3.140.0000.05314.60
5.3.130.0000.08014.69
5.3.120.0070.07714.70
5.3.110.0000.06314.75
5.3.100.0030.08014.20
5.3.90.0070.07014.07
5.3.80.0030.07714.17
5.3.70.0070.07714.14
5.3.60.0000.07714.17
5.3.50.0070.07314.09
5.3.40.0070.07014.07
5.3.30.0070.04014.12
5.3.20.0030.06713.93
5.3.10.0000.07313.80
5.3.00.0070.07313.79
5.2.170.0100.04313.44
5.2.160.0030.06713.44
5.2.150.0030.05313.44
5.2.140.0030.06313.44
5.2.130.0030.04313.44
5.2.120.0030.03713.44
5.2.110.0030.04313.44
5.2.100.0000.05713.44
5.2.90.0030.06013.44
5.2.80.0000.06313.44
5.2.70.0000.06713.44
5.2.60.0000.06013.44
5.2.50.0070.06313.44
5.2.40.0030.06313.44
5.2.30.0000.06013.44
5.2.20.0030.05713.44
5.2.10.0000.04713.44
5.2.00.0070.04013.44
5.1.60.0000.06013.44
5.1.50.0070.05013.44
5.1.40.0000.03713.44
5.1.30.0000.04313.44
5.1.20.0070.05013.44
5.1.10.0000.06013.44
5.1.00.0030.05313.44
5.0.50.0000.04013.44
5.0.40.0070.02713.44
5.0.30.0030.05013.44
5.0.20.0030.04013.44
5.0.10.0070.02713.44
5.0.00.0030.06713.44
4.4.90.0070.02313.44
4.4.80.0000.03713.44
4.4.70.0030.03713.44
4.4.60.0030.03013.44
4.4.50.0030.02313.44
4.4.40.0030.04313.44
4.4.30.0000.04013.44
4.4.20.0000.03013.44
4.4.10.0000.03713.44
4.4.00.0030.05013.44
4.3.110.0000.03713.44
4.3.100.0000.03713.44
4.3.90.0000.03013.44
4.3.80.0000.04313.44
4.3.70.0030.03713.44
4.3.60.0000.03713.44
4.3.50.0000.03313.44
4.3.40.0030.05013.44
4.3.30.0000.02713.44
4.3.20.0000.04013.44
4.3.10.0000.03713.44
4.3.00.0000.03713.44

preferences:
39.35 ms | 401 KiB | 5 Q