[ class tree: Validate_AU ] [ index: Validate_AU ] [ all elements ]

Class: Validate_AU

Source Location: /Validate_AU-0.1.4/Validate/AU.php

Class Overview

Data validation class for Australia



  • Release: @package_version@


  • 2006 Alex Hayes


Inherited Variables

Inherited Methods

Class Details

[line 57]
Data validation class for Australia

Contains code from Validate_AT, Validate_UK and Validate_NZ

This class provides methods to validate:

  • Postal code
  • Phone number
  • Australian Business Number
  • Australian Company Number
  • Tax File Number
  • Australian Regional codes

[ Top ]

Method Detail

abn   [line 294]

bool abn( string $abn)

Australian Business Number (ABN).

Validates an ABN using a modulus calculation


string   $abn   —  ABN to validate

[ Top ]

acn   [line 212]

bool acn( string $acn)

Validate an Australian Company Number (ACN)

The ACN is a nine digit number with the last digit being a check digit calculated using a modified modulus 10 calculation.


string   $acn   —  ACN number to validate

[ Top ]

checkDigit   [line 323]

bool checkDigit( array $digits, int $modulus, array $weights, array $length)

Validate number against decimal checksum (check digit)

A check digit is a form of redundancy check used for error detection, the decimal equivalent of a binary checksum. It consists of a single digit computed from the other digits in the message.


array   $digits   —  Digits to check
int   $modulus   —  Modulus
array   $weights   —  Array containing weighting
array   $length   —  Length

[ Top ]

phoneNumber   [line 141]

bool phoneNumber( string $number, [mixed[] $options = array('strict' => false, 'national' => true, 'indial' => true, 'international' => true, 'other' => true)])

Validate a telephone number.

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.

  • Todo: Check that $flags contains a valid flag.
  • Access: public


string   $number   —  The telephone number
mixed[]   $options   —  A list of options 'strict' => true - do not common characters 'national' => true - validate national numbers 'indial' => true - 13, 1300, 1800, 1900 numbers 'other' => true - uncommon phone validations like premium sms, data and personal numbers 'international => true - international numbers for Australia (eg. +61.3 9999 9999)

[ Top ]

postalCode   [line 71]

bool postalCode( string $postcode, [bool $strong = false], [string $dataDir = null])

Validate Austrialian postal codes.
  • Return: true if postcode is ok, false otherwise
  • Access: public


string   $postcode   —  postcode to validate
bool   $strong   —  optional; strong checks against a list of postcodes
string   $dataDir   —  optional; name of directory datafile is located in

[ Top ]

region   [line 99]

bool region( string $region)

Validates Australian Regional Codes
  • Return: Returns true on success, false otherwise
  • Access: public


string   $region   —  regional code to validate

[ Top ]

ssn   [line 254]

bool ssn( string $ssn)

Social Security Number.

Australia does not have a social security number system, the closest equivalent is a Tax File Number


string   $ssn   —  ssn number to validate

[ Top ]

tfn   [line 271]

bool tfn( string $tfn)

Tax File Number (TFN)

Australia does not have a social security number system, the closest equivalent is a Tax File Number.


string   $tfn   —  Tax File Number

[ Top ]

Documentation generated on Mon, 11 Mar 2019 15:40:03 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.