PHP中可以这样写if语句吗?还是小弟我想多了

WBOY
Release: 2016-06-13 12:44:10
Original
936 people have browsed it

PHP中可以这样写if语句吗?还是我想多了

public function getAreaList($pid = -1) {<br />
		$map = array();<br />
		$pid != -1 && $map['pid'] = $pid;<br />
		return $this->where($map)->order('`area_id` ASC')->findAll();<br />
	}
Copy after login


$pid != -1 && $map['pid'] = $pid;
return $this->where($map)->order('`area_id` ASC')->findAll();
这两句没条件关系吧?上面的一句为什么要用&&连接呢?与直接写
$pid != -1;
$map['pid'] = $pid;
的区别是什么呢?

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