Home > Article > Backend Development > How to use php max function
The method of using the php max function is: first create a PHP sample file; then directly use the max function syntax statement such as "echo(max(2,4,6,8,10));" to find a The maximum value in the group data is enough.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
max() function returns the maximum value in an array , or the maximum value among several specified values.
Syntax
max(array_values); or max(value1,value2,...);
Parameters
array_values Required. Specifies an array containing values.
value1,value2,... Required. Specifies the values to be compared (at least two values).
Example:
通过 max() 函数查找最大值: <?php echo(max(2,4,6,8,10) . "<br>"); echo(max(22,14,68,18,15) . "<br>"); echo(max(array(4,6,8,10)) . "<br>"); echo(max(array(44,16,81,12))); ?>
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to use php max function. For more information, please follow other related articles on the PHP Chinese website!