PHP code example of devsmo / php-hetu
1. Go to this page and download the library: Download devsmo/php-hetu 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/ */
devsmo / php-hetu example snippets
$hetu = Devsmo\Hetu::create('041281-981T');
if ( $hetu ) {
echo "It's valid";
}
else {
echo "It's not valid...";
}
try {
$hetu = new Devsmo\Hetu('041281-981T');
}
catch (\InvalidArgumentException $e){
$msg = $e->getMessage();
}
$age = $hetu->getAge(); // 35
$date_of_birth = $hetu->getDateStr(); // 1981-12-04
$gender = $hetu->getGender(); // male
composer