-1

While I was looking over symfony's public/index.php I came across the following snippet of code:

$env = $_SERVER['APP_ENV'] ?? 'dev';
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env));

Therefore I performed the following searches:

But still I cannot figure out what the operator ?? actually means. Can you provide me info regarding this operator/syntax ?

conradkleinespel
  • 6,560
  • 10
  • 51
  • 87
Dimitrios Desyllas
  • 9,082
  • 15
  • 74
  • 164
  • 3
    it's a PHP 7+ exclusive ternary operator (aka: Null Coalescing Operator) http://php.net/manual/en/language.operators.comparison.php – Funk Forty Niner Jul 15 '18 at 13:09

1 Answers1

5

it's shortest version of

$env = isset($_SERVER['APP_ENV']) ? $_SERVER['APP_ENV'] : 'dev';

was added in PHP 7

MrSmile
  • 1,217
  • 2
  • 12
  • 20