Re: % always return int?

From: Date: Fri, 04 May 2001 07:56:14 +0000
Subject: Re: % always return int?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-51383@lists.php.net to get a copy of this message
At 21:33 3-5-2001 -0300, Christian Dechery wrote:
How can I get the modulus of an float by an integer? $time=3.345345; $time2=2.34234; $time3=$time%$time2;
try $time3=(long)$time%$time2; something like that should work
echo $time3; this outputs 1. $time=3.345345; $time2=2 $time3=$time%$time2; echo $time3; this also outputs 1. Of course... when dividing two floats, there is no remainder... but, there is an integer invovled... is automatically converted to float before dividing, so that's why no remainder? ____________________________ . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net


« previous php.general (#51383) next »