max() function is a properties of an array and is used to find the largest value from an array.
Example :
max.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Array</title>
</head>
<body>
<h1>To Find Largest Value From An Array</h1>
<?php
$array=array(2,3,5,4,8,10,150,1);
$a=max($array);
echo "Largest Value From An Array is :".$a."</br>";
?>
</body>
</html>
Note : To Find The Smallest Value From An Array we use min() function.
min() function is a properties of an array and is used to find the smallest value from an array.
Example :
<?php
$array=array(2,3,5,4,8,10,150,1);
$a=min($array);
echo "Smallest Value From An Array is :".$a."</br>";
?>
No comments:
Post a Comment