3v4l.org

run code in 300+ PHP versions simultaneously
<?php function flatCall($data_arr, $data_arr_call){ $current = $data_arr; foreach($data_arr_call as $key){ $current = $current[$key]; } return $current; } $MAP = array("profile" => array("setting" => array("test" => array("idknow" => "someValue")))); $urlString = "www.example.com/profile/setting/test/idknow"; $URL = explode("/", $urlString); //split URL string into an array array_shift($URL); //remove first element $result = flatCall($MAP, $URL); echo $result;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/A3Z1H
function name:  (null)
number of ops:  17
compiled vars:  !0 = $MAP, !1 = $urlString, !2 = $URL, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, <array>
   13     1        ASSIGN                                                   !1, 'www.example.com%2Fprofile%2Fsetting%2Ftest%2Fidknow'
   15     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%2F'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !2, $6
   16     7        INIT_FCALL                                               'array_shift'
          8        SEND_REF                                                 !2
          9        DO_ICALL                                                 
   17    10        INIT_FCALL                                               'flatcall'
         11        SEND_VAR                                                 !0
         12        SEND_VAR                                                 !2
         13        DO_FCALL                                      0  $9      
         14        ASSIGN                                                   !3, $9
   18    15        ECHO                                                     !3
   19    16      > RETURN                                                   1

Function flatcall:
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/A3Z1H
function name:  flatCall
number of ops:  11
compiled vars:  !0 = $data_arr, !1 = $data_arr_call, !2 = $current, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        ASSIGN                                                   !2, !0
    5     3      > FE_RESET_R                                       $5      !1, ->8
          4    > > FE_FETCH_R                                               $5, !3, ->8
    6     5    >   FETCH_DIM_R                                      ~6      !2, !3
          6        ASSIGN                                                   !2, ~6
    5     7      > JMP                                                      ->4
          8    >   FE_FREE                                                  $5
    9     9      > RETURN                                                   !2
   10    10*     > RETURN                                                   null

End of function flatcall

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
192.58 ms | 1006 KiB | 16 Q