-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
  • 5,835
  • 9
  • 42
  • 81
Dimitrios Desyllas
  • 7,732
  • 8
  • 58
  • 129
  • 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,146
  • 1
  • 10
  • 20