3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = "<Users> <User _un='NewGuy'> <UserInfo _pw='pass' _cr='0'/> </User> <User _un='Farach'> <UserInfo _pw='anthony1121@gmail.co' _cr='11110'/> </User> </Users>"; $xml = simplexml_load_string( $xml); foreach( $xml->xpath( './/User') as $child) { if($child->attributes()['_un'] = "Farach"){ echo $child->UserInfo->attributes()['_cr']; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 22
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 22
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 21
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/9njMV
function name:  (null)
number of ops:  24
compiled vars:  !0 = $xml, !1 = $child
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3CUsers%3E%0A%3CUser+_un%3D%27NewGuy%27%3E%0A%3CUserInfo+_pw%3D%27pass%27+_cr%3D%270%27%2F%3E%0A%3C%2FUser%3E%0A%3CUser+_un%3D%27Farach%27%3E%0A%3CUserInfo+_pw%3D%27anthony1121%40gmail.co%27+_cr%3D%2711110%27%2F%3E%0A%3C%2FUser%3E%0A%3C%2FUsers%3E'
   11     1        INIT_FCALL                                               'simplexml_load_string'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !0, $3
   13     5        INIT_METHOD_CALL                                         !0, 'xpath'
          6        SEND_VAL_EX                                              '.%2F%2FUser'
          7        DO_FCALL                                      0  $5      
          8      > FE_RESET_R                                       $6      $5, ->22
          9    > > FE_FETCH_R                                               $6, !1, ->22
   15    10    >   INIT_METHOD_CALL                                         !1, 'attributes'
         11        DO_FCALL                                      0  $7      
         12        SEPARATE                                         $7      $7
         13        ASSIGN_DIM                                       ~8      $7, '_un'
         14        OP_DATA                                                  'Farach'
         15      > JMPZ                                                     ~8, ->21
   16    16    >   FETCH_OBJ_R                                      ~9      !1, 'UserInfo'
         17        INIT_METHOD_CALL                                         ~9, 'attributes'
         18        DO_FCALL                                      0  $10     
         19        FETCH_DIM_R                                      ~11     $10, '_cr'
         20        ECHO                                                     ~11
   13    21    > > JMP                                                      ->9
         22    >   FE_FREE                                                  $6
   18    23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.95 ms | 1396 KiB | 15 Q