php - call function through function to search array -
my objective search multidimentional array plot , output information buried there.
my code is
function searchbyplot($plot, $array) { foreach ($array $key => $val) { if ($val['plot'] === $plot) { return $key; } } return null; } function calculate() { $id = searchbyplot('681', $ma); $code = $ma[$id]['code']; $last = $ma[$id]['h_last']; $plot = $ma[$id]['plot']; if (isset($last)){ echo 'id: '.$id.' code: '.$code.' lastname'.$last.''; } echo "test".$id.""; } calculate();
however when call calculate function there no response though there result in array.
when call searchbyplot function directly works fine.
$id = searchbyplot('681', $ma); echo $id;
however when call calculate function doesn't work @ all, nothing outputted on $id can see test call above.
echo $id;
can please?
many thanks, buster
Comments
Post a Comment