fn packs everything it uses
An arrow function uses an outside variable without any use clause.
<?php$rate = 2;$double = fn (int $x) => $x * $rate;$rate = 3;echo $double(5), PHP_EOL;$bump = fn () => ++$rate;echo $bump(), PHP_EOL;echo $rate, PHP_EOL;1. Predict the output
Tap the lines in the order you think they print.
- 1…
- 2…
- 3…