From 072b8f71aac51863e440bc483c9a299465442ebc Mon Sep 17 00:00:00 2001 From: Philip Olson Date: Sat, 19 Jul 2003 01:03:46 +0000 Subject: [PATCH] A complete rewrite of min() and max() docs to reflect how they really work, including many examples. See also count(). This also closes bug #22565 git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@135408 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/math/functions/max.xml | 56 +++++++++++++++++++----- reference/math/functions/min.xml | 73 ++++++++++++++++---------------- 2 files changed, 81 insertions(+), 48 deletions(-) diff --git a/reference/math/functions/max.xml b/reference/math/functions/max.xml index 9df92c131e..9c4960ae6e 100644 --- a/reference/math/functions/max.xml +++ b/reference/math/functions/max.xml @@ -1,5 +1,5 @@ - + @@ -9,30 +9,64 @@ Description - numbermax - mixedarg1 - mixedarg2 - mixedargn + mixedmax + numberarg1 + numberarg2 + number... + + + mixedmax + arraynumbers + array... max returns the numerically highest of the parameter values. - If the first parameter is an array, max + If the first and only parameter is an array, max returns the highest value in that array. If the first parameter is an integer, string or float, you need at least two parameters and max returns the biggest of these values. You can compare an unlimited number of values. + + + PHP will evaluate a non-numeric string as + 0, but still return the string if it's seen as the + numerically highest value. If multiple arguments evaluate to + 0, max will use the first one + it sees (the leftmost value). + + - If one or more of the values is a float, all the values will be - treated as floats, and a float is returned. If none of the - values is a float, all of them will be treated as integers, and - an integer is returned. + + Example uses of <function>max</function> + + +]]> + + - See also min. + See also min and + count. diff --git a/reference/math/functions/min.xml b/reference/math/functions/min.xml index cbac548e78..17852fa143 100644 --- a/reference/math/functions/min.xml +++ b/reference/math/functions/min.xml @@ -1,5 +1,5 @@ - + @@ -9,65 +9,64 @@ Description - numbermin + mixedmin numberarg1 numberarg2 - ... + number... - numbermin + mixedmin arraynumbers + array... min returns the numerically lowest of the parameter values. - In the first variant, you need at least two parameters - and min returns the lowest of these values. - You can compare an unlimited number of values. If one of the - variables is undefined, min will fail. + If the first and only parameter is an array, min + returns the lowest value in that array. If the first parameter + is an integer, string or float, you need at least two parameters + and min returns the smallest of these values. + You can compare an unlimited number of values. + + + PHP will evaluate a non-numeric string as + 0, but still return the string if it's seen as the + numerically lowest value. If multiple arguments evaluate to + 0, min will use the first one + it sees (the leftmost value). + + - In the second variant, min - returns the lowest value in numbers. - - - If one or more of the values is a float, all the values - will be - treated as floats, and a float is returned. If none of the - values is a float, all of them will be treated as integers, - and an integer is returned. Upon failure, min - returns NULL and an error of level E_WARNING - is generated. - - - - + + Example uses of <function>min</function> + ]]> - + - See also max. + See also max and + count.