note 92789 deleted from function.array-keys by danbrown

From: Date: Sun, 09 Aug 2009 17:45:08 +0000
Subject: note 92789 deleted from function.array-keys by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-159244@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. <?php echo count(array_keys($targetArray,"searchValue"); ?> e.g <?php $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

« previous php.notes (#159244) next »