3v4l.org

run code in 300+ 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                                  '%00%7Bclosure%7D%2Fin%2Fs7dvd%3A8%240'
         11        SEND_VAL                                                 ~8
    9    12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $9      
    6    14        ASSIGN                                                   !3, $9
   12    15        INIT_FCALL                                               'print_r'
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fs7dvd%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s7dvd
function name:  {closure}
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 function %00%7Bclosure%7D%2Fin%2Fs7dvd%3A8%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
130.5 ms | 1401 KiB | 21 Q