The function assumes that there are at least two elements in array . The function returns a negative value if the array is sorted in decreasing order and returns 0 if elements are equal
< ? php function maxDiff ( $ arr , $ n ) {