3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php /** * How to get attribute of node with namespace using SimpleXML? * * @link http://stackoverflow.com/q/6576773/367456 */ $buffer = '<item><title>Paul Priestman at Gateshead College</title><pubDate>Tue, 15 Dec 2015 05:21:31 -0500</pubDate><link>https://vimeo.com/148993338</link><description>&lt;p&gt;&lt;iframe src=&quot;https://player.vimeo.com/video/148993338&quot; width=&quot;640&quot; height=&quot;360&quot;frameborder=&quot;0&quot; title=&quot;Paul Priestman at Gateshead College&quot; webkitallowfullscreen mozallowfullscreen allowfullscreen&gt;&lt;/iframe&gt;&lt;/p&gt;&lt;p&gt;&lt;p class=&quot;first&quot;&gt;Paul Priestman, Designer &amp; Co-Director of PriestmanGoode, visited Gateshead College for a talk as part of the Speakers for Schools program. This video has been provided courtesy of Steven Chippendale, from the school.&lt;/p&gt; &lt;p&gt;Speakers for Schools is an independent UK charity that provides state secondary schools with access to talks from high-profile professionals and academics. Our speakers are experts and leaders in their fields: some of the countrys highest achieving individuals across government, business, sport, technology, science and the arts, donating their time to share their insights and experiences. For more information visit our website at speakers4schools.org&lt;/p&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Cast:&lt;/strong&gt; &lt;a href=&quot;https://vimeo.com/user29751154&quot;&gt;Speakers for Schools&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Tags:&lt;/strong&gt; &lt;a href=&quot;https://vimeo.com/tag:business&quot;&gt;business&lt;/a&gt;, &lt;a href=&quot;https://vimeo.com/tag:Gateshead&quot;&gt;Gateshead&lt;/a&gt;, &lt;a href=&quot;https://vimeo.com/tag:Paul+Priestman&quot;&gt;Paul Priestman&lt;/a&gt;, &lt;a href=&quot;https://vimeo.com/tag:design&quot;&gt;design&lt;/a&gt; and &lt;a href=&quot;https://vimeo.com/tag:Gateshead+College&quot;&gt;Gateshead College&lt;/a&gt;&lt;/p&gt;</description><guid isPermaLink="false">tag:vimeo,2015-12-15:clip148993338</guid><media:content><media:player url="https://player.vimeo.com/video/148993338"/><media:credit role="author" scheme="https://vimeo.com/user29751154"></media:credit><media:thumbnail height="540" width="960" url="https://i.vimeocdn.com/video/548100055_960.jpg"/><media:title>Paul Priestman at Gateshead College</media:title></media:content></item>'; $xml = new SimpleXMLElement($buffer); if (!defined('LIBXML_DOTTED_VERSION')) { echo "PHP/LIBXML unsupported/too old."; return; } echo "ibxml version: ", LIBXML_DOTTED_VERSION, "\n"; $youtube = $xml; echo 'tests: ', $youtube->rss->channel->item, "\n"; echo 'via attributes(): ', $youtube->children('media', TRUE)->content, "\n"; echo 'via array-access: ', $youtube->children('media', TRUE)->content, "\n"; echo 'via property : ', $youtube->children('media', TRUE)->content, "\n";
based on 4AgL9
Output for 7.2.6
Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on content is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): guid isPermaLink="false">tag:vimeo,2015-12-15:clip148993338</guid><media:content in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on player is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): guid><media:content><media:player url="https://player.vimeo.com/video/148993338" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on credit is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): /148993338"/><media:credit role="author" scheme="https://vimeo.com/user29751154" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on thumbnail is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): il height="540" width="960" url="https://i.vimeocdn.com/video/548100055_960.jpg" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on title is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): " width="960" url="https://i.vimeocdn.com/video/548100055_960.jpg"/><media:title in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 ibxml version: 2.9.4 tests: Notice: Trying to get property 'item' of non-object in /in/f1fmr on line 20 via attributes(): via array-access: via property :
Output for 7.2.0
Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on content is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): guid isPermaLink="false">tag:vimeo,2015-12-15:clip148993338</guid><media:content in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on player is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): guid><media:content><media:player url="https://player.vimeo.com/video/148993338" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on credit is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): /148993338"/><media:credit role="author" scheme="https://vimeo.com/user29751154" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on thumbnail is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): il height="540" width="960" url="https://i.vimeocdn.com/video/548100055_960.jpg" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on title is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): " width="960" url="https://i.vimeocdn.com/video/548100055_960.jpg"/><media:title in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 ibxml version: 2.9.7 tests: Notice: Trying to get property 'item' of non-object in /in/f1fmr on line 20 via attributes(): via array-access: via property :
Output for 5.6.28, 7.0.20 - 7.1.7, 7.1.20
Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on content is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): guid isPermaLink="false">tag:vimeo,2015-12-15:clip148993338</guid><media:content in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on player is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): guid><media:content><media:player url="https://player.vimeo.com/video/148993338" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on credit is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): /148993338"/><media:credit role="author" scheme="https://vimeo.com/user29751154" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on thumbnail is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): il height="540" width="960" url="https://i.vimeocdn.com/video/548100055_960.jpg" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on title is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): " width="960" url="https://i.vimeocdn.com/video/548100055_960.jpg"/><media:title in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 ibxml version: 2.9.4 tests: Notice: Trying to get property of non-object in /in/f1fmr on line 20 via attributes(): via array-access: via property :
Output for 7.1.10
Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on content is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): guid isPermaLink="false">tag:vimeo,2015-12-15:clip148993338</guid><media:content in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on player is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): guid><media:content><media:player url="https://player.vimeo.com/video/148993338" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on credit is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): /148993338"/><media:credit role="author" scheme="https://vimeo.com/user29751154" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on thumbnail is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): il height="540" width="960" url="https://i.vimeocdn.com/video/548100055_960.jpg" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on title is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): " width="960" url="https://i.vimeocdn.com/video/548100055_960.jpg"/><media:title in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 ibxml version: 2.9.5 tests: Notice: Trying to get property of non-object in /in/f1fmr on line 20 via attributes(): via array-access: via property :
Output for 5.5.24 - 5.6.15, 5.6.17 - 5.6.21, 7.0.1 - 7.0.6
Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on content is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): guid isPermaLink="false">tag:vimeo,2015-12-15:clip148993338</guid><media:content in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on player is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): guid><media:content><media:player url="https://player.vimeo.com/video/148993338" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on credit is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): /148993338"/><media:credit role="author" scheme="https://vimeo.com/user29751154" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on thumbnail is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): il height="540" width="960" url="https://i.vimeocdn.com/video/548100055_960.jpg" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on title is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): " width="960" url="https://i.vimeocdn.com/video/548100055_960.jpg"/><media:title in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 ibxml version: 2.9.3 tests: Notice: Trying to get property of non-object in /in/f1fmr on line 20 via attributes(): via array-access: via property :
Output for 5.4.12 - 5.4.45, 5.6.16, 7.0.0
Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on content is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): guid isPermaLink="false">tag:vimeo,2015-12-15:clip148993338</guid><media:content in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on player is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): guid><media:content><media:player url="https://player.vimeo.com/video/148993338" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on credit is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): /148993338"/><media:credit role="author" scheme="https://vimeo.com/user29751154" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on thumbnail is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): il height="540" width="960" url="https://i.vimeocdn.com/video/548100055_960.jpg" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on title is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): " width="960" url="https://i.vimeocdn.com/video/548100055_960.jpg"/><media:title in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 ibxml version: 2.9.2 tests: Notice: Trying to get property of non-object in /in/f1fmr on line 20 via attributes(): via array-access: via property :
Output for 5.3.25 - 5.3.29
Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on content is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): guid isPermaLink="false">tag:vimeo,2015-12-15:clip148993338</guid><media:content in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on player is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): guid><media:content><media:player url="https://player.vimeo.com/video/148993338" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on credit is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): /148993338"/><media:credit role="author" scheme="https://vimeo.com/user29751154" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on thumbnail is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): il height="540" width="960" url="https://i.vimeocdn.com/video/548100055_960.jpg" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on title is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): " width="960" url="https://i.vimeocdn.com/video/548100055_960.jpg"/><media:title in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 ibxml version: 2.9.1 tests: Notice: Trying to get property of non-object in /in/f1fmr on line 20 via attributes(): via array-access: via property :
Output for 5.3.22 - 5.3.24
Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on content is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): guid isPermaLink="false">tag:vimeo,2015-12-15:clip148993338</guid><media:content in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on player is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): guid><media:content><media:player url="https://player.vimeo.com/video/148993338" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on credit is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): /148993338"/><media:credit role="author" scheme="https://vimeo.com/user29751154" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on thumbnail is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): il height="540" width="960" url="https://i.vimeocdn.com/video/548100055_960.jpg" in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): namespace error : Namespace prefix media on title is not defined in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): " width="960" url="https://i.vimeocdn.com/video/548100055_960.jpg"/><media:title in /in/f1fmr on line 9 Warning: SimpleXMLElement::__construct(): ^ in /in/f1fmr on line 9 ibxml version: 2.8.0 tests: Notice: Trying to get property of non-object in /in/f1fmr on line 20 via attributes(): via array-access: via property :