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"]'); print_r($v); 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 = 42
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 42
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 40
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
filename:       /in/mm1KL
function name:  (null)
number of ops:  44
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, ->42
          9    > > FE_FETCH_R                                               $9, !2, ->42
   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        INIT_FCALL                                               'print_r'
         21        SEND_VAR                                                 !4
         22        DO_ICALL                                                 
   29    23        FETCH_DIM_R                                      ~16     !4, 0
         24      > JMPZ                                                     ~16, ->40
   30    25    >   FETCH_OBJ_R                                      ~17     !2, 'id'
         26        ECHO                                                     ~17
   31    27        FETCH_OBJ_R                                      ~18     !2, 'image'
         28        ECHO                                                     ~18
   32    29        FETCH_OBJ_R                                      ~19     !2, 'name'
         30        ECHO                                                     ~19
   33    31        FETCH_OBJ_R                                      ~20     !2, 'company'
         32        ECHO                                                     ~20
   34    33        FETCH_OBJ_R                                      ~21     !2, 'street'
         34        ECHO                                                     ~21
   35    35        FETCH_OBJ_R                                      ~22     !2, 'city'
         36        ECHO                                                     ~22
   36    37        FETCH_OBJ_R                                      ~23     !2, 'phone'
         38        ECHO                                                     ~23
         39      > JMP                                                      ->41
   38    40    >   ECHO                                                     'No+records'
   25    41    > > JMP                                                      ->9
         42    >   FE_FREE                                                  $9
   40    43      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.02 ms | 1400 KiB | 17 Q