Untitled
unknown
php
2 years ago
1.3 kB
4
Indexable
function validateIBAN($iban) { // IBAN uzunluğu kontrolü if(strlen($iban) < 4) { return false; } // Geçerli ülke kodu kontrolü $countryCode = substr($iban, 0, 2); $countryList = array( 'AD','AT','BE','BG','CH','CY','CZ','DE','DK','EE', 'ES','FI','FR','GB','GI','GR','HR','HU','IE','IL', 'IS','IT','KW','KZ','LB','LI','LT','LU','LV','MC', 'MD','ME','MK','MR','MT','MU','NL','NO','PL','PT', 'RO','RS','SA','SE','SI','SK','SM','TN','TR','VG'); if(!in_array($countryCode, $countryList)) { return false; } // IBAN doğrulama kodu hesaplama $iban = str_replace(' ', '', $iban); $iban = substr($iban, 4) . substr($iban, 0, 4); $iban = str_replace( array('A','B','C','D','E','F','G','H','I','J','K','L','M', 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z'), array('10','11','12','13','14','15','16','17','18','19','20','21', '22','23','24','25','26','27','28','29','30','31','32','33', '34','35','36'), $iban); $remainder = intval(substr($iban, 0, 1)); for($i = 1; $i < strlen($iban); $i++) { $value = intval(substr($iban, $i, 1)); $remainder = ($remainder * 10 + $value) % 97; } return ($remainder == 1); }
Editor is loading...