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 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(). 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,',','.'); ?> 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!!!!!! 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? 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. Link to comment https://forums.phpfreaks.com/topic/96364-sprintf-dot-comma/#findComment-493251 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.