3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 0 => [ "SERIAL" => "qwerty", "BRANCH" => "TEST1" ], 1 => [ "SERIAL" => "qwer", "BRANCH" => "TEST1" ], 2 => [ // RETURN THIS AS ERROR AS THE BRANCH "TEST1" has already "qwerty" serial "SERIAL" => "qwerty", "BRANCH" => "TEST2" ], 3 => [ "SERIAL" => "qwerty", "BRANCH" => "TEST1" ], 4 => [ // RETURN THIS AS ERROR AS THE BRANCH "TEST1" has already "qwerty" serial "SERIAL" => "qwerty", "BRANCH" => "TEST3" ], ]; foreach($arr as $sub){ $result[$sub['SERIAL']][] = $sub['BRANCH']; } foreach($result as $branches){ $unique = array_unique($branches); if(count($unique) >1){ var_dump("ERROR:", array_slice($unique,1)); } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 9
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 28
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 28
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 27
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 27
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
Branch analysis from position: 9
filename:       /in/Qj98N
function name:  (null)
number of ops:  30
compiled vars:  !0 = $arr, !1 = $sub, !2 = $result, !3 = $branches, !4 = $unique
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   26     1      > FE_RESET_R                                       $6      !0, ->9
          2    > > FE_FETCH_R                                               $6, !1, ->9
   27     3    >   FETCH_DIM_R                                      ~7      !1, 'SERIAL'
          4        FETCH_DIM_R                                      ~10     !1, 'BRANCH'
          5        FETCH_DIM_W                                      $8      !2, ~7
          6        ASSIGN_DIM                                               $8
          7        OP_DATA                                                  ~10
   26     8      > JMP                                                      ->2
          9    >   FE_FREE                                                  $6
   30    10      > FE_RESET_R                                       $11     !2, ->28
         11    > > FE_FETCH_R                                               $11, !3, ->28
   31    12    >   INIT_FCALL                                               'array_unique'
         13        SEND_VAR                                                 !3
         14        DO_ICALL                                         $12     
         15        ASSIGN                                                   !4, $12
   32    16        COUNT                                            ~14     !4
         17        IS_SMALLER                                               1, ~14
         18      > JMPZ                                                     ~15, ->27
   33    19    >   INIT_FCALL                                               'var_dump'
         20        SEND_VAL                                                 'ERROR%3A'
         21        INIT_FCALL                                               'array_slice'
         22        SEND_VAR                                                 !4
         23        SEND_VAL                                                 1
         24        DO_ICALL                                         $16     
         25        SEND_VAR                                                 $16
         26        DO_ICALL                                                 
   30    27    > > JMP                                                      ->11
         28    >   FE_FREE                                                  $11
   35    29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.36 ms | 1001 KiB | 16 Q