PHP » Arrays » max()

Syntax:
mixed max(array array)
mixed max(mixed no1, mixed no2 [, mixed no3, ...])
array
Array to be searched.
no1
Scalar to be searched.
no2
Scalar to be searched.
no3
Scalar to be searched.

Returns the maximum value.

max() returns the element with the highest numerical value in an array. Non-numerical strings count as 0. The parameters passed to the function can be either an array or at least two scalars.

Examples

Code:
<?php

print max(array("1500", 34.3, 4)) . " ";
print max("hello world", 33, 2.3);

?>
Output:
1500 33
Explanation:

This example demonstrates the use of array and scalar parameters, and the evaluation of strings.

See Also: