note 35525 modified in function.array-count-values by vrana

From: Date: Tue, 17 Aug 2004 13:57:17 +0000
Subject: note 35525 modified in function.array-count-values by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79852@lists.php.net to get a copy of this message
my solution for count on multidimentional arrays. <?php for($i = 0; $i < count($array); $i++) { $detail = explode("|", $array[$i]); echo "$i - $detail[0] - $detail[1]<br><br>"; if($detail[1] == '1') { $wieoft1 = $wieoft1 +=1; } if($detail[1] == '2') { $wieoft2 = $wieoft2 +=1; } if($detail[1] == '3') { $wieoft3 = $wieoft3 +=1; } } echo ". $wieoft1 : $wieoft2 : $wieoft3"; ?> looks not pretty fine yet works great for me. make it bigger for your own. --was-- my solution for count on multidimentional arrays. for($i = 0; $i < count($array); $i++) { $detail = explode("|", $array[$i]); echo "$i - $detail[0] - $detail[1]<br><br>"; if($detail[1] == '1') { $wieoft1 = $wieoft1 +=1; } if($detail[1] == '2') { $wieoft2 = $wieoft2 +=1; } if($detail[1] == '3') { $wieoft3 = $wieoft3 +=1; } } echo ". $wieoft1 : $wieoft2 : $wieoft3"; looks not pretty fine yet works great for me. make it bigger for your own. http://php.net/manual/en/function.array-count-values.php

« previous php.notes (#79852) next »