Last active
December 13, 2015 19:58
-
-
Save goldsky/4966067 to your computer and use it in GitHub Desktop.
ISO-4217 Currency Codes in a PHP array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Content-Type: text/html; charset=utf-8'); | |
/** | |
* Download the currecy data from the link below, and place it along side this file | |
* @link http://www.currency-iso.org/en/home/tables/table-a1.html Current currency & funds code list | |
*/ | |
$xml = file_get_contents( dirname(__FILE__) . '/dl_iso_table_a1.xml'); | |
$currencyArray = json_decode(json_encode((array) simplexml_load_string($xml)), 1); | |
/** | |
* If you want to see the results, uncomment the following codes | |
*/ | |
//echo '<pre>'; | |
//echo 'return array(' . "<br />"; | |
//foreach ($currencyArray['ISO_CURRENCY'] as $k => $v) { | |
// echo "\t" . 'array(' . "<br />"; | |
// foreach ($v as $key => $value) { | |
// $hasValue = !empty($value) ? ' => \'' . addslashes($value) . '\'': null; | |
// echo "\t\t" . '\'' . $key . '\'' . $hasValue . ',' . "<br />"; | |
// } | |
// echo "\t" . '),' . "<br />"; | |
//} | |
//echo ');'; | |
//echo '</pre>'; | |
return $currencyArray['ISO_CURRENCY']; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment