English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

max() function in PHP

Themax()The function returns the maximum value of the array.

Syntax

max(arr_values);
or
max(val1,val2,...);

parameter

  • arr_values-is an array with values.

  • val1,val2-the values to be compared.

returns

Themax()The function returns the maximum value of the array.

Example

<?php
   echo (max(70, 89, 12, 34, 23, 66, 34));
?>

Output Result

89

Example

Let's look at another example-

<?php
   echo (max(array(70, 89, 12, 34, 23, 66, 34);
?>

Output Result

89