Find highest value with the max() function:
<?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)));
?>
Try it Yourself »
The max() function returns the highest value in an array, or the highest value of several specified values.
max(
array_values);
or
max(
value1,value2,...);
Parameter | Description |
---|---|
array_values | Required. Specifies an array containing the values |
value1,value2,... | Required. Specifies the values to compare (must be at least two values) |
Return Value: | The numerically highest value |
---|---|
Return Type: | Mixed |
PHP Version: | 4+ |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!