How to find the Maximum of Three Numbers in PHP - Step by Step Examples
How to find the Maximum of Three Numbers in PHP ?
Answer
To find the maximum of three numbers in PHP, you can use the `max` function.
✐ Examples
1 Find Maximum of Three Numbers
In this example,
- We assign three variables
$a,$b, and$cwith the numbers to compare. - We use the `max` function to compare
$aand$b, and then compare the result with$cto get the maximum.
PHP Program
<?php
$a = 5;
$b = 8;
$c = 3;
$max = max($a, $b, $c);
echo "Maximum of three numbers is: $max";
?>Output
Maximum of three numbers is: 8
Summary
In this tutorial, we learned How to find the Maximum of Three Numbers in PHP language with well detailed examples.