Пример #1
0
 public function testPrints()
 {
     $euro = new Euro(0);
     $this->assertEquals('0.00 EUR', $euro->__toString());
 }
Пример #2
0
$btc_class = new Bitcoin();
switch ($currency) {
    case "BTC":
        $price = $btc_class->get_price();
        printf("%.8f", $price);
        break;
    case "ISK":
        $eur_class = new Euro();
        $isk_class = new Krona();
        $btc_eur = $eur_class->get_price();
        $eur_isk = $isk_class->get_price();
        $price = $btc_class->get_price() * $btc_eur * $eur_isk;
        printf("%.5f", $price);
        break;
    case "EUR":
        $eur_class = new Euro();
        $btc_eur = $eur_class->get_price();
        $price = $btc_class->get_price() * $btc_eur;
        printf("%.5f", $price);
        break;
    case "USD":
        $usd_class = new USD();
        $btc_usd = $usd_class->get_price();
        $price = $btc_class->get_price() * $btc_usd;
        printf("%.5f", $price);
        break;
    default:
        header("location: http://ercinee.eu/");
        //echo "No currency input: use /API/index.php?cur=[BTC|ISK|EUR|USD]";
        //die();
}