note 92788 deleted from function.array-keys by felipe
| From: | felipe@php.net | Date: | Sun, 09 Aug 2009 15:19:09 +0000 |
| Subject: | note 92788 deleted from function.array-keys by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-159233@lists.php.net to get a copy of this message | ||
Note Submitter: hello at haroonahmad dot co dot uk
----
A quick example to display "the number of occurences" of a value in an array by using
array_keys() can be.
echo count(array_keys($targetArray,"searchValue");
e.g
$sites = array("google.com","haroonahmad.co.uk","google.com");
echo "Google occurs " . count(array_keys($sites,"google.com")) . " times in
sites";
I hope it helps,
Haroon Ahmad