How to use outside variable with anonymous function in PHP

1 Answer

0 votes
$b = 13;
$afunction = function($number) use ($b) {
    return $number * $b;
};

echo $afunction(736316); 
  
/*
run: 
 
9572108
   
*/

 



answered Sep 16, 2017 by avibootz

Related questions

...