I have following codes:
$data = [
['foo' => 1, 'bar' => 3],
['foo' => 2, 'bar' => 4]
];
function go($coming_data, $run) {
foreach($coming_data as $item) {
return $run;
}
}
echo go($data, $item['bar']);
and, i need get 34 output, i should use this structure because this codes running my custom table creator bla bla, so i should like as $item['bar'] variables as function parameter but this is not recognized in foreach loop on function.
so, all I need is to be able to define the $item variable in the function like use eval recursive
How can i do in this situation ? Thanks for your helps.