min()
Published Jun 7, 2023
Contribute to Docs
The min()
function returns the lowest value out of a group or array of values.
Syntax
// Find the minimum value of a group of values
$lowest = min($value1, $value2, $value3, ...);
// Find the minimum value of an array of values
$values = array($n1, $n2, $n3, ...);
$lowest = min($values);
- The values can be of any type. The
min()
function will use the standard comparison rules, so if a string value is compared to an integer, the string value is considered0
. - If multiple string values are added, then they will be compared alphanumerically. The returned value will not be converted and if two values are identical, the first in the order will be returned.
- If the parameter is an array, the lowest value of the array will be returned.
Codebyte Examples
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.