function iban_get_nationalchecksum_part($iban) { $iban = iban_to_machine_format($iban); $country = iban_get_country_part($iban); $start = iban_country_get_nationalchecksum_start_offset($country); if ($start == '') { return ''; } $stop = iban_country_get_nationalchecksum_stop_offset($country); if ($stop == '') { return ''; } $bban = iban_get_bban_part($iban); return substr($bban, $start, $stop - $start + 1); }
public function NationalChecksumStopOffset() { return iban_country_get_nationalchecksum_stop_offset($this->code); }
function _iban_nationalchecksum_set($iban, $nationalchecksum) { $country = iban_get_country_part($iban); $start = iban_country_get_nationalchecksum_start_offset($country); if ($start == '') { return ''; } $stop = iban_country_get_nationalchecksum_stop_offset($country); if ($stop == '') { return ''; } # determine the BBAN $bban = iban_get_bban_part($iban); # alter the BBAN $firstbit = substr($bban, 0, $start); # 'string before the checksum' $lastbit = substr($bban, $stop + 1); # 'string after the checksum' $fixed_bban = $firstbit . $nationalchecksum . $lastbit; # reconstruct the fixed IBAN $fixed_iban = $country . iban_get_checksum_part($iban) . $fixed_bban; return $fixed_iban; }