Anonymous and arrow functions

An anonymous function (closure) has no name and can be stored in a variable or passed as an argument; use makes it capture outer variables. An arrow function fn is a short form that automatically captures the variables of the parent context, read-only.

Example

$tva = 0.2;
$ttc = fn($ht) => $ht * (1 + $tva);

Related concepts

The whole glossary