Home > Backend Development > PHP Problem > How to use php max function

How to use php max function

藏色散人
Release: 2023-03-09 15:24:01
Original
2556 people have browsed it

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.

How to use php max function

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,...);
Copy after login

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)));
?>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template