PHP max() function with example

 16 - Mar - 2022
 XpertPhp
 40

In this article, We will explain to you PHP max() function with example.

PHP max() function

The max() function is a built-in function of PHP. which is used to returns the number with the highest value of two specified numbers. so you can see our PHP math Function example.

Syntax

max(array_values);
or
max(value1,value2,...);

Example

<?PHP
echo max(20,10,30,40);
echo "
";
echo max(array(20,10,30,40));
?>

Output

40
40

Reference: PHP max() function