3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array1 = [ ['detail_image_id' => '6389', 'product_name' => 'Starter broadband Package'], ['detail_image_id' => '6358', 'product_name' => 'Starter broadband Package'] ]; $array2 = [ ['detail_image_id' => '6358', 'guid' => 'http://xxx/wp-content/uploads/2018/04/broadband-4mbs-wingle.jpg'], ['detail_image_id' => '6389', 'guid' => 'http://xxx/wp-content/uploads/2018/04/broadband-4mbs-charji.jpg'] ]; $result = []; foreach (array_merge($array1, $array2) as $row) { $result[$row['detail_image_id']] = ($result[$row['detail_image_id']] ?? []) + $row; } var_export(array_values($result));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/rIXPB
function name:  (null)
number of ops:  26
compiled vars:  !0 = $array1, !1 = $array2, !2 = $result, !3 = $row
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    7     1        ASSIGN                                                       !1, <array>
   12     2        ASSIGN                                                       !2, <array>
   13     3        INIT_FCALL                                                   'array_merge'
          4        SEND_VAR                                                     !0
          5        SEND_VAR                                                     !1
          6        DO_ICALL                                             $7      
          7      > FE_RESET_R                                           $8      $7, ->18
          8    > > FE_FETCH_R                                                   $8, !3, ->18
   14     9    >   FETCH_DIM_R                                          ~9      !3, 'detail_image_id'
         10        FETCH_DIM_R                                          ~11     !3, 'detail_image_id'
         11        FETCH_DIM_IS                                         ~12     !2, ~11
         12        COALESCE                                             ~13     ~12
         13        QM_ASSIGN                                            ~13     <array>
         14        ADD                                                  ~14     ~13, !3
         15        ASSIGN_DIM                                                   !2, ~9
         16        OP_DATA                                                      ~14
   13    17      > JMP                                                          ->8
         18    >   FE_FREE                                                      $8
   17    19        INIT_FCALL                                                   'var_export'
         20        INIT_FCALL                                                   'array_values'
         21        SEND_VAR                                                     !2
         22        DO_ICALL                                             $15     
         23        SEND_VAR                                                     $15
         24        DO_ICALL                                                     
         25      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.69 ms | 2081 KiB | 16 Q