Location: PHPKode > scripts > CurrencyConvert > currencyconvert/example.php
<html>

<head>
  <title>Currency Converter</title>
</head>

<body>


<?php

/************************************************************************************************************************

	Copyright © 2007-2009 Stephen Smith
	email: hide@address.com

	This file is part of CurrencyConvert.

	CurrencyConvert is free software; you can redistribute it and/or modify
	it under the terms of the GNU Lesser General Public License as published by
	the Free Software Foundation; either version 2.1 of the License, or
	(at your option) any later version.

	CurrencyConvert is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Lesser General Public License for more details.

	You should have received a copy of the GNU Lesser General Public License
	along with CurrencyConvert; if not, write to the Free Software
	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

*************************************************************************************************************************/




//*************************** EXAMPLE USAGE *********************************


// Instantiate a new CurrencyConvert object
require_once( 'CurrencyConvert.class.php' ) ;

$quote = new CurrencyConvert( 'Google' ) ;

// List the currencies available
echo 'Currency list: <br />' ;

$currency_list = $quote->currencies() ;

foreach ( $currency_list as $symbol => $name ) {	echo '&nbsp;&nbsp;' . $symbol . '&nbsp;(' . $name . ')<br />' ;}
echo '<br />' ;


// Obtain a quotation, using the required currency symbols
$quote->convert( 'GBP', 'EUR' ) or die( 'Exchange rate lookup failed' ) ;
echo 'From: ' .		$quote->name( 'from' ) 	. '<br />' ;
echo 'To: ' .		$quote->name( 'to' ) 	. '<br />' ;
echo 'Price: ' .	$quote->price( 2.00 ) 	. '<br />' ;

echo 'Default price amount (1.00): ' .	$quote->price() 		. '<br />' ;


//************************** END EXAMPLE USAGE ******************************



?>


</body>

</html>
Return current item: CurrencyConvert