3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = array ( 298 => array ( 'dates' => array ( 0 => '2020-12-26 10:39:13', 1 => '2020-12-15 12:18:23', 2 => '2020-12-22 12:27:46', 3 => '2020-12-24 10:51:00', 4 => '2020-12-26 10:01:44', 5 => '2020-12-26 10:31:55', 6 => '2020-12-26 10:48:33', 7 => '2020-12-26 10:56:34' ), ), 184 => array ( 'dates' => array ( 0 => '2020-11-16 07:52:33', 1 => '2020-12-24 13:01:14' ), ), 182 => array ( 'dates' => array ( 0 => '2021-01-05 08:50:27' ), ) ); $array2 = array ( 298 => array ( 'dates' => array ( 0 => '2020-11-16 07:38:26', 1 => '2020-11-16 07:47:05', 2 => '2020-12-15 12:20:07', 3 => '2020-12-24 10:52:35' ), ), 184 => array ( 'dates' => array ( 0 => '2020-11-16 07:53:12' ), ), 53 => array ( 'dates' => array ( 0 => '2020-11-16 07:53:12' ), ) ); $keys = array_unique(array_merge(array_keys($array1), array_keys($array2))); $result = array(); foreach ($keys as $key) { $result[$key]['dates'] = array_merge($array1[$key]['dates'] ?? [], $array2[$key]['dates'] ?? []); } print_r($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 35
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 35
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/Up9E6
function name:  (null)
number of ops:  40
compiled vars:  !0 = $array1, !1 = $array2, !2 = $keys, !3 = $result, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   35     1        ASSIGN                                                   !1, <array>
   62     2        INIT_FCALL                                               'array_unique'
          3        INIT_FCALL                                               'array_merge'
          4        INIT_FCALL                                               'array_keys'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $7      
          7        SEND_VAR                                                 $7
          8        INIT_FCALL                                               'array_keys'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $8      
         11        SEND_VAR                                                 $8
         12        DO_ICALL                                         $9      
         13        SEND_VAR                                                 $9
         14        DO_ICALL                                         $10     
         15        ASSIGN                                                   !2, $10
   64    16        ASSIGN                                                   !3, <array>
   65    17      > FE_RESET_R                                       $13     !2, ->35
         18    > > FE_FETCH_R                                               $13, !4, ->35
   66    19    >   INIT_FCALL                                               'array_merge'
         20        FETCH_DIM_IS                                     ~16     !0, !4
         21        FETCH_DIM_IS                                     ~17     ~16, 'dates'
         22        COALESCE                                         ~18     ~17
         23        QM_ASSIGN                                        ~18     <array>
         24        SEND_VAL                                                 ~18
         25        FETCH_DIM_IS                                     ~19     !1, !4
         26        FETCH_DIM_IS                                     ~20     ~19, 'dates'
         27        COALESCE                                         ~21     ~20
         28        QM_ASSIGN                                        ~21     <array>
         29        SEND_VAL                                                 ~21
         30        DO_ICALL                                         $22     
         31        FETCH_DIM_W                                      $14     !3, !4
         32        ASSIGN_DIM                                               $14, 'dates'
         33        OP_DATA                                                  $22
   65    34      > JMP                                                      ->18
         35    >   FE_FREE                                                  $13
   68    36        INIT_FCALL                                               'print_r'
         37        SEND_VAR                                                 !3
         38        DO_ICALL                                                 
         39      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
279.23 ms | 1085 KiB | 17 Q