3v4l.org

run code in 300+ PHP versions simultaneously
<?php $aggs['aggs']['name'] = "name"; function addEnd(&$item, $key) { if(is_array($item)){ return; }elseif($key=='aggs'){ $item=['name'=> ['aggs' => $item]]; }else{ $item=['aggs' => $item]; } } for($i=0; $i<5; $i++){ // your loop array_walk_recursive($aggs, 'addEnd'); } var_dump($aggs);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 5
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 5
Branch analysis from position: 12
Branch analysis from position: 5
filename:       /in/HmlYD
function name:  (null)
number of ops:  16
compiled vars:  !0 = $aggs, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   FETCH_DIM_W                                      $2      !0, 'aggs'
          1        ASSIGN_DIM                                               $2, 'name'
          2        OP_DATA                                                  'name'
   15     3        ASSIGN                                                   !1, 0
          4      > JMP                                                      ->10
   16     5    >   INIT_FCALL                                               'array_walk_recursive'
          6        SEND_REF                                                 !0
          7        SEND_VAL                                                 'addEnd'
          8        DO_ICALL                                                 
   15     9        PRE_INC                                                  !1
         10    >   IS_SMALLER                                               !1, 5
         11      > JMPNZ                                                    ~7, ->5
   19    12    >   INIT_FCALL                                               'var_dump'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function addend:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HmlYD
function name:  addEnd
number of ops:  15
compiled vars:  !0 = $item, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        TYPE_CHECK                                  128          !0
          3      > JMPZ                                                     ~2, ->6
    7     4    > > RETURN                                                   null
          5*       JMP                                                      ->14
    8     6    >   IS_EQUAL                                                 !1, 'aggs'
          7      > JMPZ                                                     ~3, ->12
    9     8    >   INIT_ARRAY                                       ~4      !0, 'aggs'
          9        INIT_ARRAY                                       ~5      ~4, 'name'
         10        ASSIGN                                                   !0, ~5
         11      > JMP                                                      ->14
   11    12    >   INIT_ARRAY                                       ~7      !0, 'aggs'
         13        ASSIGN                                                   !0, ~7
   13    14    > > RETURN                                                   null

End of function addend

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.82 ms | 1400 KiB | 17 Q