PHP code example of krepysh-spec / currency
1. Go to this page and download the library: Download krepysh-spec/currency 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/ */
krepysh-spec / currency example snippets
echo KrepyshSpec\World\Currency::ANG; // >> 'ANG'
echo KrepyshSpec\World\Currency::USD; // >> 'USD'
echo KrepyshSpec\World\Currency::EUR; // >> 'EUR'
use KrepyshSpec\World\Currency;
$allCurrencies = Currency::all();
var_dump($allCurrencies);
/**
["AFN"]=>
array(3) {
["countryName"]=>
string(11) "Afghanistan"
["name"]=>
string(19) "Afghanistan Afghani"
["symbol"]=>
string(7) "؋"
}
["ARS"]=>
array(3) {
["countryName"]=>
string(9) "Argentina"
["name"]=>
string(14) "Argentine Peso"
["symbol"]=>
string(5) "$"
}
["AWG"]=>
array(3) {
["countryName"]=>
string(5) "Aruba"
["name"]=>
string(13) "Aruban florin"
["symbol"]=>
string(6) "ƒ"
}
...
*/
use KrepyshSpec\World\Currency;
$currencyDetails = (new Currency())->'afn';
var_dump($currencyDetails);
/**
["AFN"]=>
array(3) {
["countryName"]=>
string(11) "Afghanistan"
["name"]=>
string(19) "Afghanistan Afghani"
["symbol"]=>
string(7) "؋"
}
...
*/
use KrepyshSpec\World\Currency;
$currencySymbol = (new Currency())->'afn'['symbol'];
var_dump($currencySymbol);
/**
"؋"
...
*/