3v4l.org

run code in 300+ PHP versions simultaneously
<?php $cars = array( 'type' => array( 'brand' => array( 'car' => 'Honda', ), ), ); $parents = array('type', 'brand', 'car'); function GetCar($cars, $parents) { foreach($parents as $key) { $cars = $cars[$key]; #echo $key."<br>"; } return $cars; } var_dump(GetCar($cars, $parents)); // OUTPUT: string(5) "Honda" echo GetCar($cars, $parents); // OUTPUT: Honda
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OKrQN
function name:  (null)
number of ops:  15
compiled vars:  !0 = $cars, !1 = $parents
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   24     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'getcar'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
   25     9        INIT_FCALL                                               'getcar'
         10        SEND_VAR                                                 !0
         11        SEND_VAR                                                 !1
         12        DO_FCALL                                      0  $6      
         13        ECHO                                                     $6
         14      > RETURN                                                   1

Function getcar:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/OKrQN
function name:  GetCar
number of ops:  10
compiled vars:  !0 = $cars, !1 = $parents, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2      > FE_RESET_R                                       $3      !1, ->7
          3    > > FE_FETCH_R                                               $3, !2, ->7
   17     4    >   FETCH_DIM_R                                      ~4      !0, !2
          5        ASSIGN                                                   !0, ~4
   16     6      > JMP                                                      ->3
          7    >   FE_FREE                                                  $3
   20     8      > RETURN                                                   !0
   22     9*     > RETURN                                                   null

End of function getcar

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.13 ms | 1013 KiB | 16 Q