|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-04-11 06:21 UTC] sander@php.net
[2002-04-11 06:31 UTC] chris at owta dot net
[2002-04-11 11:02 UTC] rasmus@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 09:00:01 2025 UTC |
Here's the code <? $quantities = array(5000.00, 1000.00, 200.00); $amount = 6200; debug($quantities); foreach ($quantities as $quantity) { $divVal = ($amount/$quantity); echo ++$i.". Quantity:\n".$quantity."<BR>"; echo "divVal: ".$divVal." - ".var_dump($divVal)."<BR>\n"; echo "Amount: ".$amount."\n"; if (floor($divVal) > 0) { echo " [floored divVal is greater than zero]\n"; $amount = ($divVal - floor($divVal)) * $quantity; } echo "<BR><BR>"; } ?> You'll see the floor function is operating incorrectly?