Re: Fmod with PHP < 4.2.0 ?

From: Date: Wed, 17 Mar 2004 14:30:06 +0000
Subject: Re: Fmod with PHP < 4.2.0 ?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-180677@lists.php.net to get a copy of this message
On Wednesday 17 March 2004 22:05, BEOI 7308 wrote: > My ISP's PHP is < 4.2.0, and the fmod function was not available before > 4.2.0 > > My question : is there a replacement to fmod, or what can i do to do a > fmod without it ? Write your own function: If r = fmod(x, y) x = i * y + r Then $i = floor($x/$y); // you may have to use ceil depending on how you // want to deal with negative values $r = $x - ($i * $y); I'll let you work out how to deal with negative values for x, y. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* The very remembrance of my former misfortune proves a new one to me. -- Miguel de Cervantes */

« previous php.general (#180677) next »