PHP max() & min()


max(x,y,...) function returns the maximum of all comparable numbers.

<?PHP
	echo max(2,4);  //4
	echo max(2,4,13); //13
?>

min(x,y) function returns the minimum of two numbers.
<?PHP
	echo min(2,4);  //2
	echo min(2,4,13); //2
?>

Both functions support array as parameter.
<?PHP
	$arr=array(3, 10, -43, -3.5, 333, 98);
	echo max($arr);  //333
	echo min($arr);  //-43
	echo max($arr,2000); //2000
?>

Both functions also support date comparisons.
<?PHP
	echo max("2000-04-02","2005-09-08");  //2005-09-08
	echo min("2000-04-02","2005-09-08");  //2000-04-02
?>