Code:
$myArray = array(48, 9, 52, 183);
I have $myArray like the above.

I like to find the smallest value in the Array.

So I made the code below.


Code:
code

if ( $myArray[0] < $myArray[1] ) {
$smallest_between01=$myArray[0];
} else {
$smallest_between01=$myArray[1];
} 


if ( $myArray[2] < $myArray[3] ) {
$smallest_between23=$myArray[2];
} else {
$smallest_between23=$myArray[3];
} 



if ( $smallest_between01 < $smallest_between23 ) {
$smallest=$smallest_between01;
} else {
$smallest=$smallest_between23;
} 

echo $smallest;


result

9
I now found the smallest value "9" which I wanted.

I guess there might be more fine code for finding the smallest value in the Array.

Do you have any?

( I am a beginner at Array.)