I can't use variable $data
in Anonymous functions:
$data = array(...);
Excel::create('Filename',function($excel){
foreach($data as $v){
//...
}
});
I get error: "Undefined variable: $data"
Also:
$data = array(...);
Excel::create('Filename',function($excel){
global $data;
foreach($data as $v){
//...
}
});
I get error "Invalid argument supplied for foreach()"
How I can use $data
in Anonymous function?