Games PHP Scope Rooms

Scope Rooms · Level 1 of 7

A fresh room

A function reads a variable made outside it, then makes its own with the same name.

<?php$greeting = 'hi';function say(): void{    echo $greeting ?? 'no greeting here', PHP_EOL;    $greeting = 'hello';    echo $greeting, PHP_EOL;}say();echo $greeting, PHP_EOL;

1. Predict the output

Tap the lines in the order you think they print.

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