Re: Conversion Float => Integer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2017-09-16 at 16:36 +0300, Michelle Konzack wrote:
> What is the easiest method to convert a Float to Integer?
> 
> I have (only) to get rid of anything after the decimal point.
> 
> Thanks
> 
> 

There are a few ways:

$int = intval($float);
$int = (int)$float;
$int = floor($float);

Not sure which is faster, but they're all pretty easy
-- 
Thanks,
Ash

http://www.ashleysheridan.co.uk


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux