3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = array( array('ur_user_id'=> 1,'ur_fname'=>'PerA','ur_lname'=>'SonA'), array('ur_user_id'=> 2,'ur_fname'=>'PerB','ur_lname'=>'SonB'), array('ur_user_id'=> 3,'ur_fname'=>'PerC','ur_lname'=>'SonC'), ); $array2 = array( array('ur_user_id' => 5,'ur_code' => 'AA-BB-CC','ur_user_role' => 'testE'), array('ur_user_id' => 4,'ur_code' => 'AA-BB-CC','ur_user_role' => 'testD'), array('ur_user_id' => 6,'ur_code' => 'AA-BB-CC','ur_user_role' => 'testF'), array('ur_user_id' => 3,'ur_code' => 'AA-BB-CC','ur_user_role' => 'testC'), array('ur_user_id' => 1,'ur_code' => 'AA-BB-CC','ur_user_role' => 'testA'), array('ur_user_id' => 2,'ur_code' => 'AA-BB-CC','ur_user_role' => 'testB'), ); $ids = array(); $out = array(); foreach($array1 as $key => $value){ if(isset($array2[$key])) $out[$key][] = $array2[$key]; $out[$key][] = $value; $ids[] = $array2[$key]['ur_user_id']; } foreach($array2 as $key => $val){ if(!in_array($val['ur_user_id'], $ids)) $out[$key][] = $array2[$key]; } print_r($out);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 21
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 21
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 13
Branch analysis from position: 21
2 jumps found. (Code = 77) Position 1 = 23, Position 2 = 37
Branch analysis from position: 23
2 jumps found. (Code = 78) Position 1 = 24, Position 2 = 37
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 36
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
Branch analysis from position: 36
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
Branch analysis from position: 21
filename:       /in/Ucs7r
function name:  (null)
number of ops:  42
compiled vars:  !0 = $array1, !1 = $array2, !2 = $ids, !3 = $out, !4 = $value, !5 = $key, !6 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    8     1        ASSIGN                                                   !1, <array>
   18     2        ASSIGN                                                   !2, <array>
   19     3        ASSIGN                                                   !3, <array>
   20     4      > FE_RESET_R                                       $11     !0, ->21
          5    > > FE_FETCH_R                                       ~12     $11, !4, ->21
          6    >   ASSIGN                                                   !5, ~12
   21     7        ISSET_ISEMPTY_DIM_OBJ                         0          !1, !5
          8      > JMPZ                                                     ~14, ->13
   22     9    >   FETCH_DIM_R                                      ~17     !1, !5
         10        FETCH_DIM_W                                      $15     !3, !5
         11        ASSIGN_DIM                                               $15
         12        OP_DATA                                                  ~17
   23    13    >   FETCH_DIM_W                                      $18     !3, !5
         14        ASSIGN_DIM                                               $18
         15        OP_DATA                                                  !4
   24    16        FETCH_DIM_R                                      ~21     !1, !5
         17        FETCH_DIM_R                                      ~22     ~21, 'ur_user_id'
         18        ASSIGN_DIM                                               !2
         19        OP_DATA                                                  ~22
   20    20      > JMP                                                      ->5
         21    >   FE_FREE                                                  $11
   27    22      > FE_RESET_R                                       $23     !1, ->37
         23    > > FE_FETCH_R                                       ~24     $23, !6, ->37
         24    >   ASSIGN                                                   !5, ~24
   28    25        INIT_FCALL                                               'in_array'
         26        FETCH_DIM_R                                      ~26     !6, 'ur_user_id'
         27        SEND_VAL                                                 ~26
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                         $27     
         30        BOOL_NOT                                         ~28     $27
         31      > JMPZ                                                     ~28, ->36
   29    32    >   FETCH_DIM_R                                      ~31     !1, !5
         33        FETCH_DIM_W                                      $29     !3, !5
         34        ASSIGN_DIM                                               $29
         35        OP_DATA                                                  ~31
   27    36    > > JMP                                                      ->23
         37    >   FE_FREE                                                  $23
   31    38        INIT_FCALL                                               'print_r'
         39        SEND_VAR                                                 !3
         40        DO_ICALL                                                 
         41      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.09 ms | 1006 KiB | 15 Q