How to get minimum and maximum value from array

To get minimum value from array we used min()

$dollar = array('9.22', '5.32', '102.58');

echo min($dollar);
result : 5.32
echo min(2, 3, 1, 6, 7);
result : 1

echo min(array(2, 4, 5));
result : 2

 

To get maximum value from array we used max()

$dollar = array('9.22', '5.32', '102.58');

echo max($dollar);
result : 102.58
echo min(2, 3, 1, 6, 7);
result : 7

echo min(array(2, 4, 5));
result : 5

 

Was this post helpful?
Let us know if you liked the post. That’s the only way we can improve.
Yes0
No0
Harinder Singh

Harinder Singh

My name is Harinder Singh and I specialize in Software industry. I consider myself as a life learner. I love learning new concepts, embracing new ideas and reading and searching for innovation.