3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ ['id_cat' => 1, 'title_cat' => 2], ['id_cat' => 3, 'title_cat' => 4] ]; $array2 = [ ['id_prod' => 1, 'title_prod' => 2], ['id_prod' => 3, 'title_prod' => 4] ]; foreach($array1 as $key => $value) { $result[$key] = array_merge($array1[$key], $array2[$key]); } echo json_encode($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/IgMhU
function name:  (null)
number of ops:  20
compiled vars:  !0 = $array1, !1 = $array2, !2 = $value, !3 = $key, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    8     1        ASSIGN                                                   !1, <array>
   13     2      > FE_RESET_R                                       $7      !0, ->14
          3    > > FE_FETCH_R                                       ~8      $7, !2, ->14
          4    >   ASSIGN                                                   !3, ~8
   14     5        INIT_FCALL                                               'array_merge'
          6        FETCH_DIM_R                                      ~11     !0, !3
          7        SEND_VAL                                                 ~11
          8        FETCH_DIM_R                                      ~12     !1, !3
          9        SEND_VAL                                                 ~12
         10        DO_ICALL                                         $13     
         11        ASSIGN_DIM                                               !4, !3
         12        OP_DATA                                                  $13
   13    13      > JMP                                                      ->3
         14    >   FE_FREE                                                  $7
   17    15        INIT_FCALL                                               'json_encode'
         16        SEND_VAR                                                 !4
         17        DO_ICALL                                         $14     
         18        ECHO                                                     $14
         19      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.53 ms | 1395 KiB | 17 Q