Added arrow function example and description

This commit is contained in:
SteamPixel 2021-02-08 10:54:37 +01:00
parent b3e284ea15
commit f245e21468

View File

@ -69,7 +69,7 @@ Route::add('/', function() {
## Use arrow functions ## Use arrow functions
Since PHP 7.4 you can also use arrow functions to output your content. So you can easily use variables from outside and you can write shorter code. Since PHP 7.4 you can also use arrow functions to output your content. So you can easily use variables from outside and you can write shorter code.
Please be aware that an Arrow function must always return a value. Therefore you cannot use `echo` here. Please be aware that an Arrow function must always return a value. Therefore you cannot use `echo` directly in here.
You can find an example in index.php. However, this is deactivated, as it only works from PHP 7.4. You can find an example in index.php. However, this is deactivated, as it only works from PHP 7.4.
```php ```php