Re: Integer
| From: | Adam Richardson | Date: | Sat, 02 Feb 2013 05:28:11 +0000 |
| Subject: | Re: Integer | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-320144@lists.php.net to get a copy of this message | ||
On Fri, Feb 1, 2013 at 11:40 PM, Ron Piggott <ron.piggott@actsministries.org
> wrote:
> How can I get the 25 by itself?
> - I want to drop the “2.” and remove all the zero’s
>
> Would it be best to turn this into a STRING?
>
I would recommend turning it into a string, splitting the string at the
decimal, then scanning the second string for the first non-zero and storing
the subsequent characters. Working with floats at that precision level
would likely lead to tragic results:
"10.0 times .1 is hardly ever 1.0"
http://www.eg.bucknell.edu/~xmeng/Course/CS2330/Handout/StyleKP.html
Adam
--
Nephtali: A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com