Arrow Functions
$array = [1, 2, 3, 4];
$multiplier = 2; // Array functions can access global scope
array_map(fn($n) => $multiplier * $n, $array);New line to br
\n →
echo nl2br($text);Match
$status = 0;
echo match($status)
{
0 => "success",
1 => "fail",
2, 3 => "denied",
default => "error"
} // successClosure on anonymous functions
$x = 1;
$func = function() use ($x)
{
echo $x;
$x++;
echo $x;
}
$func(); // 1, 2
echo $x; // 1