>!= PHP 运算符,不等于或大于怎么写?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3205132/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
>!= PHP operator, how to write not equal to or greater than?
提问by Sam
How can I write not greater-than-or-equal-to in PHP?
如何在 PHP 中编写不大于或等于?
Is it >!=?
是>!=吗?
回答by Svish
Isn't not greater than or equal to xthe same as less than x?
不not greater than or equal to x一样less than x吗?
回答by Rab
Oh, fun. In increasing order of complexity:
有趣哦。按复杂程度递增:
- <
- (a - b > 0)
- !(a >= b)
- !(a - b <= 0)
- !((a > b) || (a==b))
- !(a - b < 0) && !(a - b == 0)
- !((a - b < 0) || (a - b == 0)) && !(!(a < b))
- !(a - b < ((a * (1/a)-1) * (b * (1/b)-1))) && !(a - b == (a * (1/a)-1) * (b * (1/b)-1)))
- <
- (a - b > 0)
- !(a >= b)
- !(a - b <= 0)
- !((a > b) || (a==b))
- !(a - b < 0) && !(a - b == 0)
- !((a - b < 0) || (a - b == 0)) && !(!(a < b))
- !(a - b < ((a * (1/a)-1) * (b * (1/b)-1))) && !(a - b == (a * (1/a)-1 ) * (b * (1/b)-1)))
Personally, I would reserve #8 for someone who really annoyed me. ;)
就个人而言,我会为真正惹恼我的人保留#8。;)
回答by Lizard
The best way to write this is
最好的写法是
$x = 4;
$y = 6;
if($x < $y) echo "True";
// True
$x = 4;
$y = 6;
if(!($x >= $y)) echo "True";
// True
回答by Neil Williams
"not greater than or equal to" is equivalent to "strictly less than" which you write as <.
“不大于或等于”等同于“严格小于”,您将其写为<.
If you really wanted to say "not greater than or equal to" you could just write !(a >= b).
如果你真的想说“不大于或等于”,你可以只写!(a >= b).
回答by murgatroid99
<
(less than is the same as not greater than or equal to)
(小于等于不大于等于)
回答by John Rasch
Technically, you have asked two different questions - how to write A not greater than B or A equal to Band A not equal to B or A greater than B.
从技术上讲,您提出了两个不同的问题 - 如何编写A not greater than B or A equal to B和A not equal to B or A greater than B.
The statement A not greater than B or A equal to Bimplies:
该声明A not greater than B or A equal to B暗示:
!(A > B) || A == B
which is a tautology for:
这是一个重言式:
A <= B
And A not equal to B or A greater than Bimplies:
并A not equal to B or A greater than B暗示:
A != B || A > B
which is a tautology for:
这是一个重言式:
A >= B
The other answers of A < Bare representative of the statement A not greater than nor A equal to B.
的其他答案A < B代表声明A not greater than nor A equal to B。
回答by Trefex
simply use <?
简单地使用<?
回答by ninjalj
To prove the disbelievers that less than is different than not greater or equal:
向不信者证明小于不同于不大于或等于:
<?
$i = acos(4);
print $i."\n";
print is_nan($i)."\n";
if (4>=$i) {
print "ge\n";
} else {
print "nge\n";
}
if (4<$i) {
print "lt\n";
} else {
print "nlt\n";
}
?>
It outputs this on my system:
它在我的系统上输出:
$ php5 nan.php
NAN
1
ge
lt
回答by Luk
anot greater or equal to bis equivalent to b < a
a不大于或等于b等效于b < a
回答by Alin Razvan
Some simple example :
一些简单的例子:
<?php
#not lower than 5 AND not greater than 12
if(!($nr<5)&&!($nr>12)){ }
?>

