note 18625 modified in function.count-chars by vrana

From: Date: Tue, 17 Aug 2004 14:55:48 +0000
Subject: note 18625 modified in function.count-chars by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79743@lists.php.net to get a copy of this message
// Usefulness of the two functions <?php $string="aaabbc"; // You just want to count the letter a $acount=substr_count($string,"a"); // You want to count both letter a and letter b $counts=count_chars($string,0); $acount=$counts[ord("a")]; $bcount=$counts[ord("b")]; ?> --was-- // Usefulness of the two functions $string="aaabbc"; // You just want to count the letter a $acount=substr_count($string,"a"); // You want to count both letter a and letter b $counts=count_chars($string,0); $acount=$counts[ord("a")]; $bcount=$counts[ord("b")]; http://php.net/manual/en/function.count-chars.php

« previous php.notes (#79743) next »