PHP Classes

File: index.php

Recommend this page to a friend!
  Classes of Cristian Navalici   XML Currency Reader   index.php   Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Short example of usage.
Class: XML Currency Reader
Retrieve currency exchange data from XML files
Author: By
Last change:
Date: 15 years ago
Size: 643 bytes
 

Contents

Class file image Download
<?php

require_once('XML_currency_reader.class.php');
require_once(
'BNR_reader.class.php');

// create an object
$bnrob = new BNR_reader();

// parse the content
$content = $bnrob->parse_xml();

// display the rate for USD
echo 'First method: raw array display <br />';
echo
'Exchange Rate for 1 USD is : ' .$content[2][18]['rate'] .'<br /><br />';

// or use the class method
$ret_arr = $bnrob->parse_rate_contents($content[2], 'USD');
echo
'Second method: parse_rate_contents() <br />';
echo
'Exchange Rate for 1 USD is : ' .$ret_arr['rate'] .'<br />';

// debug
echo '<pre>' .print_r($content, true).'</pre>';



?>