This is a collection of questions that come up every now and then about syntax in PHP. This is also a Community Wiki, so everyone is invited to participate in maintaining this list.
It used to be hard to find questions about operators and other syntax tokens.¹
The main idea is to have links to existing questions on Stack Overflow, so it's easier for us to reference them, not to copy over content from …
在PHP中检查不相等(没有检查类型),你可以这样做:
if( A != B ) {
DO SOMETHING;
}
Run Code Online (Sandbox Code Playgroud)
但你也可以这样做,结果相同:
if( A <> B ) {
DO SOMETHING;
}
Run Code Online (Sandbox Code Playgroud)
有什么区别吗?
使用!=过度<>是以任何方式,形状或形式改变评估?
以下代码有什么作用?PHP手册中某些内容的链接也很不错.
if ($_SERVER['SERVER_PORT'] <> 443) {
doSomething();
}
Run Code Online (Sandbox Code Playgroud)