【发布时间】:2012-12-24 07:19:40
【问题描述】:
我有两个基于条件运行的函数。 代码是这样的
$contact=($this->function() or $this->function1())
public function()
{
some codes
return contact;
}
public function1()
{
some codes
return contact;
}
它在 $contact 中返回 bool true 或 false。我想返回值。怎么办?
如果我这样给予
$contact=$this->function() or $this->function1()
如果 function() 为 false,它不会检查 function1()。
【问题讨论】:
-
那么应该返回哪个值呢?你想在
$contact中得到什么? -
或者像
||这样使用?和return $contact;? -
-1。提供具体代码,而不是无法编译的代码。