3v4l.org

run code in 300+ PHP versions simultaneously
<?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"); //var_dump($dom); foreach ($dom as $image=>$value) { //$fileName = substr(strrchr($image->nodeValue, "/"), 1); echo '----------------------'; var_dump($value); //echo $value, PHP_EOL; //unlink($path.$fileName); }
Output for 8.3.0 - 8.3.6
----------------------object(DOMElement)#4 (27) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(6) "medias" ["className"]=> string(0) "" ["id"]=> string(0) "" ["firstElementChild"]=> string(22) "(object value omitted)" ["lastElementChild"]=> string(22) "(object value omitted)" ["childElementCount"]=> int(5) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> NULL ["nodeName"]=> string(6) "medias" ["nodeValue"]=> string(320) "http://teste.croobly.com.br/module-content/images/1699789387.jpghttp://teste.croobly.com.br/module-content/images/1699802460.jpghttp://teste.croobly.com.br/module-content/images/1699734945.jpghttp://teste.croobly.com.br/module-content/images/1699720579.jpghttp://teste.croobly.com.br/module-content/images/1699775071.jpg" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["parentElement"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> NULL ["attributes"]=> string(22) "(object value omitted)" ["isConnected"]=> bool(true) ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(6) "medias" ["baseURI"]=> string(1) "/" ["textContent"]=> string(320) "http://teste.croobly.com.br/module-content/images/1699789387.jpghttp://teste.croobly.com.br/module-content/images/1699802460.jpghttp://teste.croobly.com.br/module-content/images/1699734945.jpghttp://teste.croobly.com.br/module-content/images/1699720579.jpghttp://teste.croobly.com.br/module-content/images/1699775071.jpg" }
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
----------------------object(DOMElement)#4 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(6) "medias" ["firstElementChild"]=> string(22) "(object value omitted)" ["lastElementChild"]=> string(22) "(object value omitted)" ["childElementCount"]=> int(5) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> NULL ["nodeName"]=> string(6) "medias" ["nodeValue"]=> string(320) "http://teste.croobly.com.br/module-content/images/1699789387.jpghttp://teste.croobly.com.br/module-content/images/1699802460.jpghttp://teste.croobly.com.br/module-content/images/1699734945.jpghttp://teste.croobly.com.br/module-content/images/1699720579.jpghttp://teste.croobly.com.br/module-content/images/1699775071.jpg" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> NULL ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(6) "medias" ["baseURI"]=> string(1) "/" ["textContent"]=> string(320) "http://teste.croobly.com.br/module-content/images/1699789387.jpghttp://teste.croobly.com.br/module-content/images/1699802460.jpghttp://teste.croobly.com.br/module-content/images/1699734945.jpghttp://teste.croobly.com.br/module-content/images/1699720579.jpghttp://teste.croobly.com.br/module-content/images/1699775071.jpg" }
Output for 8.0.0 - 8.0.30
----------------------object(DOMElement)#4 (23) { ["tagName"]=> string(6) "medias" ["schemaTypeInfo"]=> NULL ["firstElementChild"]=> string(22) "(object value omitted)" ["lastElementChild"]=> string(22) "(object value omitted)" ["childElementCount"]=> int(5) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> NULL ["nodeName"]=> string(6) "medias" ["nodeValue"]=> string(320) "http://teste.croobly.com.br/module-content/images/1699789387.jpghttp://teste.croobly.com.br/module-content/images/1699802460.jpghttp://teste.croobly.com.br/module-content/images/1699734945.jpghttp://teste.croobly.com.br/module-content/images/1699720579.jpghttp://teste.croobly.com.br/module-content/images/1699775071.jpg" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> NULL ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(6) "medias" ["baseURI"]=> string(1) "/" ["textContent"]=> string(320) "http://teste.croobly.com.br/module-content/images/1699789387.jpghttp://teste.croobly.com.br/module-content/images/1699802460.jpghttp://teste.croobly.com.br/module-content/images/1699734945.jpghttp://teste.croobly.com.br/module-content/images/1699720579.jpghttp://teste.croobly.com.br/module-content/images/1699775071.jpg" }
Output for 7.0.16 - 7.0.33, 7.1.2 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
----------------------object(DOMElement)#4 (18) { ["tagName"]=> string(6) "medias" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(6) "medias" ["nodeValue"]=> string(320) "http://teste.croobly.com.br/module-content/images/1699789387.jpghttp://teste.croobly.com.br/module-content/images/1699802460.jpghttp://teste.croobly.com.br/module-content/images/1699734945.jpghttp://teste.croobly.com.br/module-content/images/1699720579.jpghttp://teste.croobly.com.br/module-content/images/1699775071.jpg" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> NULL ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(6) "medias" ["baseURI"]=> string(1) "/" ["textContent"]=> string(320) "http://teste.croobly.com.br/module-content/images/1699789387.jpghttp://teste.croobly.com.br/module-content/images/1699802460.jpghttp://teste.croobly.com.br/module-content/images/1699734945.jpghttp://teste.croobly.com.br/module-content/images/1699720579.jpghttp://teste.croobly.com.br/module-content/images/1699775071.jpg" }
Output for 7.0.0 - 7.0.15, 7.1.0 - 7.1.1
----------------------object(DOMElement)#4 (17) { ["tagName"]=> string(6) "medias" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(6) "medias" ["nodeValue"]=> string(320) "http://teste.croobly.com.br/module-content/images/1699789387.jpghttp://teste.croobly.com.br/module-content/images/1699802460.jpghttp://teste.croobly.com.br/module-content/images/1699734945.jpghttp://teste.croobly.com.br/module-content/images/1699720579.jpghttp://teste.croobly.com.br/module-content/images/1699775071.jpg" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(6) "medias" ["baseURI"]=> string(1) "/" ["textContent"]=> string(320) "http://teste.croobly.com.br/module-content/images/1699789387.jpghttp://teste.croobly.com.br/module-content/images/1699802460.jpghttp://teste.croobly.com.br/module-content/images/1699734945.jpghttp://teste.croobly.com.br/module-content/images/1699720579.jpghttp://teste.croobly.com.br/module-content/images/1699775071.jpg" }
Output for 5.3.11 - 5.3.29, 5.4.1 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
----------------------object(DOMElement)#3 (17) { ["tagName"]=> string(6) "medias" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(6) "medias" ["nodeValue"]=> string(320) "http://teste.croobly.com.br/module-content/images/1699789387.jpghttp://teste.croobly.com.br/module-content/images/1699802460.jpghttp://teste.croobly.com.br/module-content/images/1699734945.jpghttp://teste.croobly.com.br/module-content/images/1699720579.jpghttp://teste.croobly.com.br/module-content/images/1699775071.jpg" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(6) "medias" ["baseURI"]=> string(1) "/" ["textContent"]=> string(320) "http://teste.croobly.com.br/module-content/images/1699789387.jpghttp://teste.croobly.com.br/module-content/images/1699802460.jpghttp://teste.croobly.com.br/module-content/images/1699734945.jpghttp://teste.croobly.com.br/module-content/images/1699720579.jpghttp://teste.croobly.com.br/module-content/images/1699775071.jpg" }
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.10, 5.4.0
----------------------object(DOMElement)#3 (0) { }
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/D2Cfb 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/D2Cfb on line 4

preferences:
309.12 ms | 401 KiB | 460 Q