How to query the maximum value in an array in php

青灯夜游
Release: 2023-03-10 22:10:01
Original
5274 people have browsed it

In PHP, you can use the max() function to query the maximum value in an array. This function can obtain the maximum value in an array and return it; the syntax format is "max(array)", and the parameter array is used to specify an Array containing values.

How to query the maximum value in an array in php

The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

In php, you can use max () function queries the maximum value in an array.

max() function returns the maximum value in an array.

Syntax:

max(array);
Copy after login

array: Specifies an array containing values.

Example:

<?php
$a=array(&#39;1&#39;,&#39;3&#39;,&#39;55&#39;,&#39;99&#39;);
echo max($a);
?>
Copy after login

Output:

99
Copy after login

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to query the maximum value in an array in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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