note 105363 added to function.array-count-values

From: Date: Thu, 11 Aug 2011 20:10:24 +0000
Subject: note 105363 added to function.array-count-values
Groups: php.notes 
Request: Send a blank email to php-notes+get-182433@lists.php.net to get a copy of this message
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; } ---- Server IP: 69.147.83.197 Probable Submitter: 99.36.205.125 ---- Manual Page -- http://www.php.net/manual/en/function.array-count-values.php Edit -- https://master.php.net/note/edit/105363 Del: integrated -- https://master.php.net/note/delete/105363/integrated Del: useless -- https://master.php.net/note/delete/105363/useless Del: bad code -- https://master.php.net/note/delete/105363/bad+code Del: spam -- https://master.php.net/note/delete/105363/spam Del: non-english -- https://master.php.net/note/delete/105363/non-english Del: in docs -- https://master.php.net/note/delete/105363/in+docs Del: other reasons-- https://master.php.net/note/delete/105363 Reject -- https://master.php.net/note/reject/105363 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#182433) next »