BW Validation (PHP)

This plugin has no dependancies.


$php_plugins = array(

It provides useful functions for validating variables.


Count digits/numbers in a string

The function returns an integer with the total numbers in the string


Rough check for a valid telephone number by stripping string to 40 characters and counting the digits.

Throws an Exception on failure. If there are between 5 and 8 digits, the first response in unsuccessful and if resubmitted will be successful.

For this function the messages are fixed:

  • "Please enter your telephone number"
  • "You have not entered a valid telephone number"
  • "Are you sure this is your phone number? It doesn't seem to contain many numbers."


This function checks the string using filter_var($email, FILTER_VALIDATE_EMAIL) following by the domain name MX record DNS lookup using checkdnsrr

bwValidation::$emailError will not be false if there is an error message to display. The function returns true or false

The function will return true or false

bwValidation::checkDate($date, $format="dd/mm/yy")

Uses preg_match to split your date string up into the format provided (using slashes and 'dd', 'mm' and either 'yy' or 'yyyy') then run through PHPs checkdate

The function will return true or false


Checks for a complete and valid URL.

The function will return true or false


Specify a length greater than 1 if required, otherwise this function will decode HTML entitites, strip tags, trim the string and check it's length is greater than specified and not null.

The function will return true or false