Home > Backend Development > PHP Tutorial > or运算符应该如何使用

or运算符应该如何使用

WBOY
Release: 2016-06-06 20:23:46
Original
1550 people have browsed it

这段代码不知道为什么是错的:

<code>    if($lonpos!='E'or $lonpos!='W'){
        echo 'Wrong Lonpos<br>';
    }</code>
Copy after login
Copy after login

求解~谢谢

回复内容:

这段代码不知道为什么是错的:

<code>    if($lonpos!='E'or $lonpos!='W'){
        echo 'Wrong Lonpos<br>';
    }</code>
Copy after login
Copy after login

求解~谢谢

虽然不知道你指的「错」是什么,不过这个 if 确实不太对。

毕竟 $lonpos != 'E'$lonpos != 'W' 至少有一个成立。所以 $lonpos!='E'or $lonpos!='W' 永远为真。

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template