Re: distinct element from array
| From: | Bogdan Stancescu | Date: | Sun, 06 Jan 2002 14:20:12 +0000 |
| Subject: | Re: distinct element from array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-79607@lists.php.net to get a copy of this message | ||
$distincts=array();
while (list($key,$val)=each($yourarray)
{
if (!in_array($val,$distincts))
{
$distincts[]=$val;
}
}
"Kancha ." wrote:
> An array contains various values eg: list of fruits.
> Now i want to retrieve only unique fruits from the
> array. The array may contain duplicate names. How can
> i achieve this?
>
> __________________________________________________
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!
> http://promo.yahoo.com/videomail/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net