3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $xml = <<<EOD <rss xmlns:media="http://search.yahoo.com/mrss/" version="2.0"> <media:content medium="media.medium" href="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> </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 rk9ik
Output for 7.0.0 - 7.2.0
Warning: SimpleXMLElement::__construct(): Entity: line 3: parser error : Unescaped '<' not allowed in attributes values in /in/hcf5k on line 10 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/hcf5k on line 10 Warning: SimpleXMLElement::__construct(): ^ in /in/hcf5k on line 10 Warning: SimpleXMLElement::__construct(): Entity: line 3: parser error : attributes construct error in /in/hcf5k on line 10 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/hcf5k on line 10 Warning: SimpleXMLElement::__construct(): ^ in /in/hcf5k on line 10 Warning: SimpleXMLElement::__construct(): Entity: line 3: parser error : Couldn't find end of Start Tag thumbnail line 3 in /in/hcf5k on line 10 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/hcf5k on line 10 Warning: SimpleXMLElement::__construct(): ^ in /in/hcf5k on line 10 Fatal error: Uncaught Exception: String could not be parsed as XML in /in/hcf5k:10 Stack trace: #0 /in/hcf5k(10): SimpleXMLElement->__construct('<rss xmlns:medi...') #1 {main} thrown in /in/hcf5k on line 10
Process exited with code 255.
Output for 5.3.22 - 5.6.28
Warning: SimpleXMLElement::__construct(): Entity: line 3: parser error : Unescaped '<' not allowed in attributes values in /in/hcf5k on line 10 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/hcf5k on line 10 Warning: SimpleXMLElement::__construct(): ^ in /in/hcf5k on line 10 Warning: SimpleXMLElement::__construct(): Entity: line 3: parser error : attributes construct error in /in/hcf5k on line 10 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/hcf5k on line 10 Warning: SimpleXMLElement::__construct(): ^ in /in/hcf5k on line 10 Warning: SimpleXMLElement::__construct(): Entity: line 3: parser error : Couldn't find end of Start Tag thumbnail line 3 in /in/hcf5k on line 10 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/hcf5k on line 10 Warning: SimpleXMLElement::__construct(): ^ in /in/hcf5k on line 10 Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /in/hcf5k:10 Stack trace: #0 /in/hcf5k(10): SimpleXMLElement->__construct('<rss xmlns:medi...') #1 {main} thrown in /in/hcf5k on line 10
Process exited with code 255.