Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

easy conversion problem for you :)

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Postby Redcircle » Sat Feb 15, 2003 9:02 am

Question #1
Code: Select all
number_format($var,2)


the number represents how many decimal places you want.

_____________________________

Question #2
Code: Select all
echo "€/$".(substr($myrow["price"],1)*1.6)


Question #3
Code: Select all
$conversion = 1.6;
echo "€/$".(substr($myrow["price"],1)*$conversion);


you can then change $conversion at anytime. This way in 6 months you won't forget what the 1.6 was.


make sure you have any math function encapsulated with () if it is in the same line as your output.

BTW why are you calling a substr() function on the price? I would not reccomend including the "€/$" in the within the database.
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.