Word Count, rounding and missing zeros
| From: | Kim Kohen | Date: | Mon, 13 May 2002 01:59:10 +0000 |
| Subject: | Word Count, rounding and missing zeros | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-19143@lists.php.net to get a copy of this message | ||
G'day All,
I'm using php to query a mysql db and I need to display a word count from
one of the columns and multiply it to get a quote.
So far I have this:
$thewords = count(split (" ","$adtext"));
$thequote = round(($thewords * .78),2);
In an example with 35 words it returns 27.3 but I'd like it to say 27.30. If
the total doesn't end in a zero it displays fine.
Is there a way to force the zero to display?
Cheers and thanks
kim