LinuxSA Mailing list archives

Index: [thread] [date] [subject] [author] [stats]
  From: Andrew Halliday <andrew@recalldesign.com>
  To  : Andrew Reid <andrew.reid@plug.cx>
<linuxsa@linuxsa.org.au> Date: Thu, 8 Feb 2001 17:44:25 +1030

Re: PHP Question...

number_format($string,2);

First param: number to format
Sec param: number of decimals
May need to do an atoi first?

AndrewH

----- Original Message -----
From: "Andrew Reid" <andrew.reid@plug.cx>
To: <linuxsa@linuxsa.org.au>
Sent: Thursday, February 08, 2001 4:35 PM
Subject: PHP Question...


> Hello PHP Programmers,
>
> I'm writing some stuff in PHP that gets a value from a SQL Database and
> prints it out.
>
> The value is a a filesize in bytes (ie, "1024").
>
> I've divided it by 1024 twice (ie, "$string = $string / 1024 ; $string =
> $string / 1024 ;") and it now looks something like:
>
> 47.1231231123
>
> This is obviously 47.12MB. What I want to do is to trim the string down
> to get only the last two decimal places.
>
> Any suggestions or tips would be greatly appreciated.
>
>
> Regards,
> --
> Andrew Reid       email: andrew.reid@plug.cx
>       www:   http://www.plug.cx
> "Where the hell is       phone: +61 401 946 813
>  Christmas Island Anyway?"
>          - nixcx.com
>
> --
> LinuxSA WWW: http://www.linuxsa.org.au/  IRC: #linuxsa on irc.linux.org.au
> To unsubscribe from the LinuxSA list:
>   mail linuxsa-request@linuxsa.org.au with "unsubscribe" as the subject
>

-- 
LinuxSA WWW: http://www.linuxsa.org.au/  IRC: #linuxsa on irc.linux.org.au
To unsubscribe from the LinuxSA list:
  mail linuxsa-request@linuxsa.org.au with "unsubscribe" as the subject


Index: [thread] [date] [subject] [author] [stats]
Return to the LinuxSA Mailing List Information Page