3v4l.org

run code in 500+ PHP versions simultaneously
<?php $a = Array ( '0' => Array ( 'id' => 1, 'color' => 'red' ), '1' => Array ( '0' => Array ( 'id' => 2, 'color' => 'blue' ), '1' => Array ( '0' => Array ( 'id' => 3, 'color' => 'green' ) ), '2' => Array ( 'id' => 4, 'color' => 'blue' ) ), '2' => Array ( 'id' => 5, 'color' => 'purple' ) ); $i = 0; array_walk_recursive($a, function($v,$k)use(&$r,&$i){ $r[$i][$k] = $v; ($k == 'color') ? $i++ :$i; }); echo '<pre>'; print_r($r);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YPT2M
function name:  (null)
number of ops:  14
compiled vars:  !0 = $a, !1 = $i, !2 = $r
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   45     1        ASSIGN                                                       !1, 0
   46     2        INIT_FCALL                                                   'array_walk_recursive'
          3        SEND_REF                                                     !0
          4        DECLARE_LAMBDA_FUNCTION                              ~5      [0]
          5        BIND_LEXICAL                                                 ~5, !2
          6        BIND_LEXICAL                                                 ~5, !1
   49     7        SEND_VAL                                                     ~5
   46     8        DO_ICALL                                                     
   50     9        ECHO                                                         '%3Cpre%3E'
   51    10        INIT_FCALL                                                   'print_r'
         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 = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YPT2M
function name:  {closure:/in/YPT2M:46}
number of ops:  15
compiled vars:  !0 = $v, !1 = $k, !2 = $r, !3 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   46     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        BIND_STATIC                                                  !2
          3        BIND_STATIC                                                  !3
   47     4        FETCH_DIM_W                                          $4      !2, !3
          5        ASSIGN_DIM                                                   $4, !1
          6        OP_DATA                                                      !0
   48     7        IS_EQUAL                                                     !1, 'color'
          8      > JMPZ                                                         ~6, ->12
          9    >   POST_INC                                             ~7      !3
         10        QM_ASSIGN                                            ~8      ~7
         11      > JMP                                                          ->13
         12    >   QM_ASSIGN                                            ~8      !3
         13    >   FREE                                                         ~8
   49    14      > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.9 ms | 2210 KiB | 15 Q