PHP code example of marjovanlier / southafricanidvalidator
1. Go to this page and download the library: Download marjovanlier/southafricanidvalidator library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
marjovanlier / southafricanidvalidator example snippets
use MarjovanLier\SouthAfricanIDValidator\SouthAfricanIDValidator;
// Instantiate the ID validator
$validator = new SouthAfricanIDValidator();
// Validate a South African ID number
$idNumber = 'Your South African ID number here';
$isValid = $validator->luhnIDValidate($idNumber);
if ($isValid === true) {
echo 'The ID number is valid.';
} elseif ($isValid === false) {
echo 'The ID number is invalid.';
} else {
echo 'The ID number does not meet specific constraints.';
}
use MarjovanLier\SouthAfricanIDValidator\SouthAfricanIDValidator;
$idNumber = 'Your South African ID number here';
$result = SouthAfricanIDValidator::luhnIDValidate($idNumber);
if ($result) {
echo 'The ID number is valid.';
} elseif (!$result) {
echo 'The ID number is invalid.';
} else {
echo 'The ID number does not meet specific constraints.';
}