Page 499 - Beginning PHP 5.3
P. 499
Chapter 15: Making Your Job Easier with PEAR
Rule Type Value of $format Argument Description
numeric N/A The value must be a number.
nopunctuation N/A The value must not contain punctuation
characters.
nonzero N/A The value must be a number that doesn ’ t
begin with zero.
compare $ comparisonType Compares two field values (pass a two -
element array of element names as the first
parameter to addRule() ). Good for
checking whether two password fields
match.
:
Allowed values for $ comparisonType
“ eq ” or “ == “ : Values must be the same
(default setting)
“ neq ” or “ != “ : Values must be different
: First value must be greater
“ gt ” or “ > “
than the second
“ gte ” or “ > = “ : First value must be
greater than or equal to the second
: First value must be less than
“ lt ” or “ < “
the second
“ lte ” or “ < = “ : First value must be less
than or equal to the second
callback $ functionName Runs a callback function called
$ functionName to do the check. The
function should expect the value to check
as an argument and return true if the
value passed the check, or false
otherwise.
uploadedfile N/A The file must have been uploaded. (For file
upload fields.)
maxfilesize $ max The uploaded file must not exceed $ max
bytes in length. (For file upload fields.)
mimetype $ type The uploaded file must be of MIME type
$ type . (For file upload fields.)
filename $ regex The uploaded file ’ s name must match the
regular expression $ regex . (For file upload
fields.)
461
9/21/09 9:14:54 AM
c15.indd 461 9/21/09 9:14:54 AM
c15.indd 461