Re: detecting negative numbers
| From: | Dave W | Date: | Sun, 16 Jul 2006 19:35:57 +0000 |
| Subject: | Re: detecting negative numbers | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-42206@lists.php.net to get a copy of this message | ||
They are both positive numbers. I want to see if, when subtract, do they
equal a negative number?
On 7/16/06, Peter Beckman <beckman@purplecow.com> wrote:
On Sun, 16 Jul 2006, Dave W wrote: Currently I have this: if($quant > $amount) {echo "You don't have that many!"; } $quant is the user inputted amount and $amount is the amount that they actually have. Is there any way of checking if the result is negative rather than doing what I have above? I'm not sure which "result" you are refering to, but this echo's if:-- Dave W$quant is greater than $amount $amount is less than 0 $quant is less than 0if ($quant > $amount or $amount < 0 or $quant < 0) {echo "You don't have that many!";} ---------------------------------------------------------------------------Peter Beckman InternetGuy beckman@purplecow.com http://www.purplecow.com/ ---------------------------------------------------------------------------