note 26439 added to language.operators.arithmetic

From: Date: Wed, 30 Oct 2002 21:27:21 +0000
Subject: note 26439 added to language.operators.arithmetic
Groups: php.notes 
Request: Send a blank email to php-notes+get-38767@lists.php.net to get a copy of this message
The above mentioned method of calculating div using floor() is subject to the same shortcomings as the method stated earlier: (int) ($foo / $bar) As stated in an earlier message (10-Jul-2002 06:41) this will not always work as expected due to round-off errors - if the above mentioned method fails so will the method using floor() ! The only correct solution to this problem is the answer from 17-Jul-2002 04:14: function div($a,$b){ return ($a-($a % $b))/$b; } -- http://www.php.net/manual/en/language.operators.arithmetic.php http://master.php.net/manage/user-notes.php?action=edit+26439 http://master.php.net/manage/user-notes.php?action=delete+26439 http://master.php.net/manage/user-notes.php?action=reject+26439

« previous php.notes (#38767) next »