<?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/math.xml, last change in rev 1.2 --> <refentry id="function.min"> <refnamediv> <refname>min</refname> <refpurpose>Find lowest value</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>number</type><methodname>min</methodname> <methodparam><type>number</type><parameter>arg1</parameter></methodparam> <methodparam><type>number</type><parameter>arg2</parameter></methodparam> <methodparam choice="opt"><parameter>...</parameter></methodparam> </methodsynopsis> <methodsynopsis> <type>number</type><methodname>min</methodname> <methodparam><type>array</type><parameter>numbers</parameter></methodparam> </methodsynopsis> <para> <function>min</function> returns the numerically lowest of the parameter values. </para> <para> In the first variant, you need at least two parameters and <function>min</function> returns the lowest of these values. You can compare an unlimited number of values. If one of the variables is undefined, <function>min</function> will fail. </para> <para> In the second variant, <function>min</function> returns the lowest value in <parameter>numbers</parameter>. </para> <para> If one or more of the values is a <type>float</type>, 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 <type>integer</type>s, and an integer is returned. Upon failure, <function>min</function> returns <type>NULL</type> and an error of level <constant>E_WARNING</constant> is generated. </para> <para> <informalexample> <programlisting> <![CDATA[ <?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 ?> ]]> </programlisting> </informalexample> </para> <para> See also <function>max</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->