note 47301 added to function.gmp-mod
| From: | Jason dot NOSPAM dot Gagnon at foxmail dot marist dot edu | Date: | Wed, 10 Nov 2004 18:09:39 +0000 |
| Subject: | note 47301 added to function.gmp-mod | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-80362@lists.php.net to get a copy of this message | ||
No offense, but that's not a very good example. A beginning programmer who is unsure on how to
use the modulo operation could be confused as to whether the returned value is how many times d goes
into n or the remainder of d divided by n. Using 8 mod 3 doesn't help, as three goes into
eight 2 times with a remainder of 2.
A better example is:
<?php
$mod = gmp_mod("9", "2");
echo gmp_strval($mod) . "\n";
?>
which will output:
1
----
Manual Page -- http://www.php.net/manual/en/function.gmp-mod.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+47301
Delete -- http://master.php.net/manage/user-notes.php?action=delete+47301&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47301&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47301&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47301&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47301&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47301&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+47301&report=yes
Search -- http://master.php.net/manage/user-notes.php