3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 5.3.11 - 5.3.29, 5.4.1 - 5.6.28, 7.0.0 - 7.1.0
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 hhvm-3.10.0 - 3.12.0
object(DOMNodeList)#4 (1) { ["length"]=> int(1) } object(DOMElement)#3 (18) { ["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" ["tagName"]=> string(8) "sv:value" ["schemaTypeInfo"]=> NULL }
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.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.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