3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = ['code1' => 1, 'code2' => 2]; $array2 = ['code1' => 0, 'code2' => 2, 'code3' => 3]; $all_keys = array_unique(array_merge(array_keys($array1), array_keys($array2))); $output = array(); foreach ($all_keys as $code) { $output[$code] = (!empty($array2[$code]) ? $array2[$code] : 0) - (!empty($array1[$code]) ? $array1[$code] : 0); } print_r($output);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 37
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 37
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 32
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 32
Branch analysis from position: 29
Branch analysis from position: 32
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
filename:       /in/Uic7E
function name:  (null)
number of ops:  42
compiled vars:  !0 = $array1, !1 = $array2, !2 = $all_keys, !3 = $output, !4 = $code
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    5     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
    6    16        ASSIGN                                                   !3, <array>
    8    17      > FE_RESET_R                                       $13     !2, ->37
         18    > > FE_FETCH_R                                               $13, !4, ->37
    9    19    >   ISSET_ISEMPTY_DIM_OBJ                         1  ~15     !1, !4
         20        BOOL_NOT                                         ~16     ~15
         21      > JMPZ                                                     ~16, ->25
         22    >   FETCH_DIM_R                                      ~17     !1, !4
         23        QM_ASSIGN                                        ~18     ~17
         24      > JMP                                                      ->26
         25    >   QM_ASSIGN                                        ~18     0
         26    >   ISSET_ISEMPTY_DIM_OBJ                         1  ~19     !0, !4
         27        BOOL_NOT                                         ~20     ~19
         28      > JMPZ                                                     ~20, ->32
         29    >   FETCH_DIM_R                                      ~21     !0, !4
         30        QM_ASSIGN                                        ~22     ~21
         31      > JMP                                                      ->33
         32    >   QM_ASSIGN                                        ~22     0
         33    >   SUB                                              ~23     ~18, ~22
         34        ASSIGN_DIM                                               !3, !4
         35        OP_DATA                                                  ~23
    8    36      > JMP                                                      ->18
         37    >   FE_FREE                                                  $13
   11    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:
146.18 ms | 1075 KiB | 17 Q