Validate_CA | Validate_CH |
Validate_CA | |
PEAR Manual | |
The canadian social security number is on the SIS card of all canadian.
A check digit is the last one, computed the standard _get_control_number function.
|
Output :
Test 012345674 :
false
Test 123456782 :
true
|
The postal code is a six-character, uniformly structured alphanumeric code in the form of ANA NAN where "A" represents an alphabetic character and "N" represents a numeric character.
The postal code is made up of two segments:
The first, the Forward Sortation Area (FSA), is a combination of three characters (alpha - numeric - alpha).
It identifies a major geographic area in an urban or a rural location.
The third character of the FSA segment (M4B), in conjunction with the first two characters, describes an exact area of a city or town or other geographic area.
The second segment, Local Delivery Unit (LDU), is a combination of three characters (numeric - alpha - numeric).
It identifies the smallest delivery unit within a forward sortation area.
The LDU, identified by the last three characters of the postal code, allows for a final sort within an FSA.
In Urban Areas, the last three digits may indicate a specific city block (one side of a street between two intersecting streets), a single building or, in some cases, a large volume mail receiver.
In Rural Areas, the last three digits (LDU), together with the FSA, identify a specific Rural community.
First parameter of the method is the post code to validate.
An optional parameter for limite the request to a province.
|
Output :
Test 48103 :
false
Test H2M 2J1 :
true
|
H2M 2J1 like a good post code, but province don't exit.
|
Output :
Test H2M 2J1 :
true
Test H2M 2J1 in QC:
true
Test H2M 2J1 in AB:
false
|
Canada and the United States share the same numbering plan, hence you can also call Validate_US::phoneNumber()
Can allow only seven digit numbers.
Also allows the formats, (xxx) xxx-xxxx, xxx xxx-xxxx, and now x (xxx) xxx-xxxx or various combination without spaces or dashes.
|
Output :
Test 467875098x :
false
Test 4678750987 :
true
|
See now with the parameter
|
Output :
Test 8750987 :
true
Test 8750987 :
With $requireAreaCode false
true
With $requireAreaCode true
false
Test (467)8750987 :
With $requireAreaCode false
false
With $requireAreaCode true
true
|
Validate_CA | Validate_CH |
Validate_CA | |
PEAR Manual | |