PHP code example of ben-gibson / bryn-fallback-calculator
1. Go to this page and download the library: Download ben-gibson/bryn-fallback-calculator 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/ */
ben-gibson / bryn-fallback-calculator example snippets
php
or = new \Gibbo\Bryn\Calculator\Fallback\FallbackCalculator();
$calculator->registerCalculator(Gibbo\Bryn\Calculator\Yahoo\YahooCalculator::default());
$calculator->registerCalculator(Gibbo\Bryn\Calculator\ECB\ECBCalculator::default());
$exchangeRate = $calculator->getRate(
new \Gibbo\Bryn\Exchange(
\Gibbo\Bryn\Currency::GBP(),
\Gibbo\Bryn\Currency::USD()
)
);
echo $exchangeRate;
echo $exchangeRate->convert(550);
echo $exchangeRate->flip()->convert(550);
/**
* OUTPUTS:
*
* 1 GBP(£) = 1.25 USD($)
* 686.2295
* 440.814
*/