cvs: peardoc /en/package/validate validate.xml /en/package/validate/validate number.xml
| From: | Amir Mohammad Saied | Date: | Sun, 24 Aug 2008 06:59:15 +0000 |
| Subject: | cvs: peardoc /en/package/validate validate.xml /en/package/validate/validate number.xml | ||
| Groups: | php.pear.doc | ||
| Request: | Send a blank email to pear-doc+get-11059@lists.php.net to get a copy of this message | ||
amir Sun Aug 24 06:59:15 2008 UTC
Added files:
/peardoc/en/package/validate/validate number.xml
Modified files:
/peardoc/en/package/validate validate.xml
Log:
Docs for number method
http://cvs.php.net/viewvc.cgi/peardoc/en/package/validate/validate.xml?r1=1.5&r2=1.6&diff_format=u
Index: peardoc/en/package/validate/validate.xml
diff -u peardoc/en/package/validate/validate.xml:1.5 peardoc/en/package/validate/validate.xml:1.6
--- peardoc/en/package/validate/validate.xml:1.5 Sat Aug 23 18:15:07 2008
+++ peardoc/en/package/validate/validate.xml Sun Aug 24 06:59:15 2008
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
-<!-- $Revision: 1.5 $ -->
-<!-- $Id: validate.xml,v 1.5 2008/08/23 18:15:07 amir Exp $ -->
+<!-- $Revision: 1.6 $ -->
+<!-- $Id: validate.xml,v 1.6 2008/08/24 06:59:15 amir Exp $ -->
<!-- CREDITS: msaraujo moosh -->
<sect1 id="package.validate.validate">
@@ -53,6 +53,7 @@
</para>
&package.validate.validate.intro;
&package.validate.validate.email;
+ &package.validate.validate.number;
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
http://cvs.php.net/viewvc.cgi/peardoc/en/package/validate/validate/number.xml?view=markup&rev=1.1
Index: peardoc/en/package/validate/validate/number.xml
+++ peardoc/en/package/validate/validate/number.xml
<!-- $Revision: 1.1 $ -->
<refentry id="package.validate.validate.number">
<refnamediv>
<refname>Number validation</refname>
<refpurpose>
Validation for numbers.
</refpurpose>
</refnamediv>
<refsect1 id="package.validate.validate.number.intro">
<title>Introduction to Number validation</title>
<titleabbrev>Introduction</titleabbrev>
<para>
This method validates numbers. Decimal or not, max and min.
</para>
<para>
This method takes two arguments:
<itemizedlist>
<listitem>
<simpara>
A number.
</simpara>
</listitem>
<listitem>
<simpara>
An array of options (optional).
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
Various option are:
<itemizedlist>
<listitem>
<simpara>
<literal>decimal</literal> (mixed) - Decimal chars or false when decimal
not allowed. For example ",." to allow both "." and ",".
</simpara>
</listitem>
<listitem>
<simpara>
<literal>dec_prec</literal> (int) - Number of allowed decimals.
</simpara>
</listitem>
<listitem>
<simpara>
<literal>min</literal> (float) - Minimum value.
</simpara>
</listitem>
<listitem>
<simpara>
<literal>max</literal> (float) - Maximum value.
</simpara>
</listitem>
</itemizedlist>
</para>
</refsect1>
<refsect1 id="package.validate.validate.number.usage">
<title>How to use Number Validation</title>
<example>
<title>Number Validation</title>
<para>
The following example assumes that one wants to validate a number when
decimals are allowed and decimal character is ".", and number of allowed
decimals is 4.
</para>
<programlisting role="php">
require_once 'Validate.php';
if (Validate::number(8.0004, array('decimal' => '.', 'dec_prec'
=> 4))) {
echo 'Valid number';
}
</programlisting>
<para>
And the following one assumes that one wants to validate a decimal number
with decimal character "," or "." while it's less than "-7"
and greater
than "-9".
</para>
<programlisting role="php">
require_once 'Validate.php';
$number = '-8,1';
if (Validate::number($number,
array('decimal' => '.,', 'min' => -9, 'max' =>
-7 ))) {
echo 'Valid';
} else {
echo 'Invalid';
}
</programlisting>
</example>
</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
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
-->