3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arrays = [ [ "1-1", "1-2", "1-1", "1-2", "1-1", ], [ "3-3", "3-3", "3-4", "3-4", "3-3", ], ]; $first = array_shift($arrays); $res = array_reduce($arrays, function($carry, $item){ foreach($item as $key => $value) { $carry[$key] = $carry[$key] . "," . $value; } return $carry; }, $first); print_r($res);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U0JKU
function name:  (null)
number of ops:  16
compiled vars:  !0 = $arrays, !1 = $first, !2 = $res
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   19     1        INIT_FCALL                                                   'array_shift'
          2        SEND_REF                                                     !0
          3        DO_ICALL                                             $4      
          4        ASSIGN                                                       !1, $4
   20     5        INIT_FCALL                                                   'array_reduce'
          6        SEND_VAR                                                     !0
          7        DECLARE_LAMBDA_FUNCTION                              ~6      [0]
   25     8        SEND_VAL                                                     ~6
          9        SEND_VAR                                                     !1
   20    10        DO_ICALL                                             $7      
         11        ASSIGN                                                       !2, $7
   27    12        INIT_FCALL                                                   'print_r'
         13        SEND_VAR                                                     !2
         14        DO_ICALL                                                     
         15      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 11
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/U0JKU
function name:  {closure:/in/U0JKU:20}
number of ops:  14
compiled vars:  !0 = $carry, !1 = $item, !2 = $value, !3 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   20     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   21     2      > FE_RESET_R                                           $4      !1, ->11
          3    > > FE_FETCH_R                                           ~5      $4, !2, ->11
          4    >   ASSIGN                                                       !3, ~5
   22     5        FETCH_DIM_R                                          ~8      !0, !3
          6        CONCAT                                               ~9      ~8, '%2C'
          7        CONCAT                                               ~10     ~9, !2
          8        ASSIGN_DIM                                                   !0, !3
          9        OP_DATA                                                      ~10
   21    10      > JMP                                                          ->3
         11    >   FE_FREE                                                      $4
   24    12      > RETURN                                                       !0
   25    13*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.29 ms | 3099 KiB | 16 Q