Skip to content

Instantly share code, notes, and snippets.

@BAHC
Last active June 28, 2018 20:09
Show Gist options
  • Save BAHC/98c5c582fc0b14234613d290a3f4d144 to your computer and use it in GitHub Desktop.
Save BAHC/98c5c582fc0b14234613d290a3f4d144 to your computer and use it in GitHub Desktop.
Get Exchange Rate For One Pair In One Direction
<?php
require 'exchange_rate.php';
function get_exr($_from=null, $_to=null)
{
$_res = null;
$_pair = $_from.'_'.$_to;
$_pairs = exchange_rate([ $_from => $_to ]);
if(is_array($_pairs) && isset($_pairs[$_pair]))
{
$_res = $_pairs[$_pair];
}
return $_res;
}
echo get_exr('USD', 'TRY');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment