Skip to content

Instantly share code, notes, and snippets.

@wdog
Created March 16, 2018 13:07
Show Gist options
  • Save wdog/369bca79c72699fa3aa17628ff9928e4 to your computer and use it in GitHub Desktop.
Save wdog/369bca79c72699fa3aa17628ff9928e4 to your computer and use it in GitHub Desktop.
IBAN TO PARTS - ITALY
<?php
function iban_get_parts( $iban )
{
return [
'country' => substr( $iban, 0, 2 ),
'checksum' => substr( $iban, 2, 2 ),
'checksum_national' => substr( $iban, 4, 1 ),
'abi' => substr( $iban, 5, 5 ),
'cab' => substr( $iban, 10, 5 ),
'account' => substr( $iban, 15, 12 ),
];
}
// TEST
var_dump( iban_get_parts('IT45X1234512345123456789012'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment