PHP code example of thunderer / currenz

1. Go to this page and download the library: Download thunderer/currenz 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/ */

    

thunderer / currenz example snippets


use Thunder\Currenz\Currency\PLN;
use Thunder\Currenz\Currency\USD;

$usd = new USD();
$usd = Currenz::USD();
$usd = Currenz::createFromCode('USD');

$pln = new PLN();
$pln = Currenz::PLN();
$pln = Currenz::createFromCode('PLN');

assert('PLN' === $pln->getCode()); // ISO4217 currency code
assert('Zloty' === $pln->getName()); // regular name
assert(2 === $pln->getDigits()); // number of decimal places
assert(100 === $pln->getUnits()); // number of base units
assert(['POLAND'] === $pln->getCountries()); // list of countries where it is used
assert('985' === $pln->getNumber()); // ISO4217 currency number