note 75470 deleted from function.array-combine by bjori
| From: | bjori@php.net | Date: | Thu, 21 Feb 2008 20:26:45 +0000 |
| Subject: | note 75470 deleted from function.array-combine by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-136370@lists.php.net to get a copy of this message | ||
Note Submitter: toth dot janas at gmail dot com
----
If you have an array and include duplicated element, and you want to that this element just show
once in array, then this function is very good solution.
function array_no_duplicate($array_tmb){
$new_array = array();
for($i = 0; $i < count($array_tmb); $i++){
$van = 0;
for($j = 0; $j < count($array_tmb); $j++){
if( $new_array[$j] == $array_tmb[$j]) $van = 1;
}
if($van == 0){
$new_array[$i] = $array_tmb[$i];
}else continue;
}
return $new_array;
}