I am trying to understand how the null coalescing operator does really work. So, I tested many examples after reading the documentation in php.net and some posts on stackoverflow.
However, I can't understand this code:
<?php
$x = false ?? 'stackoverflow';
var_dump($x); // bool(false)
since it's equivalent to (from php.net#null-coalescing)
isset(false) ? false : 'stackoverflow';
and since isset(false) generates a fatal error.
Could, please, someone explain to me?
isset. If that's not what you're doing, this isn't the operator you need. The docs could possibly be worded a little better, in fairness.