note 38945 added to language.expressions

From: Date: Tue, 13 Jan 2004 02:29:10 +0000
Subject: note 38945 added to language.expressions
Groups: php.notes 
Request: Send a blank email to php-notes+get-63388@lists.php.net to get a copy of this message
In response to the comment posted by 'Miki' below, the % operator is indeed a C / C++ style modulus operator. However, Ruben Bonke's comment was also correct - Modulus can be determined by repeatedly subtracting an integer number from another integer until it reaches a value is between 0 and the value you're subtracting. So, for example, in the case of 23 % 5, the result will be 3: 23 - 5 = 18 (not between 5 and 0, so continue) 18 - 5 = 13 (not between 5 and 0, so continue) 13 - 5 = 8 (not between 5 and 0, so continue) 8 - 5 = 3 (less than 5 and greater than 0, so stop) This is probably the simplest way to determine a modulus, and I believe it's the method that most computer processors use in hardware. ---- Manual Page -- http://www.php.net/manual/en/language.expressions.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+38945 Delete -- http://master.php.net/manage/user-notes.php?action=delete+38945&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+38945&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#63388) next »