Introduction – Introduction to Validate


With this package, one can easily validate various data. It includes numbers, email, string, date, URI and posibility valid multiple data with a single method call.

Some of above mentioned features have corresponding RFCs, in case, Validate conforms to those RFCs. For example email validation mostly covers RFC 822 or URI conforms to RFC 2396.

A few examples

Validating an email address

require_once 'Validate.php';

if (!
Validate::email('')) {
'Invalid Email address';
} else {
'Its Valid!';

Validating dates

In this example, date would first checked against desired format, and then get checked to see if it's not before "15 February 1986" or after "23 August 2008".

require_once 'Validate.php';

'format' => '%d%m%y',
'min' => array('15''02''1986'),
'max' => array('23''08''2008')
Validate (main package) (Previous) Validation for email addresses. (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

Note by:
The PEAR "Date" package is required to process the date as given in the example.