Return to Snippet

Revision: 33537
at October 9, 2010 21:35 by stz184


Initial Code
function count_duplicates($array, $find_value) {
	$counter = 0;
	foreach($array as $value) {
		if($value == $find_value) {
			$counter++;
		}
	}
	return $counter;
}

Initial URL

                                

Initial Description
Parameters: $array - haystack, $find-value - needle to check for duplicates

Initial Title
Check for duplicate element in array

Initial Tags
array

Initial Language
PHP