3v4l.org

run code in 300+ PHP versions simultaneously
<?php $reasons = [ "1" => [ "101" => "reason1", "102" => "reason2", ], "2" => [ "201" => "reason3", "202" => "reason4", ], ]; $newReasons = array_reduce($reasons, function ($list, $item) { // 配列のキーを維持するため + で結合 return $list + $item; }, []); var_dump($newReasons);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RGPH7
function name:  (null)
number of ops:  12
compiled vars:  !0 = $reasons, !1 = $newReasons
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1        INIT_FCALL                                               'array_reduce'
          2        SEND_VAR                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                          ~3      [0]
   17     4        SEND_VAL                                                 ~3
          5        SEND_VAL                                                 <array>
   14     6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !1, $4
   19     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
         11      > 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/RGPH7
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $list, !1 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2        ADD                                              ~2      !0, !1
          3      > RETURN                                                   ~2
   17     4*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
219.08 ms | 1005 KiB | 15 Q