aquadeluxe Posted April 20, 2008 Share Posted April 20, 2008 I have an array that looks like this Array ( [codelist] => Array ( [name] => Kodewerx Codes [game] => Array ( [name] => Koderwerx Super Mario 64 DS [gameid] => ASME f486f859 [date] => 1979/11/30 00:00 [cheat] => Array ( [0] => Array ( [name] => asdfadsf [code] => 5465465 6546546 [note] => asdfadsf ) [1] => Array ( [name] => wertertueyu [code] => 87846854 4654987 [note] => adfghhtrh ) ) ) ) ) I need something that will count how many different ['codelist']['game'] there are.[/code][/code] Link to comment https://forums.phpfreaks.com/topic/102024-count-for-specific-in-array/ Share on other sites More sharing options...
dptr1988 Posted April 20, 2008 Share Posted April 20, 2008 I don't know off the top of my head of a PHP function that will do that for you. So you will have to write that for your self. It should be someting like this <?php $counter = 0; foreach( $array_that_contains_codelists as $codelist ) { if (isset($codelist['game'])) { $counter++; } } ?> Link to comment https://forums.phpfreaks.com/topic/102024-count-for-specific-in-array/#findComment-522161 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.