note 36635 added to language.operators.arithmetic
| From: | todd at magnifisites dot com | Date: | Thu, 16 Oct 2003 20:22:14 +0000 |
| Subject: | note 36635 added to language.operators.arithmetic | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-58718@lists.php.net to get a copy of this message | ||
There isn't much detail in the PHP Manual regarding the PHP modulus operator (%). It seems as
though the PHP modulus operator (%) works on integer operands. If PHP operates like Perl, then the
modulus operator (%) converts its operands to integers before finding the remainder according to
integer division. Testing seems to prove the theory:
<?php
$dividend = 7;
$divisor = 2.4;
print $dividend%$divisor; // prints 1
print fmod($dividend, $divisor); // prints 2.2
?>
----
Manual Page -- http://www.php.net/manual/en/language.operators.arithmetic.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36635
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36635&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36635&report=yes
Search -- http://master.php.net/manage/user-notes.php