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 = array_column($array1, null, 'id_produto'); foreach (array_merge($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 = 14, Position 2 = 27
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 27
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/K3Z77
function name:  (null)
number of ops:  35
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        INIT_FCALL                                               'array_column'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 null
          6        SEND_VAL                                                 'id_produto'
          7        DO_ICALL                                         $8      
          8        ASSIGN                                                   !3, $8
   22     9        INIT_FCALL                                               'array_merge'
         10        SEND_VAR                                                 !1
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                         $10     
         13      > FE_RESET_R                                       $11     $10, ->27
         14    > > FE_FETCH_R                                               $11, !4, ->27
   23    15    >   FETCH_DIM_R                                      ~12     !4, 'id_produto'
         16        INIT_FCALL                                               'array_merge'
         17        FETCH_DIM_R                                      ~14     !4, 'id_produto'
         18        FETCH_DIM_IS                                     ~15     !3, ~14
         19        COALESCE                                         ~16     ~15
         20        QM_ASSIGN                                        ~16     <array>
         21        SEND_VAL                                                 ~16
         22        SEND_VAR                                                 !4
         23        DO_ICALL                                         $17     
         24        ASSIGN_DIM                                               !3, ~12
         25        OP_DATA                                                  $17
   22    26      > JMP                                                      ->14
         27    >   FE_FREE                                                  $11
   25    28        INIT_FCALL                                               'var_export'
         29        INIT_FCALL                                               'array_values'
         30        SEND_VAR                                                 !3
         31        DO_ICALL                                         $18     
         32        SEND_VAR                                                 $18
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.57 ms | 1006 KiB | 17 Q