PHP max() 函数

PHP 教程 · 2019-01-27 06:57:06

实例

通过 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)));
?>

定义和用法

max() 函数返回一个数组中的最大值,或者几个指定值中的最大值。

语法

max(array_values);ormax(value1,value2,...);

参数 描述
array_values 必需。规定一个包含值的数组。
value1,value2,... 必需。规定要比较的值(至少两个值)。

技术细节

返回值: 数值最大值。
返回类型: Mixed
PHP 版本: 4+

点击查看所有 PHP 教程 文章: https://www.codercto.com/courses/l/5.html

查看所有标签

Algorithms and Data Structures

Algorithms and Data Structures

Kurt Mehlhorn、Peter Sanders / Springer / 2008-08-06 / USD 49.95

Algorithms are at the heart of every nontrivial computer application, and algorithmics is a modern and active area of computer science. Every computer scientist and every professional programmer shoul......一起来看看 《Algorithms and Data Structures》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具