Last Updated: February 25, 2016
·
1.031K
· antony492

Code For All PHP Developers

foreach ($problems as $problem) {
    $problemSolved = $this->solve($problem);
    if (!$problemSolved) {
        $this->execute(self::SHOOT);
    }
}

9 Responses
Add your response

foreach ($problems as $problem) {
    $this->solve($problem) || $this->execute(self::SHOOT);
}

To make the situation a little more worrying ;)

over 1 year ago ·

Do I die() after I shoot myself?

over 1 year ago ·

that should be placed inside a recursive function.
all problems shoud be solved

over 1 year ago ·

@narven Nope. Iteration into infinity.

over 1 year ago ·

lol

over 1 year ago ·

love this !

over 1 year ago ·
over 1 year ago ·

@mauris no, you will just exit; life and continue to cemetery :)

over 1 year ago ·

You forgot something!

foreach ($problems as $problem) {
    $problemSolved = $this->solve($problem);
    if (!$problemSolved) {
        $this->execute(self::SHOOT);
    }
    $problems[] = new Problem();
}
over 1 year ago ·