bagfda
Last Updated: February 25, 2016
·
791
· antony492

Code For All PHP Developers

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

9 Responses
Add your response

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

To make the situation a little more worrying ;)

over 1 year ago ·
1195

Do I die() after I shoot myself?

over 1 year ago ·
1202

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

over 1 year ago ·
1254

@narven Nope. Iteration into infinity.

over 1 year ago ·
1256

lol

over 1 year ago ·
1389

love this !

over 1 year ago ·
1500
over 1 year ago ·
2343

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

over 1 year ago ·
3316

You forgot something!

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