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 = '<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";
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/f1fmr
function name:  (null)
number of ops:  43
compiled vars:  !0 = $buffer, !1 = $xml, !2 = $youtube
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, '%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'
    9     1        NEW                                              $4      'SimpleXMLElement'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $4
   11     5      > JMPZ                                                     <false>, ->8
   12     6    >   ECHO                                                     'PHP%2FLIBXML+unsupported%2Ftoo+old.'
   13     7      > RETURN                                                   null
   16     8    >   ECHO                                                     'ibxml+version%3A+'
          9        ECHO                                                     '2.9.4'
         10        ECHO                                                     '%0A'
   18    11        ASSIGN                                                   !2, !1
   20    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'
   21    18        ECHO                                                     'via+attributes%28%29%3A+'
         19        INIT_METHOD_CALL                                         !2, 'children'
         20        SEND_VAL_EX                                              'media'
         21        SEND_VAL_EX                                              <true>
         22        DO_FCALL                                      0  $11     
         23        FETCH_OBJ_R                                      ~12     $11, 'content'
         24        ECHO                                                     ~12
         25        ECHO                                                     '%0A'
   22    26        ECHO                                                     'via+array-access%3A+'
         27        INIT_METHOD_CALL                                         !2, 'children'
         28        SEND_VAL_EX                                              'media'
         29        SEND_VAL_EX                                              <true>
         30        DO_FCALL                                      0  $13     
         31        FETCH_OBJ_R                                      ~14     $13, 'content'
         32        ECHO                                                     ~14
         33        ECHO                                                     '%0A'
   23    34        ECHO                                                     'via+property++++%3A+'
         35        INIT_METHOD_CALL                                         !2, 'children'
         36        SEND_VAL_EX                                              'media'
         37        SEND_VAL_EX                                              <true>
         38        DO_FCALL                                      0  $15     
         39        FETCH_OBJ_R                                      ~16     $15, 'content'
         40        ECHO                                                     ~16
         41        ECHO                                                     '%0A'
         42      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.69 ms | 1399 KiB | 13 Q