3v4l.org

run code in 300+ PHP versions simultaneously
<?php function doopScooper($dataArray, $uniqueKeys){ // store the the previously checked sub-arrays here $checked = array(); //loop through the array foreach($dataArray as $k=>$row){ // this will become the sub array that needs to be checked $checkArray = array(); //create the sub array for comparison foreach($uniqueKeys as $key) $checkArray[$key] = isset($row[$key]) ? $row[$key] : NULL; // convert sub array to string for easy comparison $checkArray = json_encode($checkArray); // check for duplicates, if found delete, else add to the checking array if(in_array($checkArray, $checked)) unset($dataArray[$k]); else $checked[] = $checkArray; } return $dataArray; } $lines = "unfinished unfinished 17876 open peters Current/17876 - unfinished unfinished 17830 new peters Current/17830 - unfinished unfinished 17810 new jongr Current/17810 -"; $lines = explode("\n",$lines); $parts=[]; foreach ($lines as $line) $parts[] = explode(' ', $line); var_dump($parts); exit; $lines = doopScooper($parts, array(7));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 16
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 16
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 16
filename:       /in/uGgU4
function name:  (null)
number of ops:  27
compiled vars:  !0 = $lines, !1 = $parts, !2 = $line
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   ASSIGN                                                   !0, 'unfinished++unfinished++17876+++open++++++++peters++++++Current%2F17876+-+%0Aunfinished++unfinished++17830+++new+++++++++peters++++++Current%2F17830+-+%0Aunfinished++unfinished++17810+++new+++++++++jongr+++++++Current%2F17810+-'
   33     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%0A'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !0, $4
   34     6        ASSIGN                                                   !1, <array>
   35     7      > FE_RESET_R                                       $7      !0, ->16
          8    > > FE_FETCH_R                                               $7, !2, ->16
          9    >   INIT_FCALL                                               'explode'
         10        SEND_VAL                                                 '++'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                         $9      
         13        ASSIGN_DIM                                               !1
         14        OP_DATA                                                  $9
         15      > JMP                                                      ->8
         16    >   FE_FREE                                                  $7
   36    17        INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                                 
         20      > EXIT                                                     
   38    21*       INIT_FCALL                                               'doopscooper'
         22*       SEND_VAR                                                 !1
         23*       SEND_VAL                                                 <array>
         24*       DO_FCALL                                      0  $11     
         25*       ASSIGN                                                   !0, $11
         26*     > RETURN                                                   1

Function doopscooper:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 33
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 33
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 18
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/uGgU4
function name:  doopScooper
number of ops:  36
compiled vars:  !0 = $dataArray, !1 = $uniqueKeys, !2 = $checked, !3 = $row, !4 = $k, !5 = $checkArray, !6 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        ASSIGN                                                   !2, <array>
    9     3      > FE_RESET_R                                       $8      !0, ->33
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->33
          5    >   ASSIGN                                                   !4, ~9
   12     6        ASSIGN                                                   !5, <array>
   15     7      > FE_RESET_R                                       $12     !1, ->18
          8    > > FE_FETCH_R                                               $12, !6, ->18
   16     9    >   ISSET_ISEMPTY_DIM_OBJ                         0          !3, !6
         10      > JMPZ                                                     ~14, ->14
         11    >   FETCH_DIM_R                                      ~15     !3, !6
         12        QM_ASSIGN                                        ~16     ~15
         13      > JMP                                                      ->15
         14    >   QM_ASSIGN                                        ~16     null
         15    >   ASSIGN_DIM                                               !5, !6
         16        OP_DATA                                                  ~16
   15    17      > JMP                                                      ->8
         18    >   FE_FREE                                                  $12
   19    19        INIT_FCALL                                               'json_encode'
         20        SEND_VAR                                                 !5
         21        DO_ICALL                                         $17     
         22        ASSIGN                                                   !5, $17
   22    23        INIT_FCALL                                               'in_array'
         24        SEND_VAR                                                 !5
         25        SEND_VAR                                                 !2
         26        DO_ICALL                                         $19     
         27      > JMPZ                                                     $19, ->30
         28    >   UNSET_DIM                                                !0, !4
         29      > JMP                                                      ->32
   23    30    >   ASSIGN_DIM                                               !2
         31        OP_DATA                                                  !5
    9    32    > > JMP                                                      ->4
         33    >   FE_FREE                                                  $8
   26    34      > RETURN                                                   !0
   27    35*     > RETURN                                                   null

End of function doopscooper

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
135.34 ms | 1407 KiB | 22 Q