note 21788 added to function.abs

From: Date: Mon, 27 May 2002 08:03:10 +0000
Subject: note 21788 added to function.abs
Groups: php.notes 
Request: Send a blank email to php-notes+get-31066@lists.php.net to get a copy of this message
This makes for an easy way to make sure people don't try something funny in your shopping cart scripts like setting QTY to a negative value: if you're calculating something like ... $item_cost * $item_qty = $total_item_cost; $total_item_cost will be negative and it'll subtract from the total cost of their purchase. :D Probably not what you want and something easy to overlook if you're not used to completely QA testing your apps. You probably came up with some other way to do it, but if you did something more than an abs($item_qty), you might consider just using abs(). -- http://www.php.net/manual/en/function.abs.php http://master.php.net/manage/user-notes.php?action=edit+21788 http://master.php.net/manage/user-notes.php?action=delete+21788 http://master.php.net/manage/user-notes.php?action=reject+21788

« previous php.notes (#31066) next »