|
|
 |
FN-FORUM: PHP Float
date posted 5th August 2003 18:11
I knew there was a reason I didn't use it though, just read it in the
manual.
It can lead to unexpected results when converting from floating point values
to integer.
So you're best off using the functions I (and a few others) suggested
instead.
Jamie (having a nightmare evening lol)
----- Original Message -----
From: "Jamie McDonald" [EMAIL REMOVED]
To: [EMAIL REMOVED]
Sent: Tuesday, August 05, 2003 6:03 PM
Subject: FN-FORUM: PHP Float
> actually i lied, there never used to be typecasting, so (int) $no should
> have worked.
>
> Jamie
>
> ----- Original Message -----
> From: "Jamie McDonald" [EMAIL REMOVED]
> To: [EMAIL REMOVED]
> Sent: Tuesday, August 05, 2003 5:58 PM
> Subject: Re: FN-FORUM: PHP Float
>
>
> > look up the math functions in the PHP manual.
> >
> > Theres no typecasting in PHP
> >
> > you can use the functions ceil, floor and round to acheive what you're
> after
> >
> > i.e $foo = round($no)
> >
> > Jamie
> >
> > ----- Original Message -----
> > From: "Rus Foster" [EMAIL REMOVED]
> > To: [EMAIL REMOVED]
> > Sent: Tuesday, August 05, 2003 6:04 PM
> > Subject: FN-FORUM: PHP Float
> >
> >
> > >
> > > Hi All,
> > > Last questions for the day. I've got a string that say could be 123.4
> or
> > > 123.323. How would I get it to 123.00. I've got the number in a
variable
> > > which I then went to put into another varible (this case a session
> > > handeler)
> > >
> > > so I've got
> > > $no="123.321";
> > >
> > > I've tried B
> > > $foo= (int) ($no);
> > >
> > > but didn't work. Can someone give me a push please
> > >
> > > Rgds
> > >
> > > Rus
> > > --
> > > w: http://www.jvds.com | Linux + FreeBSD VDS's from $15/mo
> > > e: [EMAIL REMOVED] | Totally Customizable Technology
> > > t: 07919 373537 | General FreeBSD Forums:
> > > 10% donation to FreeBSD | http://forums.jvds.com/viewforum.php?f=7
> > >
> > >
> > >
> > > ==========
> > > fido.net are pleased to sponsor these Freelancers messages. For all
> > > your web hosting needs check out http://www.fido.net/ with hosting
> > > packages starting from just £46.95 a year including VAT.
> > > Free 0871 Fax2Email numbers also available online!
> > > http://www.fido.net/ - the internet made simple! - 0800 1072 666
> > >
> > > To advertise here: http://www.freelancers.net/advertising.html
> > >
> > > |
 |
|