Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Helmut Daschnigrum  >  Currency Exchange  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Currency Exchange
Obtains exchange rates for various currencies
Author: By
Last change:
Date: 2006-05-15 17:32
Size: 842 bytes
 

Contents

Class file image Download
<?php

// CurrencyExchange class usage example
require_once('class_CurrencyExchange.php');
$exchange = new CurrencyExchange();
if (
$exchange->retrieve()) {

// Display the current Canadian exchange rate information
var_dump($exchange->rates["CAD"]);

// Display all exchange rates returned by the CurrencyExchange class
foreach ($exchange->rates as $currency=>$rate) {
echo 
"Currency: $currency<br>".
"Exchange rate: ".    $rate["rate"]."<br>".
"Country: ".        $rate["unit"]."<br>".
"Units: ".            $rate["unit"]."<br>".
"Date retrieved: ".    $rate["date"]."<br><br>";
}

// Display information about the source of the exchange rate information
// (eg: if it was retrieved from the Federal Reserve Bank of NY, the
// Bank of Canada, etc.)
var_dump($exchange->source);
}
// ------------------------------------------------------------------------



?>