The Personal Public Service Number (PPS No) is an identifier issued by Client Identity Services, Department of Social and Family Affairs on behalf of the Minister for Social and Family Affairs in the Republic of Ireland.
<?php
// Include the package
require_once 'Validate/IE.php';
$badSsn = '012345674';
$result = Validate_IE::ssn($badSsn);
echo 'Test ' . $badSsn .' : <br />';
var_export($result);
echo '<br /><br />';
$goodSsn = '1234567W';
$result = Validate_IE::ssn($goodSsn);
echo 'Test ' . $goodSsn .' : <br />';
var_export($result);
?>
Output :
Test 012345674 :
false
Test 1234567W :
true
There is no national post code system in Ireland; at present the postalCode method only validates Dublin postal districts: "Dublin 6W", or "D 4" for example.
Ireland has phone numbers that are built similar to US and Canadian numbers however they have a couple of distinctions.
For instance the STD [Standard Trunk Dial] prefix varies in length: Dublin has the code '01', Cork has '021', Galway 091, and so on.
The phoneNumber method takes two parameters: the first is the phone number to be tested and the second is a flag indicating whether the number should be checked for a valid prefix. This boolean flag defaults to true.
<?php
// Include the package
require_once 'Validate/IE.php';
$phoneNumber = '467875098x';
$result = Validate_IE::phoneNumber($phoneNumber);
echo 'Test ' . $phoneNumber .' : <br />';
var_export($result);
echo '<br />';
$phoneNumber = '014142438';
$result = Validate_IE::phoneNumber($phoneNumber);
echo 'Test ' . $phoneNumber .' : <br />';
var_export($result);
?>
Output :
Test 467875098x :
false
Test 014142438:
true
See now with the requiredAreaCode parameter being utilised.
<?php
// Include the package
require_once 'Validate/IE.php';
$phoneNumber = '87509824';
$result = Validate_IE::phoneNumber($phoneNumber,false);
echo 'Test ' . $phoneNumber .' : <br />';
var_export($result);
echo '<br /><br />';
$phoneNumber = '8750987';
echo 'Test ' . $phoneNumber .' : <br />';
echo 'With $requireAreaCode false <br />';
$result = Validate_IE::phoneNumber($phoneNumber,false);
var_export($result);
echo '<br />';
echo 'With $requireAreaCode true<br />';
$result = Validate_IE::phoneNumber($phoneNumber,true);
var_export($result);
echo '<br /><br />';
$phoneNumber = '(0915)8750987';
echo 'Test ' . $phoneNumber .' : <br />';
echo 'With $requireAreaCode false <br />';
$result = Validate_IE::phoneNumber($phoneNumber,false);
var_export($result);
echo '<br />';
echo 'With $requireAreaCode true<br />';
$result = Validate_IE::phoneNumber($phoneNumber,true);
var_export($result);
?>
Output :
Test 87509824 :
true
Test 8750987 :
With $requireAreaCode false
true
With $requireAreaCode true
false
Test (091)8750987 :
With $requireAreaCode false
false
With $requireAreaCode true
true