I was diving into Symfony framework (version 4) code and found this peace of code:
$env = $_SERVER['APP_ENV'] ?? 'dev';
I'm not pretty sure what this actually does but I imagine that it expands to something like:
$env = $_SERVER['APP_ENV'] != null ? $_SERVER['APP_ENV'] : 'dev';
Or maybe:
$env = isset($_SERVER['APP_ENV']) ? $_SERVER['APP_ENV'] : 'dev';
Someone has any precision about the subject?
EDIT:
To all the people who answered the question: thank you
To all the people who marked my question as negative because there's already a similar question (PHP ternary operator vs null coalescing operator):
It is true that both questions are very similar. However it is hard for everybody to imagine that the "??" is called the coalescing operator.
Otherwise I could easy find it on the official documentation:
However, for someone who didn't know that this feature was added in php 7 it's more likely to type:
"php ?? operator" or "php double question mark operator"
And here is why my question has an added value.
I ask you to, please, reconsider your negative feedback.
Thanks
Regards,
Epixilog