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));

preferences:
26.34 ms | 402 KiB | 5 Q