3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( 'one' => 'hi there', 'two' => 'hello there', 'three' => array( 'one' => 'hey d00d', 'two' => 'greetings', ), ); $gather = array(); function step_and_gather($item, $key, &$gather) { $gather[] = $item; echo "==> Gathering at {$key}\n"; print_r($gather); } array_walk_recursive($arr, 'step_and_gather', $gather); echo "==> Final answer <==\n"; print_r($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O3CUs
function name:  (null)
number of ops:  12
compiled vars:  !0 = $arr, !1 = $gather
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   19     2        INIT_FCALL                                               'array_walk_recursive'
          3        SEND_REF                                                 !0
          4        SEND_VAL                                                 'step_and_gather'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                                 
   21     7        ECHO                                                     '%3D%3D%3E+Final+answer+%3C%3D%3D%0A'
   22     8        INIT_FCALL                                               'print_r'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function step_and_gather:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/O3CUs
function name:  step_and_gather
number of ops:  13
compiled vars:  !0 = $item, !1 = $key, !2 = $gather
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   14     3        ASSIGN_DIM                                               !2
          4        OP_DATA                                                  !0
   15     5        ROPE_INIT                                     3  ~5      '%3D%3D%3E+Gathering+at+'
          6        ROPE_ADD                                      1  ~5      ~5, !1
          7        ROPE_END                                      2  ~4      ~5, '%0A'
          8        ECHO                                                     ~4
   16     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                                 
   17    12      > RETURN                                                   null

End of function step_and_gather

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.17 ms | 1395 KiB | 17 Q