3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '<?xml version="1.0" encoding="UTF-8"?><ns3:entDocumentResponse xmlns="http://domain.com/dictionary/technical/" xmlns:ns2="http://domain.com/services/entityService/document/GetContentUrl_1_0" xmlns:ns3="http://domain.com/services/entityService/document/1.0"> <activities/> <ns3:response> <ns3:opGetContentUrl_1_0> <ns2:documentContentUrl>https://server.domain.com/ACS/servlet/someUrl</ns2:documentContentUrl> </ns3:opGetContentUrl_1_0> </ns3:response> </ns3:entDocumentResponse>'; // situation 1 $xml = new \DOMDocument(); $xml->loadXML($str); $xpath = new \DOMXPath($xml, false); $xpath->registerNamespace('ns3', 'http://domain.com/services/entityService/document/1.0'); $xpath->registerNamespace('ns2', 'http://domain.com/services/entityService/document/GetContentUrl_1_0'); $res = $xpath->evaluate('/ns3:entDocumentResponse/ns3:response/ns3:opGetContentUrl_1_0/ns2:documentContentUrl'); if ($res instanceof \DOMNodeList && $res->length > 0) echo '[1] ', $res->item(0)->nodeValue, "\n"; else echo '[1] ', 'Not parsed for situation 1.', "\n"; // situation 2 $xml2 = new \DOMDocument(); $xml2->loadXML($str); $xpath2 = new \DOMXPath($xml2, false); $xpath2->registerNamespace('ns2', 'http://domain.com/services/entityService/document/1.0'); $xpath2->registerNamespace('ns3', 'http://domain.com/services/entityService/document/GetContentUrl_1_0'); $res = $xpath2->evaluate('/ns2:entDocumentResponse/ns2:response/ns2:opGetContentUrl_1_0/ns3:documentContentUrl'); if ($res instanceof \DOMNodeList && $res->length > 0) echo '[2] ', $res->item(0)->nodeValue, "\n"; else echo '[2] ', 'Not parsed for situation 2.', "\n"; // situation 3 $xml3 = new \DOMDocument(); $xml3->loadXML($str); $xpath3 = new \DOMXPath($xml3, false); $xpath3->registerNamespace('a', 'http://domain.com/services/entityService/document/1.0'); $xpath3->registerNamespace('b', 'http://domain.com/services/entityService/document/GetContentUrl_1_0'); $res = $xpath3->evaluate('/a:entDocumentResponse/a:response/a:opGetContentUrl_1_0/b:documentContentUrl'); if ($res instanceof \DOMNodeList && $res->length > 0) echo '[3] ', $res->item(0)->nodeValue, "\n"; else echo '[3] ', 'Not parsed for situation 3.', "\n";

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.00.0130.01020.03
8.4.150.0020.00014.05
8.4.140.0090.01217.82
8.4.130.0120.00718.27
8.4.120.0070.00620.97
8.4.110.0040.00418.98
8.4.100.0030.00618.32
8.4.90.0040.00419.82
8.4.80.0030.00618.41
8.4.70.0430.00818.35
8.4.60.0370.01117.93
8.4.50.0360.01218.07
8.4.40.0370.01217.95
8.4.30.0310.01217.90
8.4.20.0390.00918.06
8.4.10.0410.00717.94
8.3.280.0020.00014.05
8.3.270.0140.00716.89
8.3.260.0100.01016.91
8.3.250.0020.00619.25
8.3.240.0120.00716.96
8.3.230.0110.00816.86
8.3.220.0110.00817.01
8.3.210.0340.00816.77
8.3.200.0400.00816.86
8.3.190.0380.01016.57
8.3.180.0380.00816.82
8.3.170.0340.00716.58
8.3.160.0310.00817.11
8.3.150.0360.00817.16
8.3.140.0410.00717.07
8.3.130.0310.00917.21
8.3.120.0350.00717.10
8.3.110.0360.00716.74
8.3.100.0390.00816.65
8.3.90.0360.01016.90
8.3.80.0370.01117.12
8.3.70.0370.01017.00
8.3.60.0410.00716.88
8.3.50.0360.01216.93
8.3.40.0380.01017.79
8.3.30.0350.00817.75
8.3.20.0320.00917.63
8.3.10.0330.00517.93
8.3.00.0300.00917.87
8.2.290.0100.00919.12
8.2.280.0260.00616.84
8.2.270.0280.01017.13
8.2.260.0330.00717.20
8.2.250.0330.00617.05
8.2.240.0340.01116.88
8.2.230.0300.00917.16
8.2.220.0310.00916.77
8.2.210.0320.00817.03
8.2.200.0370.01116.54
8.2.190.0340.00717.18
8.2.180.0300.01117.05
8.2.170.0370.00618.19
8.2.160.0320.01018.16
8.2.150.0220.00418.14
8.2.140.0270.01018.11
8.2.130.0300.00917.81
8.2.120.0370.00917.94
8.2.110.0290.01418.21
8.2.100.0240.01217.95
8.2.90.0320.01018.08
8.2.80.0360.00618.08
8.2.70.0280.00818.16
8.2.60.0230.00217.93
8.2.50.0150.00218.18
8.2.40.0480.00417.80
8.2.30.0270.00918.11
8.2.20.0400.00918.11
8.2.10.0240.00818.17
8.2.00.0270.00618.06

preferences:
34.43 ms | 403 KiB | 5 Q