检测某列中是不是存在某值,更好的办法吗

WBOY
Release: 2016-06-13 10:37:48
Original
946 people have browsed it

检测某列中是否存在某值,更好的办法吗?

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->array(0=> array(a=>0,b=>5,c=>5,d=>23),1=> array(a=>45,b=>5,c=>5,d=>23),2=> array(a=>21,b=>5,c=>5,d=>23),3=> array(a=>11,b=>5,c=>5,d=>23),);
Copy after login



检测是否其中某列的a 是否等于45并返回下标 这个只能遍历数组吗?

------解决方案--------------------
唔...这样吧

foreach($arr as $tmparr){
echo array_search(45, $tmparr);
}
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