3v4l.org

run code in 300+ PHP versions simultaneously
<?php $existingtArr = [ "A" => [ "color" => 'red', "user" => [ "Daniel" => ["01:18:08", "04:10:12"], "Max" => ["01:04:00"], "Serto" => ["02:00:02"], ] ], "B" => [ "color" => 'blue', "user" => [ "Franz" => ["08:40:52"], "Hugo" => ["07:08:58"], ] ] ]; $newArr = [ "A" => [ "color" => 'red', "user" => [ "Fabian" => ["06:03:00"], // + 1 user "Max" => ["04:10:12"], // + 1 new time "Serto" => ["02:00:02"], ] ], "B" => [ "color" => 'blue', "user" => [ "Franz" => ["08:40:52", "14:05:32", "20:34:15"], // an older one is available, + 2 new times "Hugo" => ["04:10:12"], // + 1 time ] ], "C" => [ // + new whole group "color" => 'green', "user" => [ "Maxi" => ["07:08:58", "04:10:12"], ] ] ]; foreach ($newArr as $letter => $set) { if (!isset($existingtArr[$letter])) { $existingtArr[$letter] = $set; } else { $existingtArr[$letter]['user'] = array_merge_recursive( $existingtArr[$letter]['user'], $set['user'] ); } } var_export($existingtArr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 22
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 22
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/5YpYo
function name:  (null)
number of ops:  27
compiled vars:  !0 = $existingtArr, !1 = $newArr, !2 = $set, !3 = $letter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   21     1        ASSIGN                                                   !1, <array>
   45     2      > FE_RESET_R                                       $6      !1, ->22
          3    > > FE_FETCH_R                                       ~7      $6, !2, ->22
          4    >   ASSIGN                                                   !3, ~7
   46     5        ISSET_ISEMPTY_DIM_OBJ                         0  ~9      !0, !3
          6        BOOL_NOT                                         ~10     ~9
          7      > JMPZ                                                     ~10, ->11
   47     8    >   ASSIGN_DIM                                               !0, !3
          9        OP_DATA                                                  !2
         10      > JMP                                                      ->21
   49    11    >   INIT_FCALL                                               'array_merge_recursive'
   50    12        FETCH_DIM_R                                      ~14     !0, !3
         13        FETCH_DIM_R                                      ~15     ~14, 'user'
         14        SEND_VAL                                                 ~15
   51    15        FETCH_DIM_R                                      ~16     !2, 'user'
         16        SEND_VAL                                                 ~16
         17        DO_ICALL                                         $17     
   49    18        FETCH_DIM_W                                      $12     !0, !3
         19        ASSIGN_DIM                                               $12, 'user'
   51    20        OP_DATA                                                  $17
   45    21    > > JMP                                                      ->3
         22    >   FE_FREE                                                  $6
   55    23        INIT_FCALL                                               'var_export'
         24        SEND_VAR                                                 !0
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.05 ms | 1396 KiB | 17 Q