Home>Article>Backend Development> How to use php min function?
php The min function is used to return the minimum value in an array, or the minimum value among several specified values. Its syntax is min(array_values). The parameter array_values is required and refers to specifying an array containing values.
#How to use php min function?
Definition and usage
min() function returns the minimum value in an array, or the minimum value among several specified values.
Syntax
min(array_values); or min(value1,value2,...);
Parameters
array_values Required. Specifies an array containing values.
value1,value2,... Required. Specifies the values to be compared (at least two values).
Return value: Minimum numerical value.
Return type: Mixed
PHP version: 4
Example
Find the minimum value through the min() function:
"); echo(min(22,14,68,18,15) . "
"); echo(min(array(4,6,8,10)) . "
"); echo(min(array(44,16,81,12))); ?>
Output:
2 14 4 12
The above is the detailed content of How to use php min function?. For more information, please follow other related articles on the PHP Chinese website!