3v4l.org

run code in 500+ PHP versions simultaneously
<?php $feeds = <<<SOURCE <rss xmlns:content="" xmlns:wfw="" xmlns:dc="" xmlns:atom="" xmlns:sy="" xmlns:slash="" version="2.0"> <channel> <item> <title>Title1</title> <link>Link</link> <pubDate>Date</pubDate> <content:encoded> <![CDATA[ This is description 1 ]]> <![CDATA[ This is description 2 ]]> </content:encoded> <media:content url="URL" type="image/jpeg"> <media:description> <![CDATA[ Text ]]> </media:description> </media:content> </item> <item> -- this item tag does not have media: content <title>Title2</title> <link>Link2</link> <pubDate>Date2</pubDate> <content:encoded> <![CDATA[ This is description 3 ]]> <![CDATA[ This is description 4 ]]> </content:encoded> </item> <item> <title>Title3</title> <link>Link3</link> <pubDate>Date3</pubDate> <content:encoded> <![CDATA[ This is description 5 ]]> <![CDATA[ This is description 6 ]]> </content:encoded> <media:content url="UR1L" type="image/jpeg"> <media:description> <![CDATA[ Text 2 ]]> </media:description> </media:content> </item> </channel> </rss> SOURCE; function feeds() { global $feeds; $rss = @simplexml_load_string($feeds); foreach ($rss->channel->item as $entry) { if (isset($entry->{'media:content'})) { $url = (string)$entry->{'media:content'}->attributes()->url; $description = (string)$entry->{'media:content'}->{'media:description'}; echo "$url\n"; echo "$description\n"; } } } feeds();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YPLEd
function name:  (null)
number of ops:  4
compiled vars:  !0 = $feeds
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%3Crss+xmlns%3Acontent%3D%22%22+xmlns%3Awfw%3D%22%22+xmlns%3Adc%3D%22%22+xmlns%3Aatom%3D%22%22+xmlns%3Asy%3D%22%22+xmlns%3Aslash%3D%22%22+version%3D%222.0%22%3E%0A++++%3Cchannel%3E%0A++++++++%3Citem%3E%0A++++++++++++%3Ctitle%3ETitle1%3C%2Ftitle%3E%0A++++++++++++%3Clink%3ELink%3C%2Flink%3E%0A++++++++++++%3CpubDate%3EDate%3C%2FpubDate%3E%0A++++++++++++%3Ccontent%3Aencoded%3E%0A++++++++++++++++%3C%21%5BCDATA%5B+This+is+description+1+%5D%5D%3E%0A++++++++++++++++%3C%21%5BCDATA%5B+This+is+description+2+%5D%5D%3E%0A++++++++++++%3C%2Fcontent%3Aencoded%3E%0A++++++++++++%3Cmedia%3Acontent+url%3D%22URL%22+type%3D%22image%2Fjpeg%22%3E%0A++++++++++++++++%3Cmedia%3Adescription%3E%0A++++++++++++++++++++%3C%21%5BCDATA%5B+Text+%5D%5D%3E%0A++++++++++++++++%3C%2Fmedia%3Adescription%3E%0A++++++++++++%3C%2Fmedia%3Acontent%3E%0A++++++++%3C%2Fitem%3E%0A%0A++++++++%3Citem%3E+--+this+item+tag+does+not+have+media%3A+content%0A++++++++++++%3Ctitle%3ETitle2%3C%2Ftitle%3E%0A++++++++++++%3Clink%3ELink2%3C%2Flink%3E%0A++++++++++++%3CpubDate%3EDate2%3C%2FpubDate%3E%0A++++++++++++%3Ccontent%3Aencoded%3E%0A++++++++++++++++%3C%21%5BCDATA%5B+This+is+description+3+%5D%5D%3E%0A++++++++++++++++%3C%21%5BCDATA%5B+This+is+description+4+%5D%5D%3E%0A++++++++++++%3C%2Fcontent%3Aencoded%3E%0A++++++++%3C%2Fitem%3E%0A%0A++++++++%3Citem%3E%0A++++++++++++%3Ctitle%3ETitle3%3C%2Ftitle%3E%0A++++++++++++%3Clink%3ELink3%3C%2Flink%3E%0A++++++++++++%3CpubDate%3EDate3%3C%2FpubDate%3E%0A++++++++++++%3Ccontent%3Aencoded%3E%0A++++++++++++++++%3C%21%5BCDATA%5B+This+is+description+5+%5D%5D%3E%0A++++++++++++++++%3C%21%5BCDATA%5B+This+is+description+6+%5D%5D%3E%0A++++++++++++%3C%2Fcontent%3Aencoded%3E%0A++++++++++++%3Cmedia%3Acontent+url%3D%22UR1L%22+type%3D%22image%2Fjpeg%22%3E%0A++++++++++++++++%3Cmedia%3Adescription%3E%0A++++++++++++++++++++%3C%21%5BCDATA%5B+Text+2+%5D%5D%3E%0A++++++++++++++++%3C%2Fmedia%3Adescription%3E%0A++++++++++++%3C%2Fmedia%3Acontent%3E%0A++++++++%3C%2Fitem%3E%0A++++%3C%2Fchannel%3E%0A%3C%2Frss%3E'
   63     1        INIT_FCALL                                                   'feeds'
          2        DO_FCALL                                          0          
          3      > RETURN                                                       1

Function feeds:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 30
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 30
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 29
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 29
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/YPLEd
function name:  feeds
number of ops:  32
compiled vars:  !0 = $feeds, !1 = $rss, !2 = $entry, !3 = $url, !4 = $description
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   51     0  E >   BIND_GLOBAL                                                  !0, 'feeds'
   52     1        BEGIN_SILENCE                                        ~5      
          2        INIT_FCALL                                                   'simplexml_load_string'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $6      
          5        END_SILENCE                                                  ~5
          6        ASSIGN                                                       !1, $6
   53     7        FETCH_OBJ_R                                          ~8      !1, 'channel'
          8        FETCH_OBJ_R                                          ~9      ~8, 'item'
          9      > FE_RESET_R                                           $10     ~9, ->30
         10    > > FE_FETCH_R                                                   $10, !2, ->30
   54    11    >   ISSET_ISEMPTY_PROP_OBJ                                       !2, 'media%3Acontent'
         12      > JMPZ                                                         ~11, ->29
   55    13    >   FETCH_OBJ_R                                          ~12     !2, 'media%3Acontent'
         14        INIT_METHOD_CALL                                             ~12, 'attributes'
         15        DO_FCALL                                          0  $13     
         16        FETCH_OBJ_R                                          ~14     $13, 'url'
         17        CAST                                              6  ~15     ~14
         18        ASSIGN                                                       !3, ~15
   56    19        FETCH_OBJ_R                                          ~17     !2, 'media%3Acontent'
         20        FETCH_OBJ_R                                          ~18     ~17, 'media%3Adescription'
         21        CAST                                              6  ~19     ~18
         22        ASSIGN                                                       !4, ~19
   57    23        NOP                                                          
         24        FAST_CONCAT                                          ~21     !3, '%0A'
         25        ECHO                                                         ~21
   58    26        NOP                                                          
         27        FAST_CONCAT                                          ~22     !4, '%0A'
         28        ECHO                                                         ~22
   53    29    > > JMP                                                          ->10
         30    >   FE_FREE                                                      $10
   61    31      > RETURN                                                       null

End of function feeds

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
208.08 ms | 2800 KiB | 15 Q