max value from a nested array
Posted: Mon Sep 06, 2010 4:32 am
Hello All,
I have defined a function, can someone tell me if this is correct?
This works perfect.. but I dont know if I can use global variable now.
Thanks,
I have defined a function, can someone tell me if this is correct?
Code: Select all
function Max_value($arr)
{
global $new;
foreach($arr as $value)
{
if(is_array($value))
{
Max_value($value);
}
else
{
$new[] = $value;
}
}
return max($new);
}
Thanks,