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> <title> <![CDATA[ Cermati RSS ]]> </title> <description> <![CDATA[ Artikel Finansial terbaru dari Cermati.com ]]> </description> <link>https://www.cermati.com</link> <image> <url>https://www.cermati.com/favicon-32x32.png</url> <title>Cermati RSS</title> <link>https://www.cermati.com</link> </image> <generator>RSS for Node</generator> <lastBuildDate>Mon, 25 Jan 2016 17:46:25 GMT</lastBuildDate> <atom:link href="https://www.cermati.com/rss" rel="self" type="application/rss+xml"/> <author> <![CDATA[ Cermati Content Team ]]> </author> <language> <![CDATA[ id ]]> </language> <ttl>240</ttl> <item> <title> <![CDATA[ 12 Cara Mudah Menghemat Air di Rumah Anda ]]> </title> <description> <![CDATA[ Tidak cuma listrik, dalam kehidupan di rumah, air juga perlu dihemat. Selain untuk menghemat pengeluaran, hal ini juga berfungsi untuk melindungi lingkungan. ]]> </description> <link> https://www.cermati.com/artikel/12-cara-mudah-menghemat-air-di-rumah-anda </link> <guid isPermaLink="true"> https://www.cermati.com/artikel/12-cara-mudah-menghemat-air-di-rumah-anda </guid> <category> <![CDATA[ Rumah ]]> </category> <category> <![CDATA[ Kebutuhan ]]> </category> <category> <![CDATA[ Hidup Hemat ]]> </category> <category> <![CDATA[ Tips Berhemat ]]> </category> <category> <![CDATA[ Air ]]> </category> <dc:creator> <![CDATA[ Rizki Abadi ]]> </dc:creator> <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.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Warning: SimpleXMLElement::__construct(): Entity: line 60: parser error : Unescaped '<' not allowed in attributes values in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): ^ in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): Entity: line 60: parser error : attributes construct error in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): ^ in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): Entity: line 60: parser error : Couldn't find end of Start Tag content line 60 in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): ^ in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): Entity: line 61: parser error : Unescaped '<' not allowed in attributes values in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): ^ in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): Entity: line 61: parser error : attributes construct error in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): ^ in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): Entity: line 61: parser error : Couldn't find end of Start Tag thumbnail line 61 in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): ^ in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): Entity: line 62: parser error : Opening and ending tag mismatch: item line 26 and media:content in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): </media:content> in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): ^ in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): Entity: line 63: parser error : Opening and ending tag mismatch: channel line 3 and item in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): </item> in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): ^ in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): Entity: line 64: parser error : Opening and ending tag mismatch: rss line 2 and channel in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): </channel> in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): ^ in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): Entity: line 65: parser error : Extra content at the end of the document in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): </rss> in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): ^ in /in/gZJsa on line 70 Fatal error: Uncaught Exception: String could not be parsed as XML in /in/gZJsa:70 Stack trace: #0 /in/gZJsa(70): SimpleXMLElement->__construct('<?xml version="...') #1 {main} thrown in /in/gZJsa on line 70
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Warning: SimpleXMLElement::__construct(): Entity: line 60: parser error : Unescaped '<' not allowed in attributes values in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): ^ in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): Entity: line 60: parser error : attributes construct error in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): ^ in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): Entity: line 60: parser error : Couldn't find end of Start Tag content line 60 in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): ^ in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): Entity: line 61: parser error : Unescaped '<' not allowed in attributes values in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): ^ in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): Entity: line 61: parser error : attributes construct error in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): ^ in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): Entity: line 61: parser error : Couldn't find end of Start Tag thumbnail line 61 in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): ^ in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): Entity: line 62: parser error : Opening and ending tag mismatch: item line 26 and media:content in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): </media:content> in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): ^ in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): Entity: line 63: parser error : Opening and ending tag mismatch: channel line 3 and item in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): </item> in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): ^ in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): Entity: line 64: parser error : Opening and ending tag mismatch: rss line 2 and channel in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): </channel> in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): ^ in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): Entity: line 65: parser error : Extra content at the end of the document in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): </rss> in /in/gZJsa on line 70 Warning: SimpleXMLElement::__construct(): ^ in /in/gZJsa on line 70 Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /in/gZJsa:70 Stack trace: #0 /in/gZJsa(70): SimpleXMLElement->__construct('<?xml version="...') #1 {main} thrown in /in/gZJsa on line 70
Process exited with code 255.

preferences:
264.56 ms | 405 KiB | 326 Q