How to find minimum value of an array using PHP

0

First create an array with some numeric value. Now create a temporary variable $temp in which stored array’s first index’s value i.e 100 and follow below example. You may also like How to find minimum value in array using JavaScript.

Example

$arr=array(100,11,12,0,13,10,15);
$temp=$arr[0];
foreach($arr as $x)
{
	if($x<$temp)
	{
		$temp=$x;
	}
}
echo "Minimum value of array = ".$temp;
?>