Hallo Abdul,
ich habe ein array mit zahlen zb.
1,1,2,2,3,4,4
oder
1,2,3,4,4,4,4,5,5,6 bis maximal 10 immer ab 1wie kann ich jetzt zählen wieviele 1er im array sind
wieviele 2er usw. ?
$cnthash = Array();
for($i=0;$i<count($array);$i++) {
$cnthash[$array[$i]]++;
}
Danach kannst du per $cnthash[1] z. B. herausfinden, wie oft
die 1 vorkommt. Nachteil bei der Sache ist, dass der Aufwand
linear ist.
Gruesse,
CK
--
http://cforum.teamone.de/
http://wishlist.tetekum.de/
If God had meant for us to be in the Army, we would have been born with green, baggy skin.
http://cforum.teamone.de/
http://wishlist.tetekum.de/
If God had meant for us to be in the Army, we would have been born with green, baggy skin.