philip          Sun Jun  2 00:36:16 2002 EDT

  Modified files:              
    /phpdoc/en/reference/math/functions min.xml 
  Log:
  Added some examples.  Returns NULL on failure.  Will fail if one variable is 
  undefined.  See also max().
  
  
Index: phpdoc/en/reference/math/functions/min.xml
diff -u phpdoc/en/reference/math/functions/min.xml:1.2 
phpdoc/en/reference/math/functions/min.xml:1.3
--- phpdoc/en/reference/math/functions/min.xml:1.2      Wed Apr 17 02:39:54 2002
+++ phpdoc/en/reference/math/functions/min.xml  Sun Jun  2 00:36:16 2002
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.2 $ -->
+<!-- $Revision: 1.3 $ -->
 <!-- splitted from ./en/functions/math.xml, last change in rev 1.2 -->
   <refentry id="function.min">
    <refnamediv>
@@ -25,7 +25,8 @@
     <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.
+     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>
@@ -36,7 +37,37 @@
      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.
+     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>


Reply via email to