3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ans = <<<XML <?xml version="1.0" encoding="utf-8"?> <ResponseDoc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <response> <index>1</index> <statusCode>Success</statusCode> </response> <response> <index>2</index> <statusCode>Success</statusCode> </response> <response> <index>3</index> <statusCode>Success</statusCode> </response> <response> <index>4</index> <statusCode>Success</statusCode> </response> </ResponseDoc> XML; $r1 = simplexml_load_string($ans); $responses = $r1->xpath('//response'); foreach ($responses as $item) { echo $item->index, PHP_EOL; echo $item->statusCode, PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/BXhC2
function name:  (null)
number of ops:  20
compiled vars:  !0 = $ans, !1 = $r1, !2 = $responses, !3 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22utf-8%22%3F%3E%0A%3CResponseDoc+xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance%22+xmlns%3Axsd%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%22%3E%0A++%3Cresponse%3E%0A++++%3Cindex%3E1%3C%2Findex%3E%0A++++%3CstatusCode%3ESuccess%3C%2FstatusCode%3E%0A++%3C%2Fresponse%3E%0A++%3Cresponse%3E%0A++++%3Cindex%3E2%3C%2Findex%3E%0A++++%3CstatusCode%3ESuccess%3C%2FstatusCode%3E%0A++%3C%2Fresponse%3E%0A++%3Cresponse%3E%0A++++%3Cindex%3E3%3C%2Findex%3E%0A++++%3CstatusCode%3ESuccess%3C%2FstatusCode%3E%0A++%3C%2Fresponse%3E%0A++%3Cresponse%3E%0A++++%3Cindex%3E4%3C%2Findex%3E%0A++++%3CstatusCode%3ESuccess%3C%2FstatusCode%3E%0A++%3C%2Fresponse%3E%0A%3C%2FResponseDoc%3E'
   24     1        INIT_FCALL                                               'simplexml_load_string'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
   25     5        INIT_METHOD_CALL                                         !1, 'xpath'
          6        SEND_VAL_EX                                              '%2F%2Fresponse'
          7        DO_FCALL                                      0  $7      
          8        ASSIGN                                                   !2, $7
   27     9      > FE_RESET_R                                       $9      !2, ->18
         10    > > FE_FETCH_R                                               $9, !3, ->18
   28    11    >   FETCH_OBJ_R                                      ~10     !3, 'index'
         12        ECHO                                                     ~10
         13        ECHO                                                     '%0A'
   29    14        FETCH_OBJ_R                                      ~11     !3, 'statusCode'
         15        ECHO                                                     ~11
         16        ECHO                                                     '%0A'
   27    17      > JMP                                                      ->10
         18    >   FE_FREE                                                  $9
   30    19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.4 ms | 1001 KiB | 14 Q