• We just launched and are currently in beta. Join us as we build and grow the community.

Currrency Converter in PHP

Jeanjill1

Memory Dump Analyst
J Rep
0
0
0
Rep
0
J Vouches
0
0
0
Vouches
0
Posts
81
Likes
35
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 200 XP
A currency converter that converts Philippine Peso into different currency. The values of each currency would change depending upon the current market value.
  1. <?php

  2. $currency

    =

    $_POST

    [

    'currency'

    ]

    ;
  3. $place

    =

    $_POST

    [

    'place'

    ]

    ;
  4. $ARS

    =

    0.06586

    ;
  5. $BSD

    =

    0.02129

    ;
  6. $BRL

    =

    0.03794

    ;
  7. $CAD

    =

    0.02286

    ;
  8. $COP

    =

    44.56140

    ;

  9. switch

    (

    $place

    )

    {
  10. case

    "Argentine Peso"

    :
  11. $a

    =

    (

    $currency

    *

    $ARS

    )

    ;
  12. echo

    "<p>Php $currency

    is equivalent

  13. to $a

    ARS in Argentina</p>"

    ;
  14. break

    ;
  15. case

    "Bahamian Dollar"

    :
  16. $b

    =

    (

    $currency

    *

    $BSD

    )

    ;
  17. echo

    "<p>Php $currency

    is equivalent

  18. to $b

    BSD in Bahama</p>"

    ;
  19. break

    ;
  20. case

    "Brazilian Real"

    :
  21. $c

    =

    (

    $currency

    *

    $BRL

    )

    ;
  22. echo

    "<p>Php $currency

    is equivalent

  23. to $c

    BRL in Brazil</p>"

    ;
  24. break

    ;
  25. case

    "Canadian Dollar"

    :
  26. $d

    =

    (

    $currency

    *

    $CAD

    )

    ;
  27. echo

    "<p>Php $currency

    is equivalent

  28. to $d

    CAD in Canada</p>"

    ;
  29. break

    ;
  30. case

    "Colombian Peso"

    :
  31. $e

    =

    (

    $currency

    *

    $COP

    )

    ;
  32. echo

    "<p>Php $currency

    is equivalent

  33. to $e

    COP in Colombia</p>"

    ;
  34. }
  35. //REFERENCE: http://www.exchange-rates.org/currentRates/PHP
  36. ?>

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.

2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

 

452,292

323,526

323,535

Top