3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ '{"asset":[1,2],"person":[1],"passive":[1]} ', '{"asset":[3],"charge":[1],"passive":[2]} ', ]; $array = array_map(function($v) { return json_decode($v, true);}, $array); $merged = array_merge_recursive(...$array); print json_encode($merged);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7hSqi
function name:  (null)
number of ops:  17
compiled vars:  !0 = $array, !1 = $merged
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    8     1        INIT_FCALL                                               'array_map'
          2        DECLARE_LAMBDA_FUNCTION                          ~3      [0]
          3        SEND_VAL                                                 ~3
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $4      
          6        ASSIGN                                                   !0, $4
    9     7        INIT_FCALL                                               'array_merge_recursive'
          8        SEND_UNPACK                                              !0
          9        CHECK_UNDEF_ARGS                                         
         10        DO_ICALL                                         $6      
         11        ASSIGN                                                   !1, $6
   10    12        INIT_FCALL                                               'json_encode'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $8      
         15        ECHO                                                     $8
         16      > 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/7hSqi
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $1      
          5      > RETURN                                                   $1
          6*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.98 ms | 1003 KiB | 17 Q