开发者

In PHP how do i write: IS NOT SMALLER THAN

开发者 https://www.devze.com 2023-01-09 02:07 出处:网络
For example: a is not smalle开发者_运维知识库r than b How do i write this ?if ($a >= $b) if !($a < $b)

For example: a is not smalle开发者_运维知识库r than b

How do i write this ?


if ($a >= $b) 

if !($a < $b)


Having an exclamation point outside of the condition causes a syntax error, doesn't it?

if(!($a < $b))

"IF NOT A SMALLER THAN B"

Makes the most linguistic sense compared to their question.


If a is not smaller than b, a is either greater than or equal to b so:

$a >= $b


!($a<$b)

Or simply

$a>=$b


a >= b

Assuming that a and b are guaranteed to be comparable.


if( $a >= $b ) {
    echo $a . " is not smaller than " . $b;
} else {
    echo $a . " is smaller than " . $b;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消