3v4l.org

run code in 300+ 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                                  '%00%7Bclosure%7D%2Fin%2FkitiP%3A17%240'
   22     6        SEND_VAL                                                 ~6
          7        DO_ICALL                                                 
   24     8        INIT_FCALL                                               'print_r'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FkitiP%3A17%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kitiP
function name:  {closure}
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 function %00%7Bclosure%7D%2Fin%2FkitiP%3A17%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.14 ms | 1395 KiB | 17 Q