Can the call continue as a return, or can it be invoked?

In my loop, I have a callback that returns true or false.
Depending on the result, I have to continue or break my loop.

Now I want this step to be easier if possible. I'll return 'continue' or 'break' in my callback and it would be nice to say something like:

call($return) // $return => 'continue' or 'break'

      

Is it possible?

EDIT
In short form:

$return = $this->myCallback(...);
if ($return) { break; }
if (!$return) { continue; }

      

Instead, I want something like this:

$return = $this->myCallback(...);
call($return); // return contains 'continue' or 'break'

      

+3


source to share


2 answers


no ... you can return Boolean from the function and check if you want to split or continue.



0


source


instead

$return = $this->myCallback(...);
if ($return) { break; }
if (!$return) { continue; }

      

records



if($this->myCallback()) break;
else continue;     // if yo are really need this continue

      

Why not?

0


source







All Articles