note 105363 deleted from function.array-count-values by danbrown

From: Date: Thu, 11 Aug 2011 20:11:31 +0000
Subject: note 105363 deleted from function.array-count-values by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-182434@lists.php.net to get a copy of this message
Note Submitter: C Koone ---- Here is a slight improvement over byron down below, this will allow you to search through a multidimensional array for unique values. function count_repeat_values($needle, $haystack,$field){ $x = count($haystack); for($i = 0; $i < $x; $i++){ if($haystack[$i][$field] == $needle){ $needle_array[] = $haystack[$i]; } } $number_of_instances = count($needle_array); return $number_of_instances; }

« previous php.notes (#182434) next »