3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 = [ 'Brian', 'A', 'Leo', 'A', 'Mike' ]; $arr2 = [ 1,2,3,4,5 ]; $set = []; foreach($arr1 as $key => $value){ if(!isset($set[$value])) $set[$value] = true; else{ unset($arr1[$key]); unset($arr2[$key]); } } print_r($arr1); print_r($arr2);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 15
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/BQ9mA
function name:  (null)
number of ops:  23
compiled vars:  !0 = $arr1, !1 = $arr2, !2 = $set, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   15     2        ASSIGN                                                   !2, <array>
   17     3      > FE_RESET_R                                       $8      !0, ->15
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->15
          5    >   ASSIGN                                                   !4, ~9
   18     6        ISSET_ISEMPTY_DIM_OBJ                         0  ~11     !2, !3
          7        BOOL_NOT                                         ~12     ~11
          8      > JMPZ                                                     ~12, ->12
          9    >   ASSIGN_DIM                                               !2, !3
         10        OP_DATA                                                  <true>
         11      > JMP                                                      ->14
   20    12    >   UNSET_DIM                                                !0, !4
   21    13        UNSET_DIM                                                !1, !4
   17    14    > > JMP                                                      ->4
         15    >   FE_FREE                                                  $8
   25    16        INIT_FCALL                                               'print_r'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                                 
   26    19        INIT_FCALL                                               'print_r'
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.97 ms | 1395 KiB | 15 Q