note 88625 deleted from book.math by danbrown
| From: | danbrown@php.net | Date: | Sun, 01 Feb 2009 16:53:57 +0000 |
| Subject: | note 88625 deleted from book.math by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-150064@lists.php.net to get a copy of this message | ||
Note Submitter: Mike
----
On "23-Dec-2008 07:20", Anonymous gave this function to calculate the number of digits:
function digit_count($num){
for($i=0;pow(10,$i)<=$num;$i++){
if(pow(10,$i+1)>$num){
$num_digits = $i+1;
}
}
return $num_digits;
}
However this is better:
function digit_count($num){
return strlen((string)$num);
}