Validate_AU::phoneNumber

Validate_AU::phoneNumber() – Validate a telephone number.

Synopsis

require_once '/Validate/AU.php';

bool Validate_AU::phoneNumber ( string $number , int $flags = VALIDATE_AU_PHONENUMBER_NATIONAL )

Описание

Note that this function supports the following notations:

  • Landline: 03 9999 9999

  • Mobile: 0400 000 000 (as above, but usually notated differently)

  • Indial: 131 812 / 1300 000 000 / 1800 000 000 / 1900 000 000

  • International: +61.3 9999 9999

For International numbers, only +61 will be valid, as this is Australia's dial code, and the format MUST be +61.3, where 3 represents the state dial code, in this case, Victoria.

Note: If the VALIDATE_AU_PHONENUMBER_STRICT flag is not supplied, then all spaces, dashes and parenthesis are removed before validation. You will have to strip these yourself if your data storage does not allow these characters.

Parameter

string $number

The telephone number

integer $flags

Can be a combination of the following flags:

  • VALIDATE_AU_PHONENUMBER_STRICT: if supplied then no spaces, parenthesis or dashes (-) will be removed.

  • VALIDATE_AU_PHONENUMBER_NATIONAL: when supplied valid national numbers (eg. 03 9999 9999) will return TRUE.

  • VALIDATE_AU_PHONENUMBER_INDIAL: when supplied valid indial numbers (eg. 13/1300/1800/1900) will return TRUE.

  • VALIDATE_AU_PHONENUMBER_INTERNATIONAL: when supplied valid international notation of Australian numbers (eg. +61.3 9999 9999) will return TRUE.

ToDo

todo Check that $flags contains a valid flag.

Throws

throws no exceptions thrown

author

author Alex Hayes <ahayes@wcg.net.au>

author Daniel O'Connor <daniel.oconnor@gmail.com>

Замечание

This function can not be called statically.

    Поддержать сайт на родительском проекте КГБ