ID: 20365
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Open
+Status: Feedback
Bug Type: Math related
Operating System: linux
PHP Version: 4.2.2
New Comment:
Works fine (it should output -4):
[derick@kossu derick]$ php
<?php
$a = -4 % 10;
var_dump($a);
?>
int(-4)
Please provide a short script that reproduces this problem.
Derick
Previous Comments:
------------------------------------------------------------------------
[2002-11-11 09:40:40] [EMAIL PROTECTED]
PHP's modulo operator cannot work with negative numbers. The positive
ones work fine, but modulo is defined also on negatives ;-)
ex: 10%3 = 1 [php gives 1]
-4%10 = 6 [php gives NULL]
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20365&edit=1