PHP max() - Math Functions

What is max Function?

Explanation

The "max()" function returns the highest value among the two numbers given.

Syntax:


max(x,y)

In the above syntax "x", "y" are the numbers to be compared to find the highest value.

Example :


<?php
echo(max(4,8) . "<br />");
echo(max(-4,7) . "<br />");
echo(max(-2,-6) . "<br />");
echo(max(8.34,8.40));
?>
Result :

8
7
-2
8.4

In the above example the highest values among the numbers are displayed.

PHP Topics


Ask Questions

Ask Question