3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xmlstr = <<<XML <xml> <medium val="organic"> <source val=""> <campaign val=""> <lever3 val="seo">foo</lever3> <lever2 val="seo">bar</lever2> <lever1 val="trafic_gratuit" /> </campaign> </source> </medium> <medium val="cpa"> <source val="affilinet"> <campaign val=""> <lever3 val="affiliation" /> <lever2 val="affiliation" /> <lever1 val="trafic_payant" /> </campaign> </source> </medium> </xml> XML; $xml = new SimpleXMLElement($xmlstr); $results = $xml->xpath("//medium/attribute::cpa"); foreach ($results as $result) { foreach($result->attributes() as $val) { echo "val:: {$val}.\n"; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 22
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 22
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 20
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 20
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 20
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/unIMF
function name:  (null)
number of ops:  24
compiled vars:  !0 = $xmlstr, !1 = $xml, !2 = $results, !3 = $result, !4 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Cxml%3E%0A++++%3Cmedium+val%3D%22organic%22%3E%0A++++++++%3Csource+val%3D%22%22%3E%0A++++++++++++%3Ccampaign+val%3D%22%22%3E%0A%09%09%09%09%3Clever3+val%3D%22seo%22%3Efoo%3C%2Flever3%3E%0A%09%09%09%09%3Clever2+val%3D%22seo%22%3Ebar%3C%2Flever2%3E%0A++++++++++++++++%3Clever1+val%3D%22trafic_gratuit%22+%2F%3E%0A++++++++++++%3C%2Fcampaign%3E%0A++++++++%3C%2Fsource%3E%0A++++%3C%2Fmedium%3E%0A%0A%09%3Cmedium+val%3D%22cpa%22%3E%0A%09%09%3Csource+val%3D%22affilinet%22%3E%0A%09%09%09%3Ccampaign+val%3D%22%22%3E%0A%09%09%09%09%3Clever3+val%3D%22affiliation%22+%2F%3E%0A%09%09%09%09%3Clever2+val%3D%22affiliation%22+%2F%3E%0A%09%09%09%09%3Clever1+val%3D%22trafic_payant%22+%2F%3E%0A%09%09%09%3C%2Fcampaign%3E%0A%09%09%3C%2Fsource%3E%0A%09%3C%2Fmedium%3E%0A%3C%2Fxml%3E'
   26     1        NEW                                              $6      'SimpleXMLElement'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $6
   28     5        INIT_METHOD_CALL                                         !1, 'xpath'
          6        SEND_VAL_EX                                              '%2F%2Fmedium%2Fattribute%3A%3Acpa'
          7        DO_FCALL                                      0  $9      
          8        ASSIGN                                                   !2, $9
   29     9      > FE_RESET_R                                       $11     !2, ->22
         10    > > FE_FETCH_R                                               $11, !3, ->22
   30    11    >   INIT_METHOD_CALL                                         !3, 'attributes'
         12        DO_FCALL                                      0  $12     
         13      > FE_RESET_R                                       $13     $12, ->20
         14    > > FE_FETCH_R                                               $13, !4, ->20
   31    15    >   ROPE_INIT                                     3  ~15     'val%3A%3A+'
         16        ROPE_ADD                                      1  ~15     ~15, !4
         17        ROPE_END                                      2  ~14     ~15, '.%0A'
         18        ECHO                                                     ~14
   30    19      > JMP                                                      ->14
         20    >   FE_FREE                                                  $13
   29    21      > JMP                                                      ->10
         22    >   FE_FREE                                                  $11
   33    23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.24 ms | 1386 KiB | 13 Q