3v4l.org

run code in 500+ PHP versions simultaneously
<?php $my_array = ['a','b','c']; $dyn_array = [1, 2, 3]; $num = 2; $result = array_reduce( array_fill(0, $num, $dyn_array), function($carry, $item) { return array_merge($carry, $item); }, $my_array ); print_r($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s7dvd
function name:  (null)
number of ops:  19
compiled vars:  !0 = $my_array, !1 = $dyn_array, !2 = $num, !3 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, <array>
    3     1        ASSIGN                                                       !1, <array>
    4     2        ASSIGN                                                       !2, 2
    6     3        INIT_FCALL                                                   'array_reduce'
    7     4        INIT_FCALL                                                   'array_fill'
          5        SEND_VAL                                                     0
          6        SEND_VAR                                                     !2
          7        SEND_VAR                                                     !1
          8        DO_ICALL                                             $7      
          9        SEND_VAR                                                     $7
    8    10        DECLARE_LAMBDA_FUNCTION                              ~8      [0]
         11        SEND_VAL                                                     ~8
    9    12        SEND_VAR                                                     !0
    6    13        DO_ICALL                                             $9      
         14        ASSIGN                                                       !3, $9
   12    15        INIT_FCALL                                                   'print_r'
         16        SEND_VAR                                                     !3
         17        DO_ICALL                                                     
         18      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s7dvd
function name:  {closure:/in/s7dvd:8}
number of ops:  8
compiled vars:  !0 = $carry, !1 = $item
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        INIT_FCALL                                                   'array_merge'
          3        SEND_VAR                                                     !0
          4        SEND_VAR                                                     !1
          5        DO_ICALL                                             $2      
          6      > RETURN                                                       $2
          7*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
232.54 ms | 2568 KiB | 17 Q