For day 3 of 21 in the “PHP Function of the day” series, I’m going to look at max(). This function takes values and returns the highest value from what you provided. Let’s take a look.
<?php
echo(max(-1,0,1,2,3).'<br />’);
echo(max(array(-1,0,1,2,3)).'<br />’);
echo(max(array(‘a’,’b’,’c’,’d’)));
?>
You can provide a comma-delimited list or an array. You can provide a number or a letter. I wouldn’t recommend mixing variable types (like asking for the for the max of 1, ‘Bob’, and 97) but beyond that, max should be able to handle whatever you want.