Is this achievable? If not, what are other ways in doing it best?
I'm trying to:
- Return true after a successful function call is made.
- Let the called function still execute even after return statement.
To make things clearer:
function foo() {
var $data; // a very large data
var $check = $this->bar($data); // gets true
if ($check) {
echo "FOO: Bar received my message!";
}
}
function bar($data) {
return true; // returns true, now foo doesn't care what bar will do
echo "BAR: returned true to foo, will now call foobar!";
// some code to process $data
$this->foobar(); // but hopefully still execute this line
}
function foobar() {
echo "FOOBAR: Hello, World!";
return;
}
Expected output: (asynchronously)
FOO: Bar received my message!
BAR: returned true to foo, will now call foobar!
FOOBAR: Hello, World!