3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $xml = '<?xml version="1.0" encoding="UTF-8"?>' . '<b:book xmlns:b="urn:irrelevant">' . '<b:chapter>Once upon a time</b:chapter>' . '</b:book>'; $doc = new DOMDocument(); $doc->loadXML($xml); $book = $doc->documentElement; $chapter = $book->getElementsByTagName("chapter")->item(0); echo "book nsURI before: ", $book->namespaceURI, "\n"; // prints "book nsURI before: urn:irrelevant" $nsuri = $book->namespaceURI; $book->removeChild($chapter); echo "book nsURI after: ", $book->namespaceURI, "\n"; // prints "book nsURI after: urn:irrelevant" // fails with "Cannot write property" $book->namespaceURI = $nsuri;
Output for 7.1.0
book nsURI before: urn:irrelevant book nsURI after: urn:irrelevant Fatal error: Uncaught Error: Cannot write property in /in/SbSPO:22 Stack trace: #0 {main} thrown in /in/SbSPO on line 22
Process exited with code 255.
Output for 5.0.0 - 5.6.28, 7.0.0 - 7.0.14
book nsURI before: urn:irrelevant book nsURI after: urn:irrelevant Fatal error: main(): Cannot write property in /in/SbSPO on line 22
Process exited with code 255.
Output for hhvm-3.12.0
book nsURI before: urn:irrelevant book nsURI after: urn:irrelevant Fatal error: Cannot write property in /in/SbSPO on line -1
Process exited with code 255.
Output for hhvm-3.10.0
book nsURI before: urn:irrelevant book nsURI after: urn:irrelevant Fatal error: Cannot write property in /in/SbSPO on line 22
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/SbSPO on line 12
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 in /in/SbSPO on line 12
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/SbSPO on line 12
Process exited with code 255.