PHP function of the day: min()

For day 9 of 21 in the “PHP Function of the day” series, I’m going to look at min(). This function takes values and returns the smallest value from what you provided.

Let’s take a look.

<?php

echo(min(-1,0,1,2,3).'<br />’);

echo(min(array(-1,0,1,2,3)).'<br />’);

echo(min(array(‘a’,’b’,’c’,’d’)));

?>

 

See the output

 

As you can see, this is a lot like the max() function that we covered on day 3.

Leave a Reply

Your email address will not be published. Required fields are marked *