Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
PHP format currency
SUBMITTED BY:
Guest
DATE:
Oct. 23, 2013, 9:09 a.m.
FORMAT:
PHP
SIZE:
671 Bytes
Raw
Download
Tweet
HITS:
972
Go to comments
Report
<?php
function
formatCurrencySign
(
$price
,
$currency
,
$separator
=
""
)
{
if
(
!
in_array
(
$currency
,
array
(
'USD'
,
'GBP'
,
'EUR'
)))
{
return
$price
.
$separator
.
$currency
;
}
switch
(
$currency
)
{
case
'USD'
:
$format
=
"$"
.
$separator
.
$price
;
break
;
case
'GBP'
:
$format
=
"£"
.
$separator
.
$price
;
break
;
case
'EUR'
:
$format
=
"€"
.
$separator
.
$price
;
break
;
}
return
$format
;
}
?>
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus