...

View Full Version : php arrays with same value



gusblake
11-03-2006, 12:56 AM
i have an array, eg

$arr[0]="banana";
$arr[1]="apple";
$arr[2]="banana";
$arr[3]="banana";
$arr[4]="pineapple";
and i need to find out how many different values there are (3 in the above case), and then list them on a page. How would I go about this?
tia for any suggestions!
gus

ess
11-03-2006, 02:18 AM
There is a php function that should do the trick

$unique = array_unique ( $original )

click here (http://uk2.php.net/array_unique)to read more about this function from php.net

I hope that helps..

All the best
:thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum