Difference between “!==” and “==!”

2012-09-08   来源:站长日记       编辑:沧海桑田   类别:PHP 教程    转载到:    发表评论

I stumbled over this when I modified PHP code written by someone else.
I was baffled that a simple comparison (if ($var ==! " ")) didn't work as expected.
After some testing I realized that whoever wrote that code used ==! instead of !== as comparison operator.
I've never seen ==! in any language so I wondered how the hell this code could even work and did some testing:

JUST SMILE  :>

true !==  false: bool(true)
true !==  true: bool(false)
true ==!  false: bool(true)
true ==!  true: bool(false)
true === false: bool(false)
true === true: bool(true)

DO YOU SEE ?
The operator seems to work for boolean and integer variables, but not for strings.
I can't find ==! in the PHP documentation or anything about it on any search engine
(tried Google, Bing, DuckDuckGo, but I suspect they try to interpret it instead of searching for the literal string).
Has anybody seen this before and can shed any light on this behavior?

HOHO

0

0
0|0 | 鲜花 VS 砸蛋 | 45阅读 0评论