php min() function


  Translation results:

abbr.minute minute;minuto (Portuguese or Spanish=minute) (Portuguese or Spanish) minute;minority minority;miniature small

php min() functionsyntax

Function:Find the minimum number from all parameters

Syntax: min(X,Y,Z) or min(array(X,Y,Z ))

Parameters: There is at least one parameter in the min function, it can be multiple parameters, or it can be an array.

Note: If there is only one parameter and it is an array, the minimum value in the array will be returned. If the first parameter is an integer, a string or a floating point number, at least two are required. Parameters, min will return the smallest of these values, and the parameters can be unlimited values.

php min() functionexample

<?php
$i = 2;
$j = 9;
$k = 5;
$h = min($i,$j,$k);
echo "最小值是".$h;
?>

Run instance»

Click the "Run instance" button to view the online instance

Output:

最小值是2
<?php
//获取数组中最小值的元素
$arr = array(9,5,8,6,3,7,4,2);
print_r(min($arr));
?>

Run Instance»

Click the "Run Instance" button to view the online instance

Output:

2

Home

Videos

Q&A