3v4l.org

run code in 300+ PHP versions simultaneously
<?php $this_method = ['foo' => ['bar' => ['bard' => ['food' => 'barf']]]]; $indexes = ['foo', 'bar', 'bard']; function getBySuccessiveKeys(array $haystack, array $keys) { foreach ($keys as $key) { if (!key_exists($key, $haystack)) { break; } $haystack = $haystack[$key]; } return $haystack; } var_export(getBySuccessiveKeys($this_method, $indexes));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F4udk
function name:  (null)
number of ops:  10
compiled vars:  !0 = $this_method, !1 = $indexes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
   17     2        INIT_FCALL                                               'var_export'
          3        INIT_FCALL                                               'getbysuccessivekeys'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function getbysuccessivekeys:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
Branch analysis from position: 14
filename:       /in/F4udk
function name:  getBySuccessiveKeys
number of ops:  17
compiled vars:  !0 = $haystack, !1 = $keys, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2      > FE_RESET_R                                       $3      !1, ->14
          3    > > FE_FETCH_R                                               $3, !2, ->14
   10     4    >   INIT_FCALL                                               'key_exists'
          5        SEND_VAR                                                 !2
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $4      
          8        BOOL_NOT                                         ~5      $4
          9      > JMPZ                                                     ~5, ->11
   11    10    > > JMP                                                      ->14
   13    11    >   FETCH_DIM_R                                      ~6      !0, !2
         12        ASSIGN                                                   !0, ~6
    9    13      > JMP                                                      ->3
         14    >   FE_FREE                                                  $3
   15    15      > RETURN                                                   !0
   16    16*     > RETURN                                                   null

End of function getbysuccessivekeys

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.59 ms | 1014 KiB | 16 Q