3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<<EOD <?xml version="1.0" encoding="UTF-8"?> <rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0"> <channel> <item> <pubDate>Mon, 25 Jan 2016 05:00:00 GMT</pubDate> <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/cermati/image/upload/c_fill,h_300,w_300/ctjaru9g6c7lowxifxol' height='300' width='300'/>" height="300" width="300"> <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudinary.com/cermati/image/upload/c_thumb,h_120,w_120/ctjaru9g6c7lowxifxol' height='120' width='120'/>" height="120" width="120"/> </media:content> </item> </channel> </rss> EOD; $sxe = new SimpleXMLElement($xml); $sxe->registerXPathNamespace('c', 'http://example.org/chapter-title'); $result = $sxe->xpath('//c:title'); foreach ($result as $title) { echo $title . "\n"; }
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Warning: SimpleXMLElement::__construct(): Entity: line 6: parser error : Unescaped '<' not allowed in attributes values in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 6: parser error : attributes construct error in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 6: parser error : Couldn't find end of Start Tag content line 6 in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 7: parser error : Unescaped '<' not allowed in attributes values in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 7: parser error : attributes construct error in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 7: parser error : Couldn't find end of Start Tag thumbnail line 7 in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 8: parser error : Opening and ending tag mismatch: item line 4 and media:content in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): </media:content> in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 9: parser error : Opening and ending tag mismatch: channel line 3 and item in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): </item> in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 10: parser error : Opening and ending tag mismatch: rss line 2 and channel in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): </channel> in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 11: parser error : Extra content at the end of the document in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): </rss> in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Fatal error: Uncaught Exception: String could not be parsed as XML in /in/gMpc2:16 Stack trace: #0 /in/gMpc2(16): SimpleXMLElement->__construct('<?xml version="...') #1 {main} thrown in /in/gMpc2 on line 16
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Warning: SimpleXMLElement::__construct(): Entity: line 6: parser error : Unescaped '<' not allowed in attributes values in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 6: parser error : attributes construct error in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 6: parser error : Couldn't find end of Start Tag content line 6 in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 7: parser error : Unescaped '<' not allowed in attributes values in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 7: parser error : attributes construct error in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 7: parser error : Couldn't find end of Start Tag thumbnail line 7 in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 8: parser error : Opening and ending tag mismatch: item line 4 and media:content in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): </media:content> in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 9: parser error : Opening and ending tag mismatch: channel line 3 and item in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): </item> in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 10: parser error : Opening and ending tag mismatch: rss line 2 and channel in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): </channel> in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 11: parser error : Extra content at the end of the document in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): </rss> in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Fatal error: Uncaught Exception: String could not be parsed as XML in /in/gMpc2:16 Stack trace: #0 /in/gMpc2(16): SimpleXMLElement->__construct('<?xml version="...') #1 {main} thrown in /in/gMpc2 on line 16
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Warning: SimpleXMLElement::__construct(): Entity: line 6: parser error : Unescaped '<' not allowed in attributes values in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 6: parser error : attributes construct error in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 6: parser error : Couldn't find end of Start Tag content line 6 in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 7: parser error : Unescaped '<' not allowed in attributes values in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 7: parser error : attributes construct error in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 7: parser error : Couldn't find end of Start Tag thumbnail line 7 in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 8: parser error : Opening and ending tag mismatch: item line 4 and media:content in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): </media:content> in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 9: parser error : Opening and ending tag mismatch: channel line 3 and item in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): </item> in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 10: parser error : Opening and ending tag mismatch: rss line 2 and channel in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): </channel> in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): Entity: line 11: parser error : Extra content at the end of the document in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): </rss> in /in/gMpc2 on line 16 Warning: SimpleXMLElement::__construct(): ^ in /in/gMpc2 on line 16 Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /in/gMpc2:16 Stack trace: #0 /in/gMpc2(16): SimpleXMLElement->__construct('<?xml version="...') #1 {main} thrown in /in/gMpc2 on line 16
Process exited with code 255.

preferences:
283.91 ms | 405 KiB | 327 Q