Max () returns the maximum value.
Grammar
Max (x, y) parameter description
X required. A number.
Y required. A number.
Description
Max () returns the value with the largest number in the parameter.
If there is only one parameter and an array, Max () returns the largest value in the array. If the first argument is an integer, a string, or a floating-point number, then at least two parameters are required and Max () returns the largest of these values. You can compare an unlimited number of values.
echo Max (1,3,5,6,7); Returns 7
echo "
";
echo Max (Array (2,4,5)); Returns 5
echo "
";
echo Max (0, ' hello '); Returns 0
echo "
";
echo Max (' Hello ', 0); return Hello
echo "
";
echo Max ( -1, ' hello '); return Hello
echo "
";
$val =max (Array (2,4,8), Array (2,5,7)); Returns a second array
Print_r ($val);
echo "
";
$val =max (' string ', Array (2,5,7), 42); Returns an array
Print_r ($val);
/*
MIN () returns the minimum value.
Grammar
Min (x, y) parameter description
X required. A number.
Y required. A number.
Description
MIN () returns the smallest value in the parameter.
If there is only one parameter and an array, min () returns the smallest value in the array. If the first argument is an integer, a string, or a floating-point number, then at least two parameters are required and min () returns the smallest of these values. Can compare infinitely multiple values
*/
Echo min (2,3,1,6,7); 1
echo "
";
echo min (Array (2,4,5)); 2
echo "
";
Echo min (0, ' hello '); 0
echo "
";
Echo min (' hello ', 0); Hello
echo "
";
Echo min (' Hello ',-1); -1
echo "
";
$val =min (Array (2,4,8), Array (2,5,1)); Returns the first array of
Print_r ($val);
echo "
";
$val =min (' string ', Array (2,5,7), 42); Returns a string
Print_r ($val);
http://www.bkjia.com/PHPjc/445383.html www.bkjia.com true http://www.bkjia.com/PHPjc/445383.html techarticle Max () returns the maximum value. The syntax max (x, y) parameter describes x required. A number. Y required. A number. Indicates that Max () returns the value that is the largest of the values in the parameter. If there is only one parameter and the ...