3v4l.org

run code in 500+ PHP versions simultaneously
<?php $structure = [ "a", "b" => [ "b1", "b2" => [ "b21", "b22" ] ] ]; $data = ['A', 'B1', 'B21', 'B22']; $filled = 0; array_walk_recursive ($structure, function (&$val) { global $filled; global $data; $val = array( $val => $data[ $filled ] ); $filled++; }); print_r( $structure );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kitiP
function name:  (null)
number of ops:  12
compiled vars:  !0 = $structure, !1 = $data, !2 = $filled
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   14     1        ASSIGN                                                       !1, <array>
   16     2        ASSIGN                                                       !2, 0
   17     3        INIT_FCALL                                                   'array_walk_recursive'
          4        SEND_REF                                                     !0
          5        DECLARE_LAMBDA_FUNCTION                              ~6      [0]
   22     6        SEND_VAL                                                     ~6
   17     7        DO_ICALL                                                     
   24     8        INIT_FCALL                                                   'print_r'
          9        SEND_VAR                                                     !0
         10        DO_ICALL                                                     
         11      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kitiP
function name:  {closure:/in/kitiP:17}
number of ops:  8
compiled vars:  !0 = $val, !1 = $filled, !2 = $data
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   RECV                                                 !0      
   18     1        BIND_GLOBAL                                                  !1, 'filled'
   19     2        BIND_GLOBAL                                                  !2, 'data'
   20     3        FETCH_DIM_R                                          ~3      !2, !1
          4        INIT_ARRAY                                           ~4      ~3, !0
          5        ASSIGN                                                       !0, ~4
   21     6        PRE_INC                                                      !1
   22     7      > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.15 ms | 2180 KiB | 15 Q