3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array1 = [ '1' => '11', 'b' => 1, 3 => 33, 8 => 8 ]; $array2 = [ '1' => '22', 'b' => 2, 3 => 44, 9 => 9 ]; foreach ($array2 as $key => $value) { if (!key_exists($key, $array1)) { $array1[$key] = $value; } else { $array1[$key] = (array)$array1[$key]; $array1[$key][] = $value; } } var_export($array1);
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 = 11, Position 2 = 14
Branch analysis from position: 11
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: 14
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/NNpXW
function name:  (null)
number of ops:  27
compiled vars:  !0 = $array1, !1 = $array2, !2 = $value, !3 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    9     1        ASSIGN                                                       !1, <array>
   16     2      > FE_RESET_R                                           $6      !1, ->22
          3    > > FE_FETCH_R                                           ~7      $6, !2, ->22
          4    >   ASSIGN                                                       !3, ~7
   17     5        INIT_FCALL                                                   'key_exists'
          6        SEND_VAR                                                     !3
          7        SEND_VAR                                                     !0
          8        DO_ICALL                                             $9      
          9        BOOL_NOT                                             ~10     $9
         10      > JMPZ                                                         ~10, ->14
   18    11    >   ASSIGN_DIM                                                   !0, !3
         12        OP_DATA                                                      !2
   17    13      > JMP                                                          ->21
   20    14    >   FETCH_DIM_R                                          ~13     !0, !3
         15        CAST                                              7  ~14     ~13
         16        ASSIGN_DIM                                                   !0, !3
         17        OP_DATA                                                      ~14
   21    18        FETCH_DIM_W                                          $15     !0, !3
         19        ASSIGN_DIM                                                   $15
         20        OP_DATA                                                      !2
   16    21    > > JMP                                                          ->3
         22    >   FE_FREE                                                      $6
   24    23        INIT_FCALL                                                   'var_export'
         24        SEND_VAR                                                     !0
         25        DO_ICALL                                                     
         26      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
176.07 ms | 2033 KiB | 15 Q