If an array initialized as:
$arr = array(array(141,151,161),2,3,array(101,102,array(303,404,606,555,789,array(1000,22,9999,array(9057,100000),522))));
Then the result should be: 100000
I have written a function to solve this problem but I need less bytes and less memory of codes.
My Function is:
function MaxArray($arr){
$length = count($arr);
global $maxValue;
for($i=0;$i<$length;$i++){
if(is_int($arr[$i])){
if($maxValue < $arr[$i]){
$maxValue = $arr[$i];
}
}
elseif(is_array($arr[$i])){
MaxArray($arr[$i]);
}
}
return $maxValue;
}
Taken from PHP manual but authored by me: