min()
` and `max()
` functions, respectively. Here's an example:<?php
$values = array(3, 7, 1, 9, 2);
$lowest = min($values);
$highest = max($values);
echo "The lowest value is: $lowest\n";
echo "The highest value is: $highest\n";
?>
The lowest value is: 1
The highest value is: 9
$values
` is defined with a list of values. The `min()
` function is called with `$values
` as an argument to find the lowest value in the array, and the `max()
` function is called with `$values
` as an argument to find the highest value in the array.$lowest
` and `$highest
` are then output using `echo
`.min()
` and `max()
` functions can also be called with multiple arguments instead of an array, like this :<?php
$lowest = min(3, 7, 1, 9, 2);
$highest = max(3, 7, 1, 9, 2);
echo "The lowest value is: $lowest\n";
echo "The highest value is: $highest\n";
?>
The lowest value is: 1
The highest value is: 9