lin*_*982 2 php conditional if-statement
很难要求搜索这个问题,答案有助于清理我的代码.基本上,在PHP中,如果我使用:
if (this = that)
Run Code Online (Sandbox Code Playgroud)
到底是怎么回事?是检查变量是否正确分配,还是检查"那个"的真实性,另外还将它分配给"这个"?
我问,因为如果答案是前者会更容易,因为它需要额外的一行来分配它,然后运行条件,然后再使用它的返回.我知道抓住一条线是微不足道的,但是在整个脚本上它可以加起来.谢谢你的帮助.
澄清:我想基本上写下以下内容:
$this = something;
if ($this)
do things with $this
Run Code Online (Sandbox Code Playgroud)
把它写成
if ($this = $myFunctionCall)
do things with $this;
Run Code Online (Sandbox Code Playgroud)
假设$ this未事先设定.