3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $x = <<<XML <errors> <viewErrors> <viewError code="404">Can't finde requested file</viewError> <viewError code="405">Method not allowed</viewError> </viewErrors> </errors> XML; $_xml = new DOMDocument('1.0', 'utf-8'); $_xml -> load($x); $_xpath = new DOMXPath($_xml); echo $_xpath -> evaluate( '//viewError[@code="404"]' ) -> item(0) -> textContent;
based on qVmTs
Output for 5.2.3 - 5.6.28, 7.0.0 - 7.1.0
Warning: DOMDocument::load(): I/O warning : failed to load external entity "/<errors> <viewErrors> <viewError code="404">Can't finde requested file</viewError> <viewError code="405">Method not allowed</viewError> </viewErrors> </errors>" in /in/Jq3RO on line 12 Notice: Trying to get property of non-object in /in/Jq3RO on line 14
Output for hhvm-3.12.0
Warning: No such file or directory Notice: Cannot access property on non-object in /in/Jq3RO on line 14
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.1.0 - 5.1.1, 5.1.3 - 5.2.2
Warning: DOMDocument::load(): I/O warning : failed to load external entity "/in/<errors> <viewErrors> <viewError code="404">Can't finde requested file</viewError> <viewError code="405">Method not allowed</viewError> </viewErrors> </errors>" in /in/Jq3RO on line 12 Notice: Trying to get property of non-object in /in/Jq3RO on line 14
Output for 5.1.2
Warning: DOMDocument::load(): I/O warning : failed to load external entity "/in/<errors> <viewErrors> <viewError code="404">Can't finde requested file</viewError> <viewError code="405">Method not allowed</viewError> </viewErrors> </errors>" in /in/Jq3RO on line 13 Notice: Trying to get property of non-object in /in/Jq3RO on line 15
Output for 5.0.0 - 5.0.5
Warning: I/O warning : failed to load external entity "/in/<errors> <viewErrors> <viewError code="404">Can't finde requested file</viewError> <viewError code="405">Method not allowed</viewError> </viewErrors> </errors>" in /in/Jq3RO on line 12 Fatal error: Call to undefined method DOMXPath::evaluate() in /in/Jq3RO on line 14
Process exited with code 255.
Output for 4.4.3 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /in/Jq3RO on line 14
Process exited with code 255.
Output for 4.4.2
Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /in/Jq3RO on line 15
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /in/Jq3RO on line 14
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `','' or `';'' in /in/Jq3RO on line 14
Process exited with code 255.