3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [ ['email' => 'aa@gmail.com', 'name' => 'John Doe'], ['email' => 'bb@gmail.com', 'name' => 'Johnny Sins'], ['email' => 'cc@gmail.com', 'name' => 'Jose Alvarado'] ]; $arr2 = [ ['email' => 'cc@gmail.com', 'country' => 'Japan'], ['email' => 'cc@gmail.com', 'country' => 'China'], ['email' => 'bb@gmail.com', 'country' => 'Korea'], ]; $result = array_column($arr1, null, 'email'); $counts = array_count_values(array_column($arr2, 'email')); foreach ($arr2 as $row) { if ($counts[$row['email']] > 1) { unset($result[$row['email']]); } else { $result[$row['email']] += $row; } } var_export(array_values($result));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 17, Position 2 = 29
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 29
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/7IAv6
function name:  (null)
number of ops:  37
compiled vars:  !0 = $arr1, !1 = $arr2, !2 = $result, !3 = $counts, !4 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   15     2        INIT_FCALL                                               'array_column'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 null
          5        SEND_VAL                                                 'email'
          6        DO_ICALL                                         $7      
          7        ASSIGN                                                   !2, $7
   16     8        INIT_FCALL                                               'array_count_values'
          9        INIT_FCALL                                               'array_column'
         10        SEND_VAR                                                 !1
         11        SEND_VAL                                                 'email'
         12        DO_ICALL                                         $9      
         13        SEND_VAR                                                 $9
         14        DO_ICALL                                         $10     
         15        ASSIGN                                                   !3, $10
   17    16      > FE_RESET_R                                       $12     !1, ->29
         17    > > FE_FETCH_R                                               $12, !4, ->29
   18    18    >   FETCH_DIM_R                                      ~13     !4, 'email'
         19        FETCH_DIM_R                                      ~14     !3, ~13
         20        IS_SMALLER                                               1, ~14
         21      > JMPZ                                                     ~15, ->25
   19    22    >   FETCH_DIM_R                                      ~16     !4, 'email'
         23        UNSET_DIM                                                !2, ~16
   18    24      > JMP                                                      ->28
   21    25    >   FETCH_DIM_R                                      ~17     !4, 'email'
         26        ASSIGN_DIM_OP                +=               1          !2, ~17
         27        OP_DATA                                                  !4
   17    28    > > JMP                                                      ->17
         29    >   FE_FREE                                                  $12
   24    30        INIT_FCALL                                               'var_export'
         31        INIT_FCALL                                               'array_values'
         32        SEND_VAR                                                 !2
         33        DO_ICALL                                         $19     
         34        SEND_VAR                                                 $19
         35        DO_ICALL                                                 
         36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.43 ms | 1008 KiB | 17 Q