3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tpnb = 5; test(); die(); function test() { global $tpnb; var_dump($tpnb); $xmlStruct = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <templates> <object type="obj_1" label="Label for object 1"></object> <object type="obj_2" label="Label for object 2"></object> <object type="obj_3" label="Label for object 3"></object> <object type="obj_4" label="Label for object 4"></object> <object type="obj_5" label="Label for object 5"></object> <object type="obj_6" label="Label for object 6"></object> <object type="obj_7" label="Label for object 7"></object> <object type="obj_8" label="Label for object 8"></object> <object type="obj_9" label="Label for object 9"></object> <object type="obj_10" label="Label for object 10"></object> </templates> EOF; $tplxml = simplexml_load_string($xmlStruct); var_dump($tplxml->object[$tpnb]); var_dump($tplxml->object[(int) $tpnb]); var_dump($tplxml->object[($tpnb + 1 - 1)]); $tpnbx = $tpnb; unset($tpnb); $tpnb = $tpnbx; var_dump($tplxml->object[$tpnb]); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/IiZvt
function name:  (null)
number of ops:  5
compiled vars:  !0 = $tpnb
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 5
    5     1        INIT_FCALL_BY_NAME                                       'test'
          2        DO_FCALL                                      0          
    6     3      > EXIT                                                     
   38     4*     > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IiZvt
function name:  test
number of ops:  36
compiled vars:  !0 = $tpnb, !1 = $xmlStruct, !2 = $tplxml, !3 = $tpnbx
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   BIND_GLOBAL                                              !0, 'tpnb'
   12     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   14     4        ASSIGN                                                   !1, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%0A%3Ctemplates%3E%0A++++%3Cobject+type%3D%22obj_1%22+label%3D%22Label+for+object+1%22%3E%3C%2Fobject%3E%0A++++%3Cobject+type%3D%22obj_2%22+label%3D%22Label+for+object+2%22%3E%3C%2Fobject%3E%0A++++%3Cobject+type%3D%22obj_3%22+label%3D%22Label+for+object+3%22%3E%3C%2Fobject%3E%0A++++%3Cobject+type%3D%22obj_4%22+label%3D%22Label+for+object+4%22%3E%3C%2Fobject%3E%0A++++%3Cobject+type%3D%22obj_5%22+label%3D%22Label+for+object+5%22%3E%3C%2Fobject%3E%0A++++%3Cobject+type%3D%22obj_6%22+label%3D%22Label+for+object+6%22%3E%3C%2Fobject%3E%0A++++%3Cobject+type%3D%22obj_7%22+label%3D%22Label+for+object+7%22%3E%3C%2Fobject%3E%0A++++%3Cobject+type%3D%22obj_8%22+label%3D%22Label+for+object+8%22%3E%3C%2Fobject%3E%0A++++%3Cobject+type%3D%22obj_9%22+label%3D%22Label+for+object+9%22%3E%3C%2Fobject%3E%0A++++%3Cobject+type%3D%22obj_10%22+label%3D%22Label+for+object+10%22%3E%3C%2Fobject%3E%0A%3C%2Ftemplates%3E'
   29     5        INIT_FCALL                                               'simplexml_load_string'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !2, $6
   31     9        INIT_FCALL                                               'var_dump'
         10        FETCH_OBJ_R                                      ~8      !2, 'object'
         11        FETCH_DIM_R                                      ~9      ~8, !0
         12        SEND_VAL                                                 ~9
         13        DO_ICALL                                                 
   32    14        INIT_FCALL                                               'var_dump'
         15        CAST                                          4  ~12     !0
         16        FETCH_OBJ_R                                      ~11     !2, 'object'
         17        FETCH_DIM_R                                      ~13     ~11, ~12
         18        SEND_VAL                                                 ~13
         19        DO_ICALL                                                 
   33    20        INIT_FCALL                                               'var_dump'
         21        ADD                                              ~16     !0, 1
         22        SUB                                              ~17     ~16, 1
         23        FETCH_OBJ_R                                      ~15     !2, 'object'
         24        FETCH_DIM_R                                      ~18     ~15, ~17
         25        SEND_VAL                                                 ~18
         26        DO_ICALL                                                 
   34    27        ASSIGN                                                   !3, !0
   35    28        UNSET_CV                                                 !0
   36    29        ASSIGN                                                   !0, !3
   37    30        INIT_FCALL                                               'var_dump'
         31        FETCH_OBJ_R                                      ~22     !2, 'object'
         32        FETCH_DIM_R                                      ~23     ~22, !0
         33        SEND_VAL                                                 ~23
         34        DO_ICALL                                                 
   38    35      > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.22 ms | 1400 KiB | 17 Q