0

我有这样的课:

class Example {

    private function _test($value)
    {
         if ($value == 'xyz') return FALSE;
    }

    public function check()
    {
        $this->_test('xyz');

        // more code follows here...
    }

}

基本上我想要做的是“冒泡”方法_test()的返回值FALSE作为方法check()的实际返回值,以便调用

$this->_test('xyz');

将返回 FALSE

return $this->_test('xyz');

行不通,因为如果值与“xyz”不匹配,我不想返回。

这有可能吗?

4

1 回答 1

5

我不明白 100% 你在找什么,所以如果这不是你的意思,请多解释一下你想要什么。

public function check()
{
    if($this->_test('xyz') === FALSE){
         return FALSE;
    }

    // more code follows here...
}
于 2012-11-29T17:20:41.510 回答