3v4l.org

run code in 500+ 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 = 6, Position 2 = 9
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
Branch analysis from position: 9
filename:       /in/JBuWZ
function name:  {closure:/in/JBuWZ:27}
number of ops:  16
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        FRAMELESS_ICALL_2                in_array            ~4      !1, !2
          5      > JMPZ_EX                                              ~4      ~4, ->9
   30     6    >   ISSET_ISEMPTY_DIM_OBJ                             0  ~5      !3, !1
          7        BOOL_NOT                                             ~6      ~5
          8        BOOL                                                 ~4      ~6
          9    > > JMPZ                                                         ~4, ->15
   32    10    >   ROPE_INIT                                         3  ~9      !1
         11        ROPE_ADD                                          1  ~9      ~9, '+is+'
         12        ROPE_END                                          2  ~8      ~9, !0
         13        ASSIGN_DIM                                                   !3, !1
         14        OP_DATA                                                      ~8
   34    15    > > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.64 ms | 2002 KiB | 15 Q