CHeck array to see if element occurs twice

Ok guys, what I want to do basically is I have an array of strings and each one will render an image on the screen. However, if a string appears more than once in the array which is possible, it will render multiple times on the screen. How do I scan the array to see if any two or more strings are the same and if so stop it rendering?

in_array() function checks if the same value already exists and [URL=“”]array_unique() function returns the unique values of array. See the examples in the respective functions manual page.

silversurfer5150 use:

$array_with_duplicates = array('one', 'one', 'two', 'two');
print_r($array_with_duplicates); echo'<br />';
$no_dupes_array =array_unique($array_with_duplicates);print_r($no_dupes_array); echo'<br />';


[COLOR=#000000][FONT=Times New Roman]Array ( [0] => one [1] => one [2] => two [3] => two ) [/FONT][/COLOR]
[COLOR=#000000][FONT=Times New Roman]Array ( [0] => one [2] => two )[/FONT][/COLOR]


Hey thanks so much both,
really appreciate it :wink: