Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 1557

php-manual-en-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>min</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Mathematical Functions"
HREF="ref.math.html"><LINK
REL="PREVIOUS"
TITLE="max"
HREF="function.max.html"><LINK
REL="NEXT"
TITLE="mt_getrandmax"
HREF="function.mt-getrandmax.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.max.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.mt-getrandmax.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.min"
></A
>min</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN44965"
></A
><P
>    (PHP 3, PHP 4 )</P
>min&nbsp;--&nbsp;Find lowest value</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN44968"
></A
><H2
>Description</H2
>number <B
CLASS="methodname"
>min</B
> ( number arg1, number arg2 [, ...])<BR
></BR
>number <B
CLASS="methodname"
>min</B
> ( array numbers)<BR
></BR
><P
>&#13;     <B
CLASS="function"
>min()</B
> returns the numerically lowest of the
     parameter values.
    </P
><P
>&#13;     In the first variant, you need at least two parameters
     and <B
CLASS="function"
>min()</B
> returns the lowest of these values.
     You can compare an unlimited number of values.  If one of the 
     variables is undefined, <B
CLASS="function"
>min()</B
> will fail.
    </P
><P
>&#13;     In the second variant, <B
CLASS="function"
>min()</B
>
     returns the lowest value in <TT
CLASS="parameter"
><I
>numbers</I
></TT
>.  
    </P
><P
>&#13;     If one or more of the values is a <A
HREF="language.types.float.html"
><B
CLASS="type"
>float</B
></A
>, 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 <A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
>s, 
     and an integer is returned.  Upon failure, <B
CLASS="function"
>min()</B
> 
     returns NULL and an error of level <TT
CLASS="constant"
><B
>E_WARNING</B
></TT
>
     is generated.
    </P
><P
>&#13;     <DIV
CLASS="informalexample"
><A
NAME="AEN45002"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="programlisting"
>&#60;?php
$a = 4; 
$b = 9; 
$c = 3;
$arr = array(99, 34, 11);

// You may want to implement your own error checking in 
// case of failure (a variable may not be set)
if (!$min_value = @min($a, $b, $c)) {
    echo "Could not get min value, please try again.";
} else {
    echo "min value is $min_value";
}

print min($arr);  // 11

?&#62;</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
    </P
><P
>&#13;     See also <A
HREF="function.max.html"
><B
CLASS="function"
>max()</B
></A
>.
    </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.max.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.mt-getrandmax.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>max</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.math.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>mt_getrandmax</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>