The max()
function in PHP returns the maximum value in an array or from a series of values.
The illustration below shows the visual representation of the max()
function.
max(value-1, value-2, value-3...value-n)
or
max(array)
The max()
function requires either an array
or a series of values
separated by commas.
This function returns the maximum value in an array or from a series of values.
<?php#series of valuesecho("max(1,5,3,7,0): ");echo (max(1,5,3,7,0));echo("\n");echo("max(1,-5,3,-7,0): ");echo (max(1,-5,3,-7,0));echo("\n");#arrayecho("max(array(-1,-5,-3,-7,0)): ");echo (max(array(-1,-5,-3,-7,0)));echo("\n");echo("max(array(-1,5,-3,7,0)): ");echo (max(array(-1,5,-3,7,0)));echo("\n");?>