Bladephp: Now with 8+ codeigniter, php, and laravel project 8+ php project From $37/Month From Rs. 2499/Month

How to find minimum value of an array using PHP

by
Category:php
php
How to find minimum value of an array using PHP

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 and How to find maximum 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;
?>

0 Comments


Html code work in comment box


Related Post