Home>Article>Backend Development> How to use php min function?

How to use php min function?

藏色散人
藏色散人 Original
2019-05-29 11:40:14 3296browse

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?

#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!

php
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn