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

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -