3v4l.org

run code in 300+ PHP versions simultaneously
<?php $oldContact = array( 'name' => 'Joeahkd', 'address' => '123 Masjdhfin', 'city' => 'Spring', 'a-key-only-in-old' => 'foo', 'state' => 'CA', 'zip' => '90101', ); $newContact = array( 'name' => 'Joe', 'a-key-only-in-new' => 'bar', 'address' => '123 Main St', 'city' => 'Springville', 'state' => 'CA', 'zip' => '90101', ); $oldDiff = []; $newDiff = []; foreach ($oldContact + $newContact as $key => $value) { if (isset($oldContact[$key]) && !isset($newContact[$key])) { $oldDiff[$key] = $oldContact[$key]; } elseif (isset($newContact[$key]) && !isset($oldContact[$key])) { $newDiff[$key] = $newContact[$key]; } elseif ($oldContact[$key] !== $newContact[$key]) { $oldDiff[$key] = $oldContact[$key]; $newDiff[$key] = $newContact[$key]; } } echo "Old Diff: " . var_export($oldDiff, true) . "\n"; echo "New Diff: " . var_export($newDiff, true);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 39
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 39
Branch analysis from position: 7
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 18
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 28
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 38
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 38
Branch analysis from position: 23
Branch analysis from position: 13
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
filename:       /in/BXCPR
function name:  (null)
number of ops:  54
compiled vars:  !0 = $oldContact, !1 = $newContact, !2 = $oldDiff, !3 = $newDiff, !4 = $value, !5 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   12     1        ASSIGN                                                   !1, <array>
   21     2        ASSIGN                                                   !2, <array>
   22     3        ASSIGN                                                   !3, <array>
   23     4        ADD                                              ~10     !0, !1
          5      > FE_RESET_R                                       $11     ~10, ->39
          6    > > FE_FETCH_R                                       ~12     $11, !4, ->39
          7    >   ASSIGN                                                   !5, ~12
   24     8        ISSET_ISEMPTY_DIM_OBJ                         0  ~14     !0, !5
          9      > JMPZ_EX                                          ~14     ~14, ->13
         10    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~15     !1, !5
         11        BOOL_NOT                                         ~16     ~15
         12        BOOL                                             ~14     ~16
         13    > > JMPZ                                                     ~14, ->18
   25    14    >   FETCH_DIM_R                                      ~18     !0, !5
         15        ASSIGN_DIM                                               !2, !5
         16        OP_DATA                                                  ~18
   24    17      > JMP                                                      ->38
   26    18    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~19     !1, !5
         19      > JMPZ_EX                                          ~19     ~19, ->23
         20    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~20     !0, !5
         21        BOOL_NOT                                         ~21     ~20
         22        BOOL                                             ~19     ~21
         23    > > JMPZ                                                     ~19, ->28
   27    24    >   FETCH_DIM_R                                      ~23     !1, !5
         25        ASSIGN_DIM                                               !3, !5
         26        OP_DATA                                                  ~23
   26    27      > JMP                                                      ->38
   28    28    >   FETCH_DIM_R                                      ~24     !0, !5
         29        FETCH_DIM_R                                      ~25     !1, !5
         30        IS_NOT_IDENTICAL                                         ~24, ~25
         31      > JMPZ                                                     ~26, ->38
   29    32    >   FETCH_DIM_R                                      ~28     !0, !5
         33        ASSIGN_DIM                                               !2, !5
         34        OP_DATA                                                  ~28
   30    35        FETCH_DIM_R                                      ~30     !1, !5
         36        ASSIGN_DIM                                               !3, !5
         37        OP_DATA                                                  ~30
   23    38    > > JMP                                                      ->6
         39    >   FE_FREE                                                  $11
   34    40        INIT_FCALL                                               'var_export'
         41        SEND_VAR                                                 !2
         42        SEND_VAL                                                 <true>
         43        DO_ICALL                                         $31     
         44        CONCAT                                           ~32     'Old+Diff%3A+', $31
         45        CONCAT                                           ~33     ~32, '%0A'
         46        ECHO                                                     ~33
   35    47        INIT_FCALL                                               'var_export'
         48        SEND_VAR                                                 !3
         49        SEND_VAL                                                 <true>
         50        DO_ICALL                                         $34     
         51        CONCAT                                           ~35     'New+Diff%3A+', $34
         52        ECHO                                                     ~35
         53      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.52 ms | 1015 KiB | 14 Q