3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( array("item_data"=>array(1,2,3),"type"=>a), array("item_data"=>array(4,5,6)), array("item_data"=>array(7,8,9)) ); function merge($prev, $now) { return array_merge($prev, $now['item_data']); } $res = array_reduce($arr, "merge", array()); print_r($res);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JrBaG
function name:  (null)
number of ops:  17
compiled vars:  !0 = $arr, !1 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_ARRAY                                       ~2      <array>, 'item_data'
          1        FETCH_CONSTANT                                   ~3      'a'
          2        ADD_ARRAY_ELEMENT                                ~2      ~3, 'type'
          3        INIT_ARRAY                                       ~4      ~2
          4        ADD_ARRAY_ELEMENT                                ~4      <array>
          5        ADD_ARRAY_ELEMENT                                ~4      <array>
          6        ASSIGN                                                   !0, ~4
    8     7        INIT_FCALL                                               'array_reduce'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 'merge'
         10        SEND_VAL                                                 <array>
         11        DO_ICALL                                         $6      
         12        ASSIGN                                                   !1, $6
    9    13        INIT_FCALL                                               'print_r'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Function merge:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JrBaG
function name:  merge
number of ops:  9
compiled vars:  !0 = $prev, !1 = $now
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        INIT_FCALL                                               'array_merge'
          3        SEND_VAR                                                 !0
          4        FETCH_DIM_R                                      ~2      !1, 'item_data'
          5        SEND_VAL                                                 ~2
          6        DO_ICALL                                         $3      
          7      > RETURN                                                   $3
    7     8*     > RETURN                                                   null

End of function merge

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.73 ms | 1395 KiB | 19 Q