3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = '<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:getBundles"> <soapenv:Header> <soapenv:Body> <urn:getBundles soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <request xsi:type="urn:getBundlesRequest" xmlns:urn="urn:SelfcareWebservice"> <userid>hexa</userid> <password>hexa123</password> <requestid>000</requestid> <msisdn>60182003838</msisdn> <productname xsi:type="xsd:string"></productname> <bundlename xsi:type="xsd:string"></bundlename> </request> </urn:getBundles> </soapenv:Body> </soapenv:Envelope>'; $sxe = new SimpleXMLElement($xml); // Define some short identifiers for namespaces without relying on their prefix in the XML define('NS_ENV', 'http://schemas.xmlsoap.org/soap/envelope/'); define('NS_SFORCE', 'getBundlesResponse'); // $sxe already represents the soapenv:Envelope node, so we don't need to mention that $result = $sxe->children(NS_ENV)->Body->children(NS_SFORCE)->loginResponse->result->serverUrl; echo $result;
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: SimpleXMLElement::__construct(): Entity: line 15: parser error : Opening and ending tag mismatch: Header line 2 and Envelope in /in/5lDQK on line 17 Warning: SimpleXMLElement::__construct(): </soapenv:Envelope> in /in/5lDQK on line 17 Warning: SimpleXMLElement::__construct(): ^ in /in/5lDQK on line 17 Warning: SimpleXMLElement::__construct(): Entity: line 15: parser error : Premature end of data in tag Envelope line 1 in /in/5lDQK on line 17 Warning: SimpleXMLElement::__construct(): </soapenv:Envelope> in /in/5lDQK on line 17 Warning: SimpleXMLElement::__construct(): ^ in /in/5lDQK on line 17 Fatal error: Uncaught Exception: String could not be parsed as XML in /in/5lDQK:17 Stack trace: #0 /in/5lDQK(17): SimpleXMLElement->__construct('<soapenv:Envelo...') #1 {main} thrown in /in/5lDQK on line 17
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.36, 5.6.0 - 5.6.28
Warning: SimpleXMLElement::__construct(): Entity: line 15: parser error : Opening and ending tag mismatch: Header line 2 and Envelope in /in/5lDQK on line 17 Warning: SimpleXMLElement::__construct(): </soapenv:Envelope> in /in/5lDQK on line 17 Warning: SimpleXMLElement::__construct(): ^ in /in/5lDQK on line 17 Warning: SimpleXMLElement::__construct(): Entity: line 15: parser error : Premature end of data in tag Envelope line 1 in /in/5lDQK on line 17 Warning: SimpleXMLElement::__construct(): </soapenv:Envelope> in /in/5lDQK on line 17 Warning: SimpleXMLElement::__construct(): ^ in /in/5lDQK on line 17 Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /in/5lDQK:17 Stack trace: #0 /in/5lDQK(17): SimpleXMLElement->__construct('<soapenv:Envelo...') #1 {main} thrown in /in/5lDQK on line 17
Process exited with code 255.
Output for 5.0.3 - 5.0.5
Warning: Entity: line 15: parser error : Opening and ending tag mismatch: Header line 2 and Envelope in /in/5lDQK on line 17 Warning: </soapenv:Envelope> in /in/5lDQK on line 17 Warning: ^ in /in/5lDQK on line 17 Warning: Entity: line 15: parser error : Premature end of data in tag Envelope line 1 in /in/5lDQK on line 17 Warning: </soapenv:Envelope> in /in/5lDQK on line 17 Warning: ^ in /in/5lDQK on line 17 Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /in/5lDQK:17 Stack trace: #0 /in/5lDQK(17): SimpleXMLElement->__construct('<soapenv:Envelo...') #1 {main} thrown in /in/5lDQK on line 17
Process exited with code 255.
Output for 5.0.0 - 5.0.2
Warning: Entity: line 15: parser error : Opening and ending tag mismatch: Header line 2 and Envelope in /in/5lDQK on line 17 Warning: </soapenv:Envelope> in /in/5lDQK on line 17 Warning: ^ in /in/5lDQK on line 17 Warning: Entity: line 15: parser error : Premature end of data in tag Envelope line 1 in /in/5lDQK on line 17 Warning: </soapenv:Envelope> in /in/5lDQK on line 17 Warning: ^ in /in/5lDQK on line 17 Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /in/5lDQK:17 Stack trace: #0 {main} thrown in /in/5lDQK on line 17
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/5lDQK on line 24
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/5lDQK on line 24
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/5lDQK on line 24
Process exited with code 255.

preferences:
226.33 ms | 401 KiB | 349 Q