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
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to