Re: detecting negative numbers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:
    $quant is greater than $amount
    $amount is less than 0
    $quant is less than 0

 if ($quant > $amount or $amount < 0 or $quant < 0) {
    echo "You don't have that many!";
 }

---------------------------------------------------------------------------
Peter Beckman                                                  Internet Guy
beckman@xxxxxxxxxxxxx                             http://www.purplecow.com/
---------------------------------------------------------------------------

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux