[英]Check variable is not less than zero
I need to Check variable is not less than zero我需要检查变量不小于零
if ( $currentUserLimits >= 0 ) {
//do something
} elseif($currentUserLimits < $totalPurchaseUnitCount && $currentUserLimits not less then 0) {
//do something else.
} else {
//do something else.
}
Clear my question
清除我的问题
This is all about offers apply on products and each customer have a purchases limit I have 2 variables and 3 cases.这都是关于适用于产品的优惠,每个客户都有一个购买限制,我有 2 个变量和 3 个案例。
$currentUserLimits
which will return the current customer limits. $currentUserLimits
将返回当前的客户限制。$totalPurchaseUnitCount
which will return the current purchases. $totalPurchaseUnitCount
将返回当前购买。 My 3 cases.我的3个案例。
$currentUserLimits still > 0
means the customer still have units in offer.$currentUserLimits still > 0
表示客户仍有商品在售。 Ex.$currentUserLimits = 15
and the $totalPurchaseUnitCount = 10
still the customer has 5 in his $currentUserLimits
. $currentUserLimits = 15
和$totalPurchaseUnitCount = 10
仍然客户在他的$currentUserLimits
有 5 。$currentUserLimits = 5
and the $totalPurchaseUnitCount = 10
. $currentUserLimits = 5
和$totalPurchaseUnitCount = 10
。$currentUserLimits
is 0 or less then 0.$currentUserLimits
为 0 或小于 0。 Sorry making y'all read all this stuff but really the 3 cases confuses me.很抱歉让你们都阅读了所有这些内容,但实际上这 3 个案例让我感到困惑。
how to write not less than 0
not less than 0
怎么写
你已经在 ($currentUserLimits >= 0)
Check this out.看一下这个。
if ( $currentUserLimits >= 0 ) {
//do something
} elseif(($currentUserLimits < $totalPurchaseUnitCount) && !($currentUserLimits < 0)) {
//do something else.
} else {
//do something else.
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.