web_master Posted March 16, 2008 Share Posted March 16, 2008 Hi, a little problem of differences in US and european price display I write prices like this: 1,00 10,00 100,00 1.000,00 BAD VERSION with formatting string: sprintf("%.2f", $request['component_price_eu']) looks like: - in my dbase is (float) nr: 2 (in order this looks like: 2.000 EUR) - in my dbase is (float) nr: 2000 (in order this looks like: 2000.000 EUR) GOOD VERSION - in my dbase is (float) nr: 2 (in order this must looks like: 2,000 EUR) - in my dbase is (float) nr: 2000 (in order this must looks like: 2.000,000 EUR) How can get a "GOOD VERSION"? thnxs Quote Link to comment https://forums.phpfreaks.com/topic/96364-sprintf-dot-comma/ Share on other sites More sharing options...
Daniel0 Posted March 16, 2008 Share Posted March 16, 2008 Use number_format(). Quote Link to comment https://forums.phpfreaks.com/topic/96364-sprintf-dot-comma/#findComment-493239 Share on other sites More sharing options...
sasa Posted March 16, 2008 Share Posted March 16, 2008 <?php echo number_format(1234,3,',','.'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/96364-sprintf-dot-comma/#findComment-493240 Share on other sites More sharing options...
web_master Posted March 16, 2008 Author Share Posted March 16, 2008 ITS GREAT! THNXS!!!!!! Quote Link to comment https://forums.phpfreaks.com/topic/96364-sprintf-dot-comma/#findComment-493246 Share on other sites More sharing options...
web_master Posted March 16, 2008 Author Share Posted March 16, 2008 where is a "SOLVED" button? Quote Link to comment https://forums.phpfreaks.com/topic/96364-sprintf-dot-comma/#findComment-493247 Share on other sites More sharing options...
unsider Posted March 16, 2008 Share Posted March 16, 2008 where is a "SOLVED" button? They're working on the site, it will most likely be back soon. Quote Link to comment https://forums.phpfreaks.com/topic/96364-sprintf-dot-comma/#findComment-493251 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.