Your Ad Here

 Navigation
Home
Source code
Tutorials
RSS feeds
Articles
Wordpress plugins
Blog
Books
Software
Downloads
Hosting
manuals
Script directory
Training
Our Links




 Sponsors
 Links
low cost magazines
dropshippers
wwwstores
 Downloads
 Misc
Webmaster Resources
Only PHP
ScriptSearch.com
Scripts.com - Get the best scripts NOW!
AndreaPHP Programming

Valid XHTML 1.0 Transitional


Valid CSS!


Currency Conversion (pounds)


Currency Conversion (pounds)

This function will take a value in pounds and a country and will convert the pounds to the currency of the country . Note this function has the currency exchange rates of 23/07/2001 , if you wished to use this on your site you would have to update this every day at least . This would be easy to convert so you could convert from dollars to other currencies .

We used the currency exchange info from this site

Valid countries are us , japan , france , italy , canada , germany and australia

Here is our function

<?php
function ConvPounds($pounds , $country)
{
$rate = 0;
switch($country)
{
Case "us" :
$rate = 1.41973 ;
break;
Case "japan" :
$rate = 176.154 ;
break;
Case "france" :
$rate = 10.7552 ;
break;
Case "italy" :
$rate = 317475 ;
break;
Case "canada" :
$rate = 2.19297 ;
break;
Case "germany" :
$rate = 3.20583 ;
break;
Case "australia" :
$rate = 2.79862 ;
break;
default :
$rate = 0;
break;
}
return $pounds * $rate;
}
?>

And here is our test script

<?php
//test our function
//convert 10 pounds to us dollars
echo ConvPounds(10 , "us");
echo "<br>";
//convert 25 pounds to french francs
echo ConvPounds(25 , "france");
?>




Books
 Sponsors
 Random Code
count characters in a sentence(string)
Display the dimensions of an image(image)
highlighting source code(beginner)
 Random Article
  Network
Programming resources
Tutorials directory
Hosting resources
ASP site
Domain names
Progged
Maxi directory
bigarticle : free articles
A Code
Code N Tutorials




beginners PHP Copyright © 2004 onwards by beginnersPHP.