note 92788 added to function.array-keys
| From: | hello at haroonahmad dot co dot uk | Date: | Sun, 09 Aug 2009 09:47:46 +0000 |
| Subject: | note 92788 added to function.array-keys | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159227@lists.php.net to get a copy of this message | ||
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
----
Server IP: 92.48.74.199
Probable Submitter: 94.194.11.237
----
Manual Page -- http://www.php.net/manual/en/function.array-keys.php
Edit -- https://master.php.net/note/edit/92788
Del: integrated -- https://master.php.net/note/delete/92788/integrated
Del: useless -- https://master.php.net/note/delete/92788/useless
Del: bad code -- https://master.php.net/note/delete/92788/bad+code
Del: spam -- https://master.php.net/note/delete/92788/spam
Del: non-english -- https://master.php.net/note/delete/92788/non-english
Del: in docs -- https://master.php.net/note/delete/92788/in+docs
Del: other reasons-- https://master.php.net/note/delete/92788
Reject -- https://master.php.net/note/reject/92788
Search -- https://master.php.net/manage/user-notes.php