Heim >Backend-Entwicklung >PHP-Tutorial >or运算符应该如何使用

or运算符应该如何使用

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-06 20:23:461567Durchsuche

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

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

求解~谢谢

回复内容:

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

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

求解~谢谢

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

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

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn