3v4l.org

run code in 300+ PHP versions simultaneously
<?php $people['men'] = [ 'first_name' => 'John', 'last_name' => 'Doe' ]; $name = ['men', 'first_name']; echo read($people,$name); function read($multidimensionalArray,$flatArray){ $cur = $multidimensionalArray; foreach($flatArray as $key) { $cur = $cur[$key]; } return $cur; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/96EnQ
function name:  (null)
number of ops:  9
compiled vars:  !0 = $people, !1 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN_DIM                                               !0, 'men'
    4     1        OP_DATA                                                  <array>
    7     2        ASSIGN                                                   !1, <array>
    9     3        INIT_FCALL_BY_NAME                                       'read'
          4        SEND_VAR_EX                                              !0
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0  $4      
          7        ECHO                                                     $4
   18     8      > RETURN                                                   1

Function read:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/96EnQ
function name:  read
number of ops:  11
compiled vars:  !0 = $multidimensionalArray, !1 = $flatArray, !2 = $cur, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        ASSIGN                                                   !2, !0
   13     3      > FE_RESET_R                                       $5      !1, ->8
          4    > > FE_FETCH_R                                               $5, !3, ->8
   15     5    >   FETCH_DIM_R                                      ~6      !2, !3
          6        ASSIGN                                                   !2, ~6
   13     7      > JMP                                                      ->4
          8    >   FE_FREE                                                  $5
   17     9      > RETURN                                                   !2
   18    10*     > RETURN                                                   null

End of function read

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.97 ms | 1002 KiB | 13 Q