List of aivailable validations

List of aivailable validations -- aivailable validation in validate_be

Validate a Belgian nationalId

The belgian nationalId on the identity card of all belgian.

A check digit is the last one, computed the standard _get_control_number function.

sample

<?php

// Include the package
require_once('Validate/BE.php');

$badNationalId = '730111-361-99';
$result = Validate_BE::nationalId($badNationalId);
echo 'Test ' . $badNationalId .' : <br />';
var_export($result);

echo '<br /><br />';
$goodNationalId = '730111 361 73';
$result = Validate_BE::nationalId($goodNationalId);
echo 'Test ' . $goodNationalId .' : <br />';
var_export($result);
?>

Output :

Test 730111-361-99 :
false

Test 730111 361 73 :
true
     

Validate a Belgian social security number

The belgian social security number is on the SIS card of all belgian.

A check digit is the last one, computed the standard _get_control_number function.

sample

<?php

// Include the package
require_once('Validate/BE.php');

$badSsn = '72011136173';
$result = Validate_BE::ssn($badSsn);
echo 'Test ' . $badSsn .' : <br />';
var_export($result);

echo '<br /><br />';
$goodSsn = '73011136173';
$result = Validate_BE::ssn($goodSsn);
echo 'Test ' . $goodSsn .' : <br />';
var_export($result);
?>

Output :

Test 72011136173 :
false

Test 73011136173 :
true
     

Validate a Belgian postcode

Belgian post code are 4 digit formed.

First parameter is the post code to validate.

An optional parameter for activate strong checks using a list of postcodes.

sample

<?php

// Include the package
require_once('Validate/BE.php');

$badPostCode = 'ABCD';
$result = Validate_BE::postalCode($badPostCode);
echo 'Test ' . $badPostCode .' : <br />';
var_export($result);

echo '<br /><br />';
$goodPostCode = '7930';
$result = Validate_BE::postalCode($goodPostCode);
echo 'Test ' . $goodPostCode .' : <br />';
var_export($result);
?>

Output :

Test ABCD :
false

Test 7930 :
true
     

sample unsing strong parameter

1234 like a good post code, but dont exit in the official list.
<?php

// Include the package
require_once('Validate/BE.php');

$badPostCode = '1234';
$goodPostCode = '7930';

$result = Validate_BE::postalCode($badPostCode);
echo 'Test ' . $badPostCode .' : <br />';
var_export($result);

$result = Validate_BE::postalCode($badPostCode,false);
echo '<br /><br />Test ' . $badPostCode .' : <br />';
var_export($result);

$result = Validate_BE::postalCode($badPostCode,true);
echo '<br /><br />Test ' . $badPostCode .' : <br />';
var_export($result);

$result = Validate_BE::postalCode($goodPostCode);
echo '<br /><br />Test ' . $goodPostCode .' : <br />';
var_export($result);
?>

Output :

Test 1234 :
true

Test 1234 :
true

Test 1234 :
false

Test 7930 :
true
     

Validate a Belgian bank account number

Belgian bankcodes consist of

sample

<?php

// Include the package
require_once('Validate/BE.php');
$badBankCode = '310164533227';
$result = Validate_BE::bankCode($badBankCode);
echo 'Test ' . $badBankCode .' : <br />';
var_export($result);

echo '<br /><br />';
$goodBankCode = '310164533207';
$result = Validate_BE::bankCode($goodBankCode);
echo 'Test ' . $goodBankCode .' : <br />';
var_export($result);
?>

Output :

Test 310164533227 :
false

Test 310164533207 :
true
     

Validate a Belgian transfert message

Belgian transfert (virement) can be done with a structured message 12 figures

sample

<?php

// Include the package
require_once('Validate/BE.php');

$badBankTransferMessage = '053/3140/16211';
$result = Validate_BE::bankTransferMessage($badBankTransferMessage);
echo 'Test ' . $badBankTransferMessage .' : <br />';
var_export($result);

echo '<br /><br />';
$goodBankTransferMessage = '054/3140/16211';
$result = Validate_BE::bankTransferMessage($goodBankTransferMessage);
echo 'Test ' . $goodBankTransferMessage .' : <br />';
var_export($result);
?>

Output :

Test 053/3140/16211 :
false

Test 054/3140/16211 :
true
     

Validate a VAT account number

Belgian VAT consist of 3-figure number.

Actually no doc was found about a checksum.

sample

<?php

// Include the package
require_once('Validate/BE.php');

$badVAT = '102.239.951';
$result = Validate_BE::vat($badVAT);
echo 'Test ' . $badVAT .' : <br />';
var_export($result);

echo '<br /><br />';
$goodVAT = '202-239-951';
$result = Validate_BE::vat($goodVAT);
echo 'Test ' . $goodVAT .' : <br />';
var_export($result);
?>

Output :

Test 102.239.951 :
false

Test 202-239-951 :
true
     

Validate a phonenumber

Validate a belgian phone number passed as first param second specify if it's would be a mobile or a traditional line or both. "/" (slash), "-" (dash), "." (dot), and white spaces are ignored. "+" are use a exit code : 0 in Belgium.

NOTE : this validate want a BELGIAN phonenumber to return true, not a valid number to call FROM belgium

sample

<?php

// Include the package
require_once('Validate/BE.php');

$badPhone = '00 32 12 123 45 67';
$result = Validate_BE::phoneNumber($badPhone);
echo 'Test ' . $badPhone .' : <br />';
var_export($result);

echo '<br /><br />';
$goodPhone = '00 32 45 12 34 56';
$result = Validate_BE::phoneNumber($goodPhone);
echo 'Test ' . $goodPhone .' : <br />';
var_export($result);
?>

Output :

Test '00 32 12 123 45 67' :
false

Test '00 32 45 12 34 56' :
true
     

sample

See now with the parameter

<?php

// Include the package
require_once('Validate/BE.php');

$goodPhone = '00 32 45 12 34 56';
$mobilePhone = '00 32 485 34 56';

echo 'Test ' . $goodPhone .' : <br />';
$result = Validate_BE::phoneNumber($goodPhone);
var_export($result) . '-';
$result = Validate_BE::phoneNumber($goodPhone,VALIDATE_BE_PHONENUMBER_TYPE_ANY);
var_export($result) . '-';
$result = Validate_BE::phoneNumber($goodPhone,VALIDATE_BE_PHONENUMBER_TYPE_NORMAL);
var_export($result) . '-';
$result = Validate_BE::phoneNumber($goodPhone,VALIDATE_BE_PHONENUMBER_TYPE_MOBILE);
var_export($result) . '-';

echo '<br /><br />';
$result = Validate_BE::phoneNumber($mobilePhone);
var_export($result) . '-';
$result = Validate_BE::phoneNumber($mobilePhone,VALIDATE_BE_PHONENUMBER_TYPE_ANY);
var_export($result) . '-';
$result = Validate_BE::phoneNumber($mobilePhone,VALIDATE_BE_PHONENUMBER_TYPE_NORMAL);
var_export($result) . '-';
$result = Validate_BE::phoneNumber($mobilePhone,VALIDATE_BE_PHONENUMBER_TYPE_MOBILE);
var_export($result);

?>

Output :

Test 00 32 45 12 34 56 :
true - true - true - false

Test 00 32 485 34 56 :
false - false - false - false