3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '<?xml version="1.0" encoding="UTF-8"?> <sv:node xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:rep="internal"> <sv:property sv:name="jcr:created" sv:type="date" sv:multi-valued="0"> <sv:value>2013-11-11T14:50:35+01:00</sv:value> </sv:property> <sv:property sv:name="jcr:created" sv:type="date" sv:multi-valued="0"> <sv:value>2014-11-11T14:50:35+01:00</sv:value> </sv:property> <sv:property sv:name="jcr:created" sv:type="date" sv:multi-valued="0"> <sv:value>2015-11-11T14:50:35+01:00</sv:value> </sv:property> </sv:node>'; $expression = '//*[text()="2014-11-11T14:50:35+01:00"]'; $dom = new \DOMDocument('1.0', 'UTF-8'); $dom->loadXML($string); $xpath = new \DOMXPath($dom); $r = $xpath->evaluate($expression); var_dump($r); var_dump($r->item(0));
Output for 8.3.0 - 8.3.6
object(DOMNodeList)#4 (1) { ["length"]=> int(1) } object(DOMElement)#3 (27) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(8) "sv:value" ["className"]=> string(0) "" ["id"]=> string(0) "" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> NULL ["nextElementSibling"]=> NULL ["nodeName"]=> string(8) "sv:value" ["nodeValue"]=> string(25) "2014-11-11T14:50:35+01:00" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["parentElement"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["isConnected"]=> bool(true) ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> string(29) "http://www.jcp.org/jcr/sv/1.0" ["prefix"]=> string(2) "sv" ["localName"]=> string(5) "value" ["baseURI"]=> string(1) "/" ["textContent"]=> string(25) "2014-11-11T14:50:35+01:00" }
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
object(DOMNodeList)#4 (1) { ["length"]=> int(1) } object(DOMElement)#3 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(8) "sv:value" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> NULL ["nextElementSibling"]=> NULL ["nodeName"]=> string(8) "sv:value" ["nodeValue"]=> string(25) "2014-11-11T14:50:35+01:00" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> string(29) "http://www.jcp.org/jcr/sv/1.0" ["prefix"]=> string(2) "sv" ["localName"]=> string(5) "value" ["baseURI"]=> string(1) "/" ["textContent"]=> string(25) "2014-11-11T14:50:35+01:00" }
Output for 8.0.0 - 8.0.30
object(DOMNodeList)#4 (1) { ["length"]=> int(1) } object(DOMElement)#3 (23) { ["tagName"]=> string(8) "sv:value" ["schemaTypeInfo"]=> NULL ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> NULL ["nextElementSibling"]=> NULL ["nodeName"]=> string(8) "sv:value" ["nodeValue"]=> string(25) "2014-11-11T14:50:35+01:00" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> string(29) "http://www.jcp.org/jcr/sv/1.0" ["prefix"]=> string(2) "sv" ["localName"]=> string(5) "value" ["baseURI"]=> string(1) "/" ["textContent"]=> string(25) "2014-11-11T14:50:35+01:00" }
Output for 5.3.11 - 5.3.29, 5.4.1 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28, 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
object(DOMNodeList)#4 (1) { ["length"]=> int(1) } object(DOMElement)#3 (18) { ["tagName"]=> string(8) "sv:value" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(8) "sv:value" ["nodeValue"]=> string(25) "2014-11-11T14:50:35+01:00" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> string(29) "http://www.jcp.org/jcr/sv/1.0" ["prefix"]=> string(2) "sv" ["localName"]=> string(5) "value" ["baseURI"]=> string(1) "/" ["textContent"]=> string(25) "2014-11-11T14:50:35+01:00" }
Output for 5.3.0 - 5.3.10, 5.4.0
object(DOMNodeList)#4 (0) { } object(DOMElement)#3 (0) { }
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/QT6Vu on line 22 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/QT6Vu on line 24 object(DOMNodeList)#4 (0) { } object(DOMElement)#3 (0) { }
Output for 5.0.0 - 5.0.5
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/QT6Vu on line 22 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/QT6Vu on line 24 Fatal error: Call to undefined method DOMXPath::evaluate() in /in/QT6Vu on line 25
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/QT6Vu on line 22 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/QT6Vu on line 24 Fatal error: Cannot instantiate non-existent class: domdocument in /in/QT6Vu on line 22
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/QT6Vu on line 22 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/QT6Vu on line 24 Fatal error: Cannot instantiate non-existent class: domdocument in /in/QT6Vu on line 22

preferences:
211.54 ms | 402 KiB | 315 Q