3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = <<<XML <?xml version="1.0" encoding="ISO-8859-1"?> <PersonList> <Header> </Header> <Person> <Name id="35" atrib="LOL">Sonu Kapoor</Name> <Age>24</Age> <Gender>M</Gender> <PostalCode>54879</PostalCode> </Person> <Person> <Name>Jasmin</Name> <Age>28</Age> <Gender>M</Gender> <PostalCode>78745</PostalCode> </Person> <Person> <Name>Josef</Name> <Age>232</Age> <Gender>F</Gender> <PostalCode>53454</PostalCode> </Person> </PersonList> XML; /* $doc = new DOMDocument(); $doc->loadXML($content); $xp = new DOMXPath($doc); */ $xmlIdatziDok = new DOMDocument(); if($xmlIdatziDok->loadXML($content) === FALSE){die('Error');} $xPath_IdatziDok = new DOMXPath($xmlIdatziDok); foreach ($xPath_IdatziDok->query('//PersonList/Header/Person/Name') AS $Idaztekoa) { $IdaztekoaID = $Idaztekoa->getAttribute('id'); $IdaztekoaAtrib = $Idaztekoa->getAttribute('atrib'); if($IdaztekoaAtrib != "yes") { $Idazteko->Attribute('atrib','yes'); } } $doc->formatOutput = true; echo $doc->saveXML();
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Attempt to assign property "formatOutput" on null in /in/qlmIK:49 Stack trace: #0 {main} thrown in /in/qlmIK on line 49
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
50.67 ms | 401 KiB | 8 Q