Reputation: 1246
I have a class like this:
class Example {
private function _test($value)
{
if ($value == 'xyz') return FALSE;
}
public function check()
{
$this->_test('xyz');
// more code follows here...
}
}
Basically what I want to do is "bubble up" the return value FALSE from the method _test() as the actual return value of the method check(), so that calling
$this->_test('xyz');
will return FALSE
return $this->_test('xyz');
wouldn't work because I don't want to return if the value doesn't match 'xyz'.
Is that possible at all?
Upvotes: 0
Views: 62
Reputation: 27638
I don't understand 100% what you're looking for, so if this isn't what you mean please explain a little more what you want.
public function check()
{
if($this->_test('xyz') === FALSE){
return FALSE;
}
// more code follows here...
}
Upvotes: 5