Skip to content

Instantly share code, notes, and snippets.

@tf0054
Created February 27, 2012 14:14
Show Gist options
  • Save tf0054/1924070 to your computer and use it in GitHub Desktop.
Save tf0054/1924070 to your computer and use it in GitHub Desktop.
For peter
<?php
echo print_rated_usd($argv[2]);
echo "\n";
function post_custom($strTmp){
global $argv;
if($strTmp === 'JPY price'){
return $argv[1];
}else{
return $argv[3];
}
}
function print_rated_usd($usd_rate){
if(is_null($usd_rate) or $usd_rate == 0){
$int_usd = -1;
}else{
$int_usd = post_custom('USD price');
if(is_null($int_usd)){
$int_jpy = post_custom('JPY price');
$int_usd = round($int_jpy / $usd_rate, -1);
print $int_jpy / $usd_rate;
print "\n";
}
}
return $int_usd;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment