Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

arrow function in PHP

<?php

$y = 1;
 
$fn1 = fn($x) => $x + $y;
// equivalent to using $y by value:
$fn2 = function ($x) use ($y) {
    return $x + $y;
};

var_export($fn1(3));
?>
Source by www.php.net #
 
PREVIOUS NEXT
Tagged: #arrow #function #PHP
ADD COMMENT
Topic
Name
5+6 =