Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function isValidRib($rib)
- {
- if(mb_strlen($rib) !== 23)
- {
- return false;
- }
- $key = substr($rib,-2);
- $bank = substr($rib,0,5);
- $bank = substr($rib,0,5);
- $branch = substr($rib,5,5);
- $account = substr($rib,10,11);
- $account = strtr($account,
- 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
- '12345678912345678923456789');
- return 97 - bcmod(89*$bank + 15 * $branch + 3 * $account,97) === (int)$key;
- }
Advertisement
Add Comment
Please, Sign In to add comment