3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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"; }
based on VfMko
Output for 7.0.0 - 7.2.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.3.22 - 5.6.28
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.