3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $contentData = '<texts><text_0_0><![CDATA[1]]></text_0_0><text_3_0><![CDATA[4]]></text_3_0><text_1_0><![CDATA[2]]></text_1_0><text_4_0><![CDATA[5]]></text_4_0><text_2_0><![CDATA[3]]></text_2_0></texts><medias><image_1_0><![CDATA[http://teste.croobly.com.br/module-content/images/1699789387.jpg]]></image_1_0><image_0_0><![CDATA[http://teste.croobly.com.br/module-content/images/1699802460.jpg]]></image_0_0><image_3_0><![CDATA[http://teste.croobly.com.br/module-content/images/1699734945.jpg]]></image_3_0><image_4_0><![CDATA[http://teste.croobly.com.br/module-content/images/1699720579.jpg]]></image_4_0><image_2_0><![CDATA[http://teste.croobly.com.br/module-content/images/1699775071.jpg]]></image_2_0></medias>'; $dom = new DOMDocument(); $dom->loadXML('<content>'.$contentData.'</content>'); $dom = $dom->getElementsByTagName("medias"); foreach ($dom as $image=>$value) { $fileName = substr(strrchr($image->nodeValue, "/"), 1); echo '----------------------'; echo $image->nodeValue, PHP_EOL; //echo $value, PHP_EOL; //unlink($path.$fileName); }
Output for 5.0.2 - 5.6.28, 7.0.0 - 7.1.0
Notice: Trying to get property of non-object in /in/VXTJF on line 10 ---------------------- Notice: Trying to get property of non-object in /in/VXTJF on line 12
Output for hhvm-3.10.0 - 3.12.0
Notice: Cannot access property on non-object in /in/VXTJF on line 10 ---------------------- Notice: Cannot access property on non-object in /in/VXTJF on line 12
Output for 5.0.0 - 5.0.1
Notice: Trying to get property of non-object in /in/VXTJF on line 10 ---------------------- Notice: Trying to get property of non-object in /in/VXTJF on line 12 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/VXTJF on line 12 PHP_EOL
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/VXTJF on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/VXTJF on line 4