Type Juggler · Level 7 of 7

?? or ?:

Two ways to pick a fallback value, tried on 0, an empty string and a missing value.

<?php$qty = 0;$name = '';echo 'qty ?? 5: ' . ($qty ?? 5) . PHP_EOL;echo 'qty ?: 5: ' . ($qty ?: 5) . PHP_EOL;echo 'name: ' . ($name ?: 'guest') . PHP_EOL;echo 'user: ' . ($user['name'] ?? 'guest') . PHP_EOL;

1. Predict the output

Tap the lines in the order you think they print.

  1. 1…
  2. 2…
  3. 3…
  4. 4…