RE: [PHP-DB] Word Count, rounding and missing zeros

From: Date: Mon, 13 May 2002 02:00:40 +0000
Subject: RE: [PHP-DB] Word Count, rounding and missing zeros
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-19145@lists.php.net to get a copy of this message
$formattedquote=sprintf("%.2f", $thequote); See: http://www.php.net/manual/en/function.sprintf.php Gurhan -----Original Message----- From: Kim Kohen [mailto:kim@webguide.com.au] Sent: Sunday, May 12, 2002 9:59 PM To: PHP Subject: [PHP-DB] Word Count, rounding and missing zeros 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 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.db (#19145) next »