How to find the Minimum of Two Numbers in PHP - Step by Step Examples
How to find the Minimum of Two Numbers in PHP ?
Answer
To find the minimum of two numbers in PHP, you can use the min function.
✐ Examples
1 Minimum of Two Numbers
In this example,
- We declare two variables
$aand$band assign values to them. - We use the
minfunction to find the minimum of$aand$b. - We echo the minimum value.
PHP Program
<?php
// Minimum of Two Numbers
$a = 10;
$b = 15;
$min = min($a, $b);
echo "Minimum of $a and $b is: $min";
?>Output
Minimum of 10 and 15 is: 10
Summary
In this tutorial, we learned How to find the Minimum of Two Numbers in PHP language with well detailed examples.