3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml_string = '<?xml version="1.0"?> <result> <code> <name>Warszawa</name> <lat>52.25</lat> <lng>21.0</lng> <otherDetails>some Warsaw info here</otherDetails> </code> <code> <name>Somewhere Else</name> <lat>42</lat> <lng>99</lng> <otherDetails>some info about somewhere else here</otherDetails> </code> </result> '; $xml = simplexml_load_string($xml_string); echo "\n\n\$xml:\n\n"; print_r($xml); $codeZero = null; foreach ($xml->code->children() as $child) { $codeZero = $child; } echo "\n\n\$codeZero:\n\n"; var_dump($codeZero); $lat = null; foreach ($codeZero->children() as $child) { if (isset($child->lat)) { $lat = $child->lat; } } echo "\n\n\$lat:\n\n"; var_dump($lat);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 17
2 jumps found. (Code = 77) Position 1 = 26, Position 2 = 32
Branch analysis from position: 26
2 jumps found. (Code = 78) Position 1 = 27, Position 2 = 32
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 31
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 31
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
Branch analysis from position: 17
filename:       /in/7FWgv
function name:  (null)
number of ops:  38
compiled vars:  !0 = $xml_string, !1 = $xml, !2 = $codeZero, !3 = $child, !4 = $lat
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3C%3Fxml+version%3D%221.0%22%3F%3E%0A%3Cresult%3E%0A++++%3Ccode%3E%0A++++++++%3Cname%3EWarszawa%3C%2Fname%3E%0A++++++++%3Clat%3E52.25%3C%2Flat%3E%0A++++++++%3Clng%3E21.0%3C%2Flng%3E%0A++++++++%3CotherDetails%3Esome+Warsaw+info+here%3C%2FotherDetails%3E%0A++++%3C%2Fcode%3E%0A++++%3Ccode%3E%0A++++++++%3Cname%3ESomewhere+Else%3C%2Fname%3E%0A++++++++%3Clat%3E42%3C%2Flat%3E%0A++++++++%3Clng%3E99%3C%2Flng%3E%0A++++++++%3CotherDetails%3Esome+info+about+somewhere+else+here%3C%2FotherDetails%3E%0A++++%3C%2Fcode%3E%0A%3C%2Fresult%3E%0A'
   20     1        INIT_FCALL                                               'simplexml_load_string'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $6      
          4        ASSIGN                                                   !1, $6
   22     5        ECHO                                                     '%0A%0A%24xml%3A%0A%0A'
   24     6        INIT_FCALL                                               'print_r'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
   27     9        ASSIGN                                                   !2, null
   28    10        FETCH_OBJ_R                                      ~10     !1, 'code'
         11        INIT_METHOD_CALL                                         ~10, 'children'
         12        DO_FCALL                                      0  $11     
         13      > FE_RESET_R                                       $12     $11, ->17
         14    > > FE_FETCH_R                                               $12, !3, ->17
   29    15    >   ASSIGN                                                   !2, !3
   28    16      > JMP                                                      ->14
         17    >   FE_FREE                                                  $12
   32    18        ECHO                                                     '%0A%0A%24codeZero%3A%0A%0A'
   34    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                                 
   36    22        ASSIGN                                                   !4, null
   37    23        INIT_METHOD_CALL                                         !2, 'children'
         24        DO_FCALL                                      0  $16     
         25      > FE_RESET_R                                       $17     $16, ->32
         26    > > FE_FETCH_R                                               $17, !3, ->32
   38    27    >   ISSET_ISEMPTY_PROP_OBJ                                   !3, 'lat'
         28      > JMPZ                                                     ~18, ->31
   39    29    >   FETCH_OBJ_R                                      ~19     !3, 'lat'
         30        ASSIGN                                                   !4, ~19
   37    31    > > JMP                                                      ->26
         32    >   FE_FREE                                                  $17
   43    33        ECHO                                                     '%0A%0A%24lat%3A%0A%0A'
   45    34        INIT_FCALL                                               'var_dump'
         35        SEND_VAR                                                 !4
         36        DO_ICALL                                                 
         37      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.44 ms | 1433 KiB | 16 Q