3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * How to get attribute of node with namespace using SimpleXML? * * @link http://stackoverflow.com/q/6576773/367456 */ $buffer = '<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xml:lang="en-US"><channel><title>Vimeo / Speakers for Schools’s videos</title><link>https://vimeo.com/user29751154/videos</link><description>Videos uploaded by Speakers for Schools on Vimeo.</description><pubDate>Thu, 28 Jan 2016 20:12:40 -0500</pubDate><generator>Vimeo</generator><atom:link rel="self" href="https://vimeo.com/user29751154/videos/rss"/><atom:link rel="hub" href="http://vimeo.superfeedr.com"/><image><url>https://i.vimeocdn.com/portrait/8037598_100x100.jpg</url><title>Vimeo / Speakers for Schools’s videos</title><link>https://vimeo.com/user29751154/videos</link></image> <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> </channel></rss>'; $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->channel->item->children('media', TRUE)->content, "\n"; echo 'via array-access: ', $youtube->channel->item->children('media', TRUE)->content, "\n"; echo 'via property : ', $youtube->channel->item->children('media', TRUE)->content, "\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4AgL9
function name:  (null)
number of ops:  49
compiled vars:  !0 = $buffer, !1 = $xml, !2 = $youtube
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%0A%3Crss+version%3D%222.0%22+xmlns%3Aatom%3D%22http%3A%2F%2Fwww.w3.org%2F2005%2FAtom%22+xmlns%3Amedia%3D%22http%3A%2F%2Fsearch.yahoo.com%2Fmrss%2F%22+xml%3Alang%3D%22en-US%22%3E%3Cchannel%3E%3Ctitle%3EVimeo+%2F+Speakers+for+Schools%C3%A2%E2%82%AC%E2%84%A2s+videos%3C%2Ftitle%3E%3Clink%3Ehttps%3A%2F%2Fvimeo.com%2Fuser29751154%2Fvideos%3C%2Flink%3E%3Cdescription%3EVideos+uploaded+by+Speakers+for+Schools+on+Vimeo.%3C%2Fdescription%3E%3CpubDate%3EThu%2C+28+Jan+2016+20%3A12%3A40+-0500%3C%2FpubDate%3E%3Cgenerator%3EVimeo%3C%2Fgenerator%3E%3Catom%3Alink+rel%3D%22self%22+href%3D%22https%3A%2F%2Fvimeo.com%2Fuser29751154%2Fvideos%2Frss%22%2F%3E%3Catom%3Alink+rel%3D%22hub%22+href%3D%22http%3A%2F%2Fvimeo.superfeedr.com%22%2F%3E%3Cimage%3E%3Curl%3Ehttps%3A%2F%2Fi.vimeocdn.com%2Fportrait%2F8037598_100x100.jpg%3C%2Furl%3E%3Ctitle%3EVimeo+%2F+Speakers+for+Schools%C3%A2%E2%82%AC%E2%84%A2s+videos%3C%2Ftitle%3E%3Clink%3Ehttps%3A%2F%2Fvimeo.com%2Fuser29751154%2Fvideos%3C%2Flink%3E%3C%2Fimage%3E%0A%3Citem%3E%3Ctitle%3EPaul+Priestman+at+Gateshead+College%3C%2Ftitle%3E%3CpubDate%3ETue%2C+15+Dec+2015+05%3A21%3A31+-0500%3C%2FpubDate%3E%3Clink%3Ehttps%3A%2F%2Fvimeo.com%2F148993338%3C%2Flink%3E%3Cdescription%3E%26lt%3Bp%26gt%3B%26lt%3Biframe+src%3D%26quot%3Bhttps%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F148993338%26quot%3B+width%3D%26quot%3B640%26quot%3B+height%3D%26quot%3B360%26quot%3Bframeborder%3D%26quot%3B0%26quot%3B+title%3D%26quot%3BPaul+Priestman+at+Gateshead+College%26quot%3B+webkitallowfullscreen+mozallowfullscreen+allowfullscreen%26gt%3B%26lt%3B%2Fiframe%26gt%3B%26lt%3B%2Fp%26gt%3B%26lt%3Bp%26gt%3B%26lt%3Bp+class%3D%26quot%3Bfirst%26quot%3B%26gt%3BPaul+Priestman%2C+Designer+%26amp%3B+Co-Director+of+PriestmanGoode%2C+visited+Gateshead+College+for+a+talk+as+part+of+the+Speakers+for+Schools+program.+This+video+has+been+provided+courtesy+of+Steven+Chippendale%2C+from+the+school.%26lt%3B%2Fp%26gt%3B+%26lt%3Bp%26gt%3BSpeakers+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%3A+some+of+the+countrys+highest+achieving+individuals+across+government%2C+business%2C+sport%2C+technology%2C+science+and+the+arts%2C+donating+their+time+to+share+their+insights+and+experiences.+For+more+information+visit+our+website+at+speakers4schools.org%26lt%3B%2Fp%26gt%3B%26lt%3B%2Fp%26gt%3B%26lt%3Bp%26gt%3B%26lt%3Bstrong%26gt%3BCast%3A%26lt%3B%2Fstrong%26gt%3B+%26lt%3Ba+href%3D%26quot%3Bhttps%3A%2F%2Fvimeo.com%2Fuser29751154%26quot%3B%26gt%3BSpeakers+for+Schools%26lt%3B%2Fa%26gt%3B%26lt%3B%2Fp%26gt%3B%26lt%3Bp%26gt%3B%26lt%3Bstrong%26gt%3BTags%3A%26lt%3B%2Fstrong%26gt%3B++%26lt%3Ba+href%3D%26quot%3Bhttps%3A%2F%2Fvimeo.com%2Ftag%3Abusiness%26quot%3B%26gt%3Bbusiness%26lt%3B%2Fa%26gt%3B%2C++%26lt%3Ba+href%3D%26quot%3Bhttps%3A%2F%2Fvimeo.com%2Ftag%3AGateshead%26quot%3B%26gt%3BGateshead%26lt%3B%2Fa%26gt%3B%2C++%26lt%3Ba+href%3D%26quot%3Bhttps%3A%2F%2Fvimeo.com%2Ftag%3APaul%2BPriestman%26quot%3B%26gt%3BPaul+Priestman%26lt%3B%2Fa%26gt%3B%2C++%26lt%3Ba+href%3D%26quot%3Bhttps%3A%2F%2Fvimeo.com%2Ftag%3Adesign%26quot%3B%26gt%3Bdesign%26lt%3B%2Fa%26gt%3B++and+%26lt%3Ba+href%3D%26quot%3Bhttps%3A%2F%2Fvimeo.com%2Ftag%3AGateshead%2BCollege%26quot%3B%26gt%3BGateshead+College%26lt%3B%2Fa%26gt%3B%26lt%3B%2Fp%26gt%3B%3C%2Fdescription%3E%3Cguid+isPermaLink%3D%22false%22%3Etag%3Avimeo%2C2015-12-15%3Aclip148993338%3C%2Fguid%3E%3Cmedia%3Acontent%3E%3Cmedia%3Aplayer+url%3D%22https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F148993338%22%2F%3E%3Cmedia%3Acredit+role%3D%22author%22+scheme%3D%22https%3A%2F%2Fvimeo.com%2Fuser29751154%22%3E%3C%2Fmedia%3Acredit%3E%3Cmedia%3Athumbnail+height%3D%22540%22+width%3D%22960%22+url%3D%22https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F548100055_960.jpg%22%2F%3E%3Cmedia%3Atitle%3EPaul+Priestman+at+Gateshead+College%3C%2Fmedia%3Atitle%3E%3C%2Fmedia%3Acontent%3E%3C%2Fitem%3E%0A%3C%2Fchannel%3E%3C%2Frss%3E'
   12     1        NEW                                              $4      'SimpleXMLElement'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $4
   14     5      > JMPZ                                                     <false>, ->8
   15     6    >   ECHO                                                     'PHP%2FLIBXML+unsupported%2Ftoo+old.'
   16     7      > RETURN                                                   null
   19     8    >   ECHO                                                     'ibxml+version%3A+'
          9        ECHO                                                     '2.9.4'
         10        ECHO                                                     '%0A'
   21    11        ASSIGN                                                   !2, !1
   23    12        ECHO                                                     'tests%3A+'
         13        FETCH_OBJ_R                                      ~8      !2, 'rss'
         14        FETCH_OBJ_R                                      ~9      ~8, 'channel'
         15        FETCH_OBJ_R                                      ~10     ~9, 'item'
         16        ECHO                                                     ~10
         17        ECHO                                                     '%0A'
   24    18        ECHO                                                     'via+attributes%28%29%3A+'
         19        FETCH_OBJ_R                                      ~11     !2, 'channel'
         20        FETCH_OBJ_R                                      ~12     ~11, 'item'
         21        INIT_METHOD_CALL                                         ~12, 'children'
         22        SEND_VAL_EX                                              'media'
         23        SEND_VAL_EX                                              <true>
         24        DO_FCALL                                      0  $13     
         25        FETCH_OBJ_R                                      ~14     $13, 'content'
         26        ECHO                                                     ~14
         27        ECHO                                                     '%0A'
   25    28        ECHO                                                     'via+array-access%3A+'
         29        FETCH_OBJ_R                                      ~15     !2, 'channel'
         30        FETCH_OBJ_R                                      ~16     ~15, 'item'
         31        INIT_METHOD_CALL                                         ~16, 'children'
         32        SEND_VAL_EX                                              'media'
         33        SEND_VAL_EX                                              <true>
         34        DO_FCALL                                      0  $17     
         35        FETCH_OBJ_R                                      ~18     $17, 'content'
         36        ECHO                                                     ~18
         37        ECHO                                                     '%0A'
   26    38        ECHO                                                     'via+property++++%3A+'
         39        FETCH_OBJ_R                                      ~19     !2, 'channel'
         40        FETCH_OBJ_R                                      ~20     ~19, 'item'
         41        INIT_METHOD_CALL                                         ~20, 'children'
         42        SEND_VAL_EX                                              'media'
         43        SEND_VAL_EX                                              <true>
         44        DO_FCALL                                      0  $21     
         45        FETCH_OBJ_R                                      ~22     $21, 'content'
         46        ECHO                                                     ~22
         47        ECHO                                                     '%0A'
         48      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.14 ms | 1403 KiB | 13 Q