On Tue, 2003-06-17 at 11:42, Thomas Bolioli wrote:
> The docs (see below) for bcmod() are rather skimpy. Does anyone have a 
> clue as to how it works. Basically I want to do this (below code). PS: I 
> am new to PHP but not to programming in general.
> Tom

Unless you're using arbitrary-precision math, the overhead of using
bcmod() is probably not worth it. In general you would just use
the modulus operator '%':

  http://www.php.net/manual/en/language.operators.arithmetic.php

bcmod(a, b) is the arbitrary-precision version of a % b;

At any rate, what is the code doing that you're not expecting?



Torben

> $i = 1;
> while (something true){
>      $modulus = the_modulus_of($i / 4); // does php do % instead of /?
>      if($modulus == 0){
>           do_this_this_time();
>      }
> $i++;
> }
> 
> *bcmod*
> 
> (PHP 3, PHP 4 )
> bcmod --  Get modulus of an arbitrary precision number
> Description
> string bcmod ( string left_operand, string modulus)
> 
> Get the modulus of the left_operand using modulus.


-- 
 Torben Wilson <[EMAIL PROTECTED]>                        +1.604.709.0506
 http://www.thebuttlesschaps.com          http://www.inflatableeye.com
 http://www.hybrid17.com                  http://www.themainonmain.com
 -----==== Boycott Starbucks!  http://www.haidabuckscafe.com ====-----




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

Reply via email to