3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = '<items><item/><item/><item/></items>'; $dom = DOMDocument::loadXml($xm); var_dump(iterator_to_array($dom->documentElement->childNodes));
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Non-static method DOMDocument::loadXML() cannot be called statically in /in/9elad:5 Stack trace: #0 {main} thrown in /in/9elad on line 5
Process exited with code 255.
Output for 7.2.6 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Deprecated: Non-static method DOMDocument::loadXML() should not be called statically in /in/9elad on line 5 Notice: Undefined variable: xm in /in/9elad on line 5 Warning: DOMDocument::loadXML(): Empty string supplied as input in /in/9elad on line 5 Notice: Trying to get property 'documentElement' of non-object in /in/9elad on line 8 Notice: Trying to get property 'childNodes' of non-object in /in/9elad on line 8 Fatal error: Uncaught TypeError: Argument 1 passed to iterator_to_array() must implement interface Traversable, null given in /in/9elad:8 Stack trace: #0 /in/9elad(8): iterator_to_array(NULL) #1 {main} thrown in /in/9elad on line 8
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Warning: DOMDocument::loadXML(): Empty string supplied as input in /in/9elad on line 5 Fatal error: Uncaught TypeError: Argument 1 passed to iterator_to_array() must implement interface Traversable, null given in /in/9elad:8 Stack trace: #0 /in/9elad(8): iterator_to_array(NULL) #1 {main} thrown in /in/9elad on line 8
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33
Deprecated: Non-static method DOMDocument::loadXML() should not be called statically in /in/9elad on line 5 Notice: Undefined variable: xm in /in/9elad on line 5 Warning: DOMDocument::loadXML(): Empty string supplied as input in /in/9elad on line 5 Notice: Trying to get property of non-object in /in/9elad on line 8 Notice: Trying to get property of non-object in /in/9elad on line 8 Fatal error: Uncaught TypeError: Argument 1 passed to iterator_to_array() must implement interface Traversable, null given in /in/9elad:8 Stack trace: #0 /in/9elad(8): iterator_to_array(NULL) #1 {main} thrown in /in/9elad on line 8
Process exited with code 255.
Output for 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28
Notice: Undefined variable: xm in /in/9elad on line 5 Strict Standards: Non-static method DOMDocument::loadXML() should not be called statically in /in/9elad on line 5 Warning: DOMDocument::loadXML(): Empty string supplied as input in /in/9elad on line 5 Notice: Trying to get property of non-object in /in/9elad on line 8 Notice: Trying to get property of non-object in /in/9elad on line 8 Catchable fatal error: Argument 1 passed to iterator_to_array() must implement interface Traversable, null given in /in/9elad on line 8
Process exited with code 255.
Output for 5.1.0 - 5.1.6
Notice: Undefined variable: xm in /in/9elad on line 5 Strict Standards: Non-static method DOMDocument::loadXML() should not be called statically in /in/9elad on line 5 Warning: DOMDocument::loadXML(): Empty string supplied as input in /in/9elad on line 5 Notice: Trying to get property of non-object in /in/9elad on line 8 Notice: Trying to get property of non-object in /in/9elad on line 8 Warning: iterator_to_array() expects parameter 1 to be Traversable, null given in /in/9elad on line 8 bool(false)
Output for 5.0.4 - 5.0.5
Notice: Undefined variable: xm in /in/9elad on line 5 Strict Standards: Non-static method DOMDocument::loadXML() should not be called statically in /in/9elad on line 5 Warning: DOMDocument::loadXML(): Empty string supplied as input in /in/9elad on line 5 Fatal error: Call to undefined function iterator_to_array() in /in/9elad on line 8
Process exited with code 255.
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: xm in /in/9elad on line 5 Strict Standards: Non-static method DOMDocument::loadXML() should not be called statically in /in/9elad on line 5 Warning: DOMDocument::loadXML(): Empty string supplied as input in /in/9elad on line 5 Fatal error: Call to undefined function iterator_to_array() in /in/9elad on line 8
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Undefined class name 'domdocument' in /in/9elad on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Undefined class name 'domdocument' in /in/9elad on line 5

preferences:
232.91 ms | 401 KiB | 343 Q