Re: A math puzzler for you
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: A math puzzler for you

From: Justin Koivisto <justin@koivi.com>
Date: Fri Apr 07 2006 - 21:38:23 CEST

monomaniac21 wrote:
> I have a php code that generates numbers. sometimes is generates whole
> numbers but most of the time decimals. How can I, when it generates a
> whole number, convert the number to n.0
> where n is the whole number?
>
> For example 23 := 23.0

$int = 23;

$float = floatval($int);

If you mean for just output purposes:
printf('%.1f',$int);

-- 
Justin Koivisto, ZCE - justin@koivi.com
http://koivi.com
Received on Mon May 1 02:50:53 2006