any visible problems here??.....
Yes. Your original example is about finding the largest difference between any two adjacent elements. The new code you posted is about finding the largest difference between any two elements.
If you want to find the largest adjacent difference between two elements, then you could try:
function maxAdjacentDifference($array)
{
$temp = $array;
array_pop($array);
array_shift($temp);
return max(array_map(create_function('$a,$b', 'return $b-$a;'), $array, $temp));
}
If you really want to find the largest difference between any two elements, then you only need a one-liner:
function maxDifference($array)
{
return max($array) - min($array);
}