From: "Peter Beckman" <[EMAIL PROTECTED]>
> On Wed, 5 Nov 2003, Dillon, John wrote:
> I use this:
> $x['funds'] = (int)preg_replace("/[\$,]/","",$x['funds']);
> where $x['funds'] contains something like $3,249,555.32, and the end
> result is an int of 3249555. I drop the cents... you want to keep 'em,
> change "int" to "float".
I'd be careful of casting it to float. Not sure how this would work, as it
may depend upon your database, but say you casted 100 to a float, it'd be
acceptable for PHP to store it as 99.999999999. Now when you throw that into
a DECIMAL field in MySQL for example, it may only store 99.99 instead of
Floating point errors are a pain. Make sure you test before implementing a
solution like this.
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php