3v4l.org

run code in 500+ PHP versions simultaneously
<?php $d = [ [1,2,3,4,5], [1,6,7,8,9], [1,5,6,10,11], [6,12,13,14,15] ]; $set = []; foreach($d as $idx => $val){ foreach($val as $v){ $set[ $v ][ $idx ] = true; } } $removedNumbers = []; foreach($d as $idx => $val){ $commonElements = 0; foreach($val as $v){ if(count($set[ $v ]) > 1){ $commonElements++; unset($set[ $v ][ $idx ]); } } if($commonElements > 1){ unset($d[ $idx ]); $removedNumbers = array_merge($removedNumbers, $val); } } print_r($removedNumbers); print_r($d);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 11
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 39
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 39
Branch analysis from position: 17
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 29
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 29
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 28
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 28
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 38
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 38
Branch analysis from position: 29
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
Branch analysis from position: 13
filename:       /in/kBkS7
function name:  (null)
number of ops:  47
compiled vars:  !0 = $d, !1 = $set, !2 = $val, !3 = $idx, !4 = $v, !5 = $removedNumbers, !6 = $commonElements
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                       !0, <array>
   11     1        ASSIGN                                                       !1, <array>
   12     2      > FE_RESET_R                                           $9      !0, ->13
          3    > > FE_FETCH_R                                           ~10     $9, !2, ->13
          4    >   ASSIGN                                                       !3, ~10
   13     5      > FE_RESET_R                                           $12     !2, ->11
          6    > > FE_FETCH_R                                                   $12, !4, ->11
   14     7    >   FETCH_DIM_W                                          $13     !1, !4
          8        ASSIGN_DIM                                                   $13, !3
          9        OP_DATA                                                      <true>
   13    10      > JMP                                                          ->6
         11    >   FE_FREE                                                      $12
   12    12      > JMP                                                          ->3
         13    >   FE_FREE                                                      $9
   18    14        ASSIGN                                                       !5, <array>
   20    15      > FE_RESET_R                                           $16     !0, ->39
         16    > > FE_FETCH_R                                           ~17     $16, !2, ->39
         17    >   ASSIGN                                                       !3, ~17
   21    18        ASSIGN                                                       !6, 0
   22    19      > FE_RESET_R                                           $20     !2, ->29
         20    > > FE_FETCH_R                                                   $20, !4, ->29
   23    21    >   FETCH_DIM_R                                          ~21     !1, !4
         22        COUNT                                                ~22     ~21
         23        IS_SMALLER                                                   1, ~22
         24      > JMPZ                                                         ~23, ->28
   24    25    >   PRE_INC                                                      !6
   25    26        FETCH_DIM_UNSET                                      $25     !1, !4
         27        UNSET_DIM                                                    $25, !3
   22    28    > > JMP                                                          ->20
         29    >   FE_FREE                                                      $20
   29    30        IS_SMALLER                                                   1, !6
         31      > JMPZ                                                         ~26, ->38
   30    32    >   UNSET_DIM                                                    !0, !3
   31    33        INIT_FCALL                                                   'array_merge'
         34        SEND_VAR                                                     !5
         35        SEND_VAR                                                     !2
         36        DO_ICALL                                             $27     
         37        ASSIGN                                                       !5, $27
   20    38    > > JMP                                                          ->16
         39    >   FE_FREE                                                      $16
   35    40        INIT_FCALL                                                   'print_r'
         41        SEND_VAR                                                     !5
         42        DO_ICALL                                                     
   36    43        INIT_FCALL                                                   'print_r'
         44        SEND_VAR                                                     !0
         45        DO_ICALL                                                     
         46      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.53 ms | 1982 KiB | 14 Q