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://codercto.com/courses/l/5.html

查看所有标签

The Art of Computer Programming, Volume 2

The Art of Computer Programming, Volume 2

Knuth, Donald E. / Addison-Wesley Professional / 1997-11-04 / USD 79.99

Finally, after a wait of more than thirty-five years, the first part of Volume 4 is at last ready for publication. Check out the boxed set that brings together Volumes 1 - 4A in one elegant case, and ......一起来看看 《The Art of Computer Programming, Volume 2》 这本书的介绍吧!

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

在线压缩/解压 JS 代码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具