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> <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> <content:encoded> <![CDATA[ <p style="text-align: justify;">Air adalah sumber daya alam yang sangat penting untuk menjaga kesehatan tubuh. Maka sebagai manusia yang akan selalu menggantungkan diri pada air kita memang sudah seharusnya untuk menjaganya. Meskipun air ini adalah sumber daya yang terbarukan, namun untuk air bersih ]]> <![CDATA[ ternyata sumber daya ini tidak bisa diperbarui. Keberadaan air bersih yang terus menyusut tiap tahunnya ini akhirnya harus membuat kita ekstra waspada akan stok atau persediaannya. Untuk menjaga stok atau persediaan air bersih ini dengan baik Anda mau tak mau memang harus <a title="melakukan penghematan" href="https://www.cermati.com/artikel/5-cara-ampuh-dalam-menghemat-pengeluaran-rumah-tangga" target="_blank">melakukan penghematan</a>. Satu-satunya langkah adalah dengan <a title="jalan penghematan" href="https://www.cermati.com/artikel/5-langkah-mengatur-keuangan-rumah-tangga" target="_blank">jalan penghematan</a>&#xA0;ini memang sedang banyak digalakkan oleh beberapa pihak, baik dari kalangan personal maupun organisasi. Hasilnya saat ini sudah banyak gerakan mencintai dan peduli alam dengan salah satu programnya yaitu menjaga kelestarian serta penghematan persediaan air. Lalu jika kita sendiri mau menjalankan penghematan air, maka kita bisa melakukan beberapa cara sebagai berikut.</p> ]]> </content:encoded> <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 ldq2I
Output for 7.0.0 - 7.3.0alpha1
Warning: SimpleXMLElement::__construct(): Entity: line 68: parser error : Unescaped '<' not allowed in attributes values in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): ^ in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): Entity: line 68: parser error : attributes construct error in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): ^ in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): Entity: line 68: parser error : Couldn't find end of Start Tag content line 68 in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): ^ in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): Entity: line 69: parser error : Unescaped '<' not allowed in attributes values in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): ^ in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): Entity: line 69: parser error : attributes construct error in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): ^ in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): Entity: line 69: parser error : Couldn't find end of Start Tag thumbnail line 69 in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): ^ in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): Entity: line 70: parser error : Opening and ending tag mismatch: item line 26 and media:content in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): </media:content> in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): ^ in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): Entity: line 71: parser error : Opening and ending tag mismatch: channel line 3 and item in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): </item> in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): ^ in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): Entity: line 72: parser error : Opening and ending tag mismatch: rss line 2 and channel in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): </channel> in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): ^ in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): Entity: line 73: parser error : Extra content at the end of the document in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): </rss> in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): ^ in /in/SgMT8 on line 78 Fatal error: Uncaught Exception: String could not be parsed as XML in /in/SgMT8:78 Stack trace: #0 /in/SgMT8(78): SimpleXMLElement->__construct('<?xml version="...') #1 {main} thrown in /in/SgMT8 on line 78
Process exited with code 255.
Output for 5.3.22 - 5.6.28
Warning: SimpleXMLElement::__construct(): Entity: line 68: parser error : Unescaped '<' not allowed in attributes values in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): ^ in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): Entity: line 68: parser error : attributes construct error in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): ^ in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): Entity: line 68: parser error : Couldn't find end of Start Tag content line 68 in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): <media:content medium="media.medium" href="<img src='http://res.cloudinary.com/c in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): ^ in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): Entity: line 69: parser error : Unescaped '<' not allowed in attributes values in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): ^ in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): Entity: line 69: parser error : attributes construct error in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): ^ in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): Entity: line 69: parser error : Couldn't find end of Start Tag thumbnail line 69 in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): <media:thumbnail medium="media.thumb.medium" href="<img src='http://res.cloudina in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): ^ in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): Entity: line 70: parser error : Opening and ending tag mismatch: item line 26 and media:content in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): </media:content> in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): ^ in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): Entity: line 71: parser error : Opening and ending tag mismatch: channel line 3 and item in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): </item> in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): ^ in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): Entity: line 72: parser error : Opening and ending tag mismatch: rss line 2 and channel in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): </channel> in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): ^ in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): Entity: line 73: parser error : Extra content at the end of the document in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): </rss> in /in/SgMT8 on line 78 Warning: SimpleXMLElement::__construct(): ^ in /in/SgMT8 on line 78 Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /in/SgMT8:78 Stack trace: #0 /in/SgMT8(78): SimpleXMLElement->__construct('<?xml version="...') #1 {main} thrown in /in/SgMT8 on line 78
Process exited with code 255.