Re: [PHP-DB] cutting off zeros >> 10.00 to 10

2002-02-06 Thread Thomas Murphy

i still have some problems on typecasting my float-variable to a string
variable.
i used something like this:

$n = $row["Points"];
settype($n,"string");

but the zeros are still there - as if $n is still handled as a float
number not a string.
with $n = 1.90 it's converted to 1.9 without problems...

bye,
Thomas Murphy

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] cutting off zeros >> 10.00 to 10

2002-02-06 Thread Thomas Murphy

Hello Mike,

Mike Maltese wrote:
> 
> 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. =)

thank you very much. :)

bye,
Thomas Murphy

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] cutting off zeros >> 10.00 to 10

2002-02-06 Thread Thomas Murphy

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