Re: Conversion Float => Integer

From: Date: Sat, 16 Sep 2017 13:47:17 +0000
Subject: Re: Conversion Float => Integer
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-326220@lists.php.net to get a copy of this message
I think (int)$float is the fastest as it is not a function call. In fact the difference is a really small one. On 16.09.17 16:40, AshleySheridan wrote:
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
-- Best regards, Yuriy Peskov

« previous php.general (#326220) next »