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

2002-05-12 Thread Gurhan Ozen

$formattedquote=sprintf("%.2f", $thequote);

See: http://www.php.net/manual/en/function.sprintf.php

Gurhan

-Original Message-
From: Kim Kohen [mailto:[EMAIL PROTECTED]]
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


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




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

2002-05-12 Thread Kim Kohen

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