Re: [PHP] Conversion Float => Integer
- Date: Sat, 16 Sep 2017 14:40:16 +0100
- From: AshleySheridan <ash@xxxxxxxxxxxxxxxxxxxx>
- Subject: Re: [PHP] Conversion Float => Integer
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.
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