3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = '<user><prop name="A"><sub name="X"></sub></prop><prop name="B"><sub name="Y"></sub></prop></user>'; $xml = new DomDocument; $xml->loadXML($data); $xpath = new DomXpath($xml); $subY = $xpath->query('//sub[@name="Y"]'); foreach( $subY as $subY ){ $design = $xml->createElement('design'); $design->setAttribute('name', 'J'); $design->setAttribute('path', 'folder'); $subY->appendChild($design); } $xml->formatOutput = true; $xml->preserveWhiteSpace = fals echo $xml->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)
5.4.200.0160.04612.37
5.4.190.0370.08412.37
5.4.180.0180.04412.36
5.4.170.0170.04512.37
5.4.160.0230.07312.37
5.4.150.0250.03912.36
5.4.140.0200.04312.06
5.4.130.0210.03912.04
5.4.120.0150.04212.00
5.4.110.0140.04312.00
5.4.100.0130.04812.00
5.4.90.0230.03912.00
5.4.80.0190.04212.00
5.4.70.0250.06411.99
5.4.60.0220.03811.99
5.4.50.0160.04211.99
5.4.40.0130.04811.98
5.4.30.0180.04011.98
5.4.20.0270.03811.97
5.4.10.0140.04211.98
5.4.00.0170.04611.47
5.3.270.0180.04512.72
5.3.260.0160.04512.72
5.3.250.0220.04112.72
5.3.240.0200.04012.72
5.3.230.0150.04712.71
5.3.220.0160.04412.68
5.3.210.0180.04412.68
5.3.200.0120.04812.68
5.3.190.0230.04512.68
5.3.180.0170.04512.68
5.3.170.0180.04312.67
5.3.160.0200.04012.67
5.3.150.0200.04112.67
5.3.140.0160.04412.66
5.3.130.0140.04912.66
5.3.120.0260.06812.66
5.3.110.0210.04112.66
5.3.100.0140.04712.12
5.3.90.0120.05012.08
5.3.80.0210.04312.08
5.3.70.0150.04512.07
5.3.60.0190.04212.06
5.3.50.0150.04412.00
5.3.40.0180.04312.00
5.3.30.0160.04211.94
5.3.20.0270.06411.71
5.3.10.0220.03911.68
5.3.00.0110.04611.66

preferences:
142.06 ms | 1394 KiB | 7 Q