PHP 4, PHP 5, PHP 7, PHP 8
max - Find highest value

max( mixed$value, ... mixed$values ): mixed

Alternative signature (not supported with named arguments):

mixedmax arrayvalue_array



Any comparable value.


Any comparable values.


An array containing the values.

Return Values

max returns the parameter value considered "highest" according to standard comparisons. If multiple values of different types evaluate as equal (e.g. 0 and 'abc') the first provided to the function will be returned.

If an empty array is passed, then false will be returned and an E_WARNING error will be emitted.

Related Functions

Example of max

Show all examples for max

PHP Version:

Function max:

Mathematical Functions Functions

Most used PHP functions