Re: cutting off zeros >> 10.00 to 10

From: Date: Wed, 06 Feb 2002 13:58:48 +0000
Subject: Re: cutting off zeros >> 10.00 to 10
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-16553@lists.php.net to get a copy of this message
I tested this and it seems to work: $n = 1.90; for($i=strlen($n);$i<0;$i--){ if(substr($n,$i,1) == "0"){ $n = substr($n,0,(strlen($n))-1); }else{ break; } } No charge...this time. =) Regards, Mike ----- Original Message ----- From: "Thomas Murphy" <murphy@thepanemgroup.com> To: <php-db@lists.php.net> Sent: Wednesday, February 06, 2002 5:12 AM Subject: [PHP-DB] cutting off zeros >> 10.00 to 10 > Hallo, > > i was wondering if there is a built-in function in php that just cuts > off not needed zeros from float-numbers (like changing "1.90" to "1.9" > or "10.00" to "10"). > I get this numbers from a mysql-database, perhaps there even is a > mysql-function for this??? > > thank you very much, > Thomas Murphy > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.db (#16553) next »