3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ ['id_produto' => 191, 'categoria' => 7, 'prazo' => 8, 'desconto' => 45], ['id_produto' => 194, 'categoria' => 7, 'prazo' => 8, 'desconto' => 39], ['id_produto' => 195, 'categoria' => 7, 'prazo' => 8, 'desconto' => 39], ]; $array2 = [ ['id_produto' => 191, 'categoria' => 7, 'pageviews' => 2103], ['id_produto' => 194, 'categoria' => 7, 'pageviews' => 2445], ['id_produto' => 195, 'categoria' => 7, 'pageviews' => 1560], ]; $array3 = [ ['id_produto' => 191, 'categoria' => 7, 'pedidos' => 3, 'valor' => 6501.583023], ['id_produto' => 194, 'categoria' => 7, 'pedidos' => 1, 'valor' => 2217.968420], ['id_produto' => 197, 'categoria' => 7, 'pedidos' => 2, 'valor' => 4405.517706], ]; $result = []; foreach (array_merge($array1, $array2, $array3) as $row) { $result[$row['id_produto']] = array_merge($result[$row['id_produto']] ?? [], $row); } var_export(array_values($result));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 23
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 23
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/c9Mbv
function name:  (null)
number of ops:  31
compiled vars:  !0 = $array1, !1 = $array2, !2 = $array3, !3 = $result, !4 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   15     2        ASSIGN                                                   !2, <array>
   21     3        ASSIGN                                                   !3, <array>
   22     4        INIT_FCALL                                               'array_merge'
          5        SEND_VAR                                                 !0
          6        SEND_VAR                                                 !1
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $9      
          9      > FE_RESET_R                                       $10     $9, ->23
         10    > > FE_FETCH_R                                               $10, !4, ->23
   23    11    >   FETCH_DIM_R                                      ~11     !4, 'id_produto'
         12        INIT_FCALL                                               'array_merge'
         13        FETCH_DIM_R                                      ~13     !4, 'id_produto'
         14        FETCH_DIM_IS                                     ~14     !3, ~13
         15        COALESCE                                         ~15     ~14
         16        QM_ASSIGN                                        ~15     <array>
         17        SEND_VAL                                                 ~15
         18        SEND_VAR                                                 !4
         19        DO_ICALL                                         $16     
         20        ASSIGN_DIM                                               !3, ~11
         21        OP_DATA                                                  $16
   22    22      > JMP                                                      ->10
         23    >   FE_FREE                                                  $10
   25    24        INIT_FCALL                                               'var_export'
         25        INIT_FCALL                                               'array_values'
         26        SEND_VAR                                                 !3
         27        DO_ICALL                                         $17     
         28        SEND_VAR                                                 $17
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.56 ms | 1013 KiB | 16 Q