3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $doc = new DOMDocument(); $doc->loadXML('<example a="b">Test</example>'); $oXPath = new DOMXPath($oDoc); //$example = $doc->getElementsByTagName('example')->item(0); //$attr = $example->getAttributeNode('a'); var_dump($oXPath); print_r($oXPath);
Output for 7.0.0 - 7.1.0
Notice: Undefined variable: oDoc in /in/0X6o8 on line 5 Fatal error: Uncaught TypeError: Argument 1 passed to DOMXPath::__construct() must be an instance of DOMDocument, null given in /in/0X6o8:5 Stack trace: #0 /in/0X6o8(5): DOMXPath->__construct(NULL) #1 {main} thrown in /in/0X6o8 on line 5
Process exited with code 255.
Output for 5.2.6 - 5.6.28
Notice: Undefined variable: oDoc in /in/0X6o8 on line 5 Catchable fatal error: Argument 1 passed to DOMXPath::__construct() must be an instance of DOMDocument, null given in /in/0X6o8 on line 5
Process exited with code 255.
Output for 5.0.5 - 5.2.5
Notice: Undefined variable: oDoc in /in/0X6o8 on line 5 Fatal error: Uncaught exception 'DOMException' with message 'DOMXPath::__construct() expects parameter 1 to be DOMDocument, null given' in /in/0X6o8:5 Stack trace: #0 /in/0X6o8(5): DOMXPath->__construct(NULL) #1 {main} thrown in /in/0X6o8 on line 5
Process exited with code 255.
Output for 5.0.4
Notice: Undefined variable: oDoc in /in/0X6o8 on line 5 Fatal error: Uncaught exception 'DOMException' with message '__construct() expects parameter 1 to be DOMDocument, null given' in /in/0X6o8:5 Stack trace: #0 /in/0X6o8(5): DOMXPath->__construct(NULL) #1 {main} thrown in /in/0X6o8 on line 5
Process exited with code 255.
Output for 5.0.3
Notice: Undefined variable: oDoc in /in/0X6o8 on line 5 Fatal error: Uncaught exception 'DOMException' with message '__construct() expects parameter 1 to be DOMDocument, null given' in /in/0X6o8:5 Stack trace: #0 /in/0X6o8(5): DOMXPath->__construct(NULL) #1 {main} thrown in /in/0X6o8 on line 5
Process exited with code 255.
Output for 5.0.0 - 5.0.2
Notice: Undefined variable: oDoc in /in/0X6o8 on line 5 Fatal error: Uncaught exception 'DOMException' with message '__construct() expects parameter 1 to be DOMDocument, null given' in /in/0X6o8:5 Stack trace: #0 {main} thrown in /in/0X6o8 on line 5
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/0X6o8 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/0X6o8 on line 3