3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'vehicle info' => [ 'one' => [ 'submodel' => 'LX', 'engine' => 2.3 ], 'two' => [ 'color' => 'blue', 'year' => 2007, 'wheels' => 4 ], 'three' => [ 'submodel' => 'LX', 'make' => 'Ford', 'model' => 'F-150', 'offroad' => 'No' ] ] ]; $needles = ['submodel', 'offroad']; $result = []; array_walk_recursive( $array, function($value, $key) use ($needles, &$result) { if ( in_array($key, $needles) && !isset($result[$key]) ) { $result[$key] = "$key is $value"; } } ); var_export($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JBuWZ
function name:  (null)
number of ops:  14
compiled vars:  !0 = $array, !1 = $needles, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   23     1        ASSIGN                                                   !1, <array>
   24     2        ASSIGN                                                   !2, <array>
   25     3        INIT_FCALL                                               'array_walk_recursive'
   26     4        SEND_REF                                                 !0
   27     5        DECLARE_LAMBDA_FUNCTION                          ~6      [0]
          6        BIND_LEXICAL                                             ~6, !1
          7        BIND_LEXICAL                                             ~6, !2
   34     8        SEND_VAL                                                 ~6
   25     9        DO_ICALL                                                 
   36    10        INIT_FCALL                                               'var_export'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
         13      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 18
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
Branch analysis from position: 12
filename:       /in/JBuWZ
function name:  {closure}
number of ops:  19
compiled vars:  !0 = $value, !1 = $key, !2 = $needles, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        BIND_STATIC                                              !3
   29     4        INIT_FCALL                                               'in_array'
          5        SEND_VAR                                                 !1
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $4      
          8      > JMPZ_EX                                          ~5      $4, ->12
   30     9    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~6      !3, !1
         10        BOOL_NOT                                         ~7      ~6
         11        BOOL                                             ~5      ~7
         12    > > JMPZ                                                     ~5, ->18
   32    13    >   ROPE_INIT                                     3  ~10     !1
         14        ROPE_ADD                                      1  ~10     ~10, '+is+'
         15        ROPE_END                                      2  ~9      ~10, !0
         16        ASSIGN_DIM                                               !3, !1
         17        OP_DATA                                                  ~9
   34    18    > > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.33 ms | 1001 KiB | 16 Q