PHPBuilder - clean up duplicated entries in array function



RSS Twitter
Snippets Other

clean up duplicated entries in array function

by: Fernando Michelotti
|
June 19, 2001

Version: 0.1

Type: Function

Category: Other

License: GNU General Public License

Description: clean up duplicated entries in array and reindex it. Its actually a really simple script but Ive had quite a few problems before I was able to write it.



<?php
function cleanupduplicates($array){
         $n = 0;
         $crap = array_values(array_unique($array));
         $cc = count($crap);
         for ($i = 0; $i < $cc; $i++) {
              if ($crap[$i] != ''){
              $img[$n] = $crap[$i];
              $n++;
              }
             }
    return $img;
}

?>

Comment and Contribute

Your comment has been submitted and is pending approval.

Author:
Fernando Michelotti

Comment:



Comment:

(Maximum characters: 1200). You have characters left.