PHP code example of elliotsawyer / nzbanks
1. Go to this page and download the library: Download elliotsawyer/nzbanks 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/ */
elliotsawyer / nzbanks example snippets
//convert NZ Dollars to cents
NZBankAccount::dollars_to_cents(1.234); //1234
//convert NZ cents into dollars
NZBankAccount::cents_to_dollars(1234) //12.34
//identity the bank that issued an account. This is based on the first 6 digits and returns a Bank dataobject
Bank::identify('12-3141-0000456-001') // ASB Bank, Willis Street (Bank dataobject)
//display the account in a "normalised" format described by the IRD
NZBankAccount::prettify('1-2-3-4') //0001-0002-00000003-0004
//display the account in a "normalised" format with a different delimiter
NZBankAccount::prettify('1-2-3-4', ' ') //0001 0002 00000003 0004
NZBankAccount::prettify('1-2-3-4', '.') //0001.0002.00000003.0004