Home > Backend Development > PHP Tutorial > elseif()条件判断,该怎么处理

elseif()条件判断,该怎么处理

WBOY
Release: 2016-06-13 12:08:15
Original
1362 people have browsed it

elseif()条件判断

本帖最后由 jaredlong 于 2014-10-09 13:49:28 编辑 用了一个if elseif else的语句。如下
if(条件){语句}
elseif(条件){语句}
elseif($strs[4]"小王" or $strs[4]"小李"  or $strs[4]"小张"  ){语句}
else

标红的那一段运行有问题,貌似判断不了。请问括号中的结构该怎么修改呢。目的是判断出$strs[4]这个变量既不等于小王,也不等于小李,也不等小张
------解决思路----------------------
or 改为 and
------解决思路----------------------
<br />elseif($strs[4]<>"小王" and $strs[4]<>"小李"  and $strs[4]<>"小张"  ){语句}<br />
Copy after login

------解决思路----------------------
elseif($strs[4] !== "小王" && $strs[4] !== "小李"  && $strs[4] !== "小张"  )
这样也可以
elseif($strs[4]  "小王" && $strs[4]  "小李"  && $strs[4]  "小张"  )
在运行这个elseif的时候你前面的条件需要都不成立,否则也不会运行,就算是对的,也不行
Related labels:
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