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
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.
Whoops, had a little typo in there.
$n = substr($n,0,(strlen($n))-1);
should be
$n = substr($n,0,(strlen($n)-1));
Mike
- Original Message -
From: "Mike Maltese" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, February 06, 2002 5:58 AM
Subject: Re
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" <[EMAIL PROTECTED