Re: array coalesce operator concept

From: Date: Wed, 12 Jul 2017 16:16:29 +0000
Subject: Re: array coalesce operator concept
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-99858@lists.php.net to get a copy of this message
PHP already exhibits the skipping behaviour (it only emits a warning for the wrong type used in foreach, skips the loop, and then continues with remaining code).
Yes, a warning is not an error. If someone dont care about warnings from error prone code, set the error_reporting accordingly to hide the messages. With the following code you do not even get a warning about a undefined variable. foreach($foobar ?? [] as $value) {
    var_dump($value);
}

« previous php.internals (#99858) next »