Search w3schools.com:

SHARE THIS PAGE

PHP min() Function


PHP Math Reference Complete PHP Math Reference

Definition and Usage

The min() function returns the number with the lowest value of two specified numbers.

Syntax

min(x,y)

Parameter Description
x Required. A number
y Required. A number


Example

In this example we will show how to use min() to return the number with the lowest value of two specified numbers:

<?php
echo(min(5,7) . "<br />");
echo(min(-3,5) . "<br />");
echo(min(-3,-5) . "<br />");
echo(min(7.25,7.30))
?>

The output of the code above will be:

5
-3
-5
7.25


PHP Math Reference Complete PHP Math Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]