3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xmlData = '<?xml version="1.0" encoding="ISO-8859-1"?> <agents> <agent> <id>1</id> <image> img/primary-nav-logo.png</image> <name>Tommy Jenkin</name> <company>CJenkins Insurance</company> <street>Insurance150 S State Stree</street> <city>Linkend</city> <phone>(773) 561-4331</phone> </agent> <agent> <id>2</id> <image> img/primary-nav-logo.png</image> <name>Tommy Jenkin</name> <company>CJenkins Insurance</company> <street>Insurance150 S State Stree</street> <city>Linkend</city> <phone>(773) 561-4331</phone> </agent> </agents>'; $xml = simplexml_load_string($xmlData); foreach($xml->xpath('//agent') as $item) { $row = simplexml_load_string($item->asXML()); $v = $row->xpath('//id[. ="1"]'); if($v[0]){ print $item->id; print $item->image; print $item->name; print $item->company; print $item->street; print $item->city; print $item->phone; }else{ echo 'No records'; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 39
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 39
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 37
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
filename:       /in/b0ZB6
function name:  (null)
number of ops:  41
compiled vars:  !0 = $xmlData, !1 = $xml, !2 = $item, !3 = $row, !4 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22ISO-8859-1%22%3F%3E%0A%3Cagents%3E%0A++++%3Cagent%3E%0A++++%3Cid%3E1%3C%2Fid%3E%0A++++%3Cimage%3E+img%2Fprimary-nav-logo.png%3C%2Fimage%3E%0A++++%3Cname%3ETommy+Jenkin%3C%2Fname%3E%0A++++%3Ccompany%3ECJenkins+Insurance%3C%2Fcompany%3E%0A++++%3Cstreet%3EInsurance150+S+State+Stree%3C%2Fstreet%3E%0A++++%3Ccity%3ELinkend%3C%2Fcity%3E%0A++++%3Cphone%3E%28773%29+561-4331%3C%2Fphone%3E%0A++++%3C%2Fagent%3E%0A++++%3Cagent%3E%0A++++%3Cid%3E2%3C%2Fid%3E%0A++++%3Cimage%3E+img%2Fprimary-nav-logo.png%3C%2Fimage%3E%0A++++%3Cname%3ETommy+Jenkin%3C%2Fname%3E%0A++++%3Ccompany%3ECJenkins+Insurance%3C%2Fcompany%3E%0A++++%3Cstreet%3EInsurance150+S+State+Stree%3C%2Fstreet%3E%0A++++%3Ccity%3ELinkend%3C%2Fcity%3E%0A++++%3Cphone%3E%28773%29+561-4331%3C%2Fphone%3E%0A++++%3C%2Fagent%3E%0A%3C%2Fagents%3E'
   24     1        INIT_FCALL                                               'simplexml_load_string'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $6      
          4        ASSIGN                                                   !1, $6
   25     5        INIT_METHOD_CALL                                         !1, 'xpath'
          6        SEND_VAL_EX                                              '%2F%2Fagent'
          7        DO_FCALL                                      0  $8      
          8      > FE_RESET_R                                       $9      $8, ->39
          9    > > FE_FETCH_R                                               $9, !2, ->39
   26    10    >   INIT_FCALL                                               'simplexml_load_string'
         11        INIT_METHOD_CALL                                         !2, 'asXML'
         12        DO_FCALL                                      0  $10     
         13        SEND_VAR                                                 $10
         14        DO_ICALL                                         $11     
         15        ASSIGN                                                   !3, $11
   27    16        INIT_METHOD_CALL                                         !3, 'xpath'
         17        SEND_VAL_EX                                              '%2F%2Fid%5B.+%3D%221%22%5D'
         18        DO_FCALL                                      0  $13     
         19        ASSIGN                                                   !4, $13
   28    20        FETCH_DIM_R                                      ~15     !4, 0
         21      > JMPZ                                                     ~15, ->37
   29    22    >   FETCH_OBJ_R                                      ~16     !2, 'id'
         23        ECHO                                                     ~16
   30    24        FETCH_OBJ_R                                      ~17     !2, 'image'
         25        ECHO                                                     ~17
   31    26        FETCH_OBJ_R                                      ~18     !2, 'name'
         27        ECHO                                                     ~18
   32    28        FETCH_OBJ_R                                      ~19     !2, 'company'
         29        ECHO                                                     ~19
   33    30        FETCH_OBJ_R                                      ~20     !2, 'street'
         31        ECHO                                                     ~20
   34    32        FETCH_OBJ_R                                      ~21     !2, 'city'
         33        ECHO                                                     ~21
   35    34        FETCH_OBJ_R                                      ~22     !2, 'phone'
         35        ECHO                                                     ~22
         36      > JMP                                                      ->38
   37    37    >   ECHO                                                     'No+records'
   25    38    > > JMP                                                      ->9
         39    >   FE_FREE                                                  $9
   39    40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170 ms | 1400 KiB | 15 Q