Find Minimum value of an array - phptpoint

Find Minimum value of an array

PHP Summer Training/Internship with 2 Live Projects in Noida Fee is only 5500/-Click here to Book Your Seat


How to find minimum value of an array.



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.

Now to display/fetch array’s all value from start to end used foreach loop. Inside foreach create a temporary variable $x which holds array values.

Now add a condition in body of foreach to check $x is less than $temp then assign $x value to $temp variable this process will contiue till end of array.
after completion of foreach loop $temp variable has minimum value from array $arr.

Now print mininum value.

Latest Trending Technologies