smiley_kool Posted July 10, 2008 Share Posted July 10, 2008 hi, can someone temme , hw to display the floating point value wit comma specified.. ex: 12345.90, how to display this with comma (1,12,345.90) .. i wanna display this using smarty $val=1234.90 i tried using number_format ====> {$val | number_format}., but using this it disable the digits after decimal point. i.e it prints like this 1,234 thank in advance Link to comment https://forums.phpfreaks.com/topic/114039-how-to-display-the-float-value-with-comma-specified/ Share on other sites More sharing options...
bluejay002 Posted July 10, 2008 Share Posted July 10, 2008 If the comma you want to specify is located somewhere else that cannot be handled right away by number_format(), you can use preg_replace() and specify the regex that would suit your taste and the values you want to insert. Link to comment https://forums.phpfreaks.com/topic/114039-how-to-display-the-float-value-with-comma-specified/#findComment-586149 Share on other sites More sharing options...
smiley_kool Posted July 10, 2008 Author Share Posted July 10, 2008 hi, can someone temme , hw to display the floating point value wit comma specified.. ex: 112345.90, how to display this with comma (1,12,345.90) .. i wanna display this using smarty $val=1234.90 i tried using number_format ====> {$val | number_format}., but using this it disable the digits after decimal point. i.e it prints like this 1,234 thank in advance Link to comment https://forums.phpfreaks.com/topic/114039-how-to-display-the-float-value-with-comma-specified/#findComment-586168 Share on other sites More sharing options...
Wolphie Posted July 10, 2008 Share Posted July 10, 2008 Just use $val = (float) str_replace(".", "," $val); Link to comment https://forums.phpfreaks.com/topic/114039-how-to-display-the-float-value-with-comma-specified/#findComment-586169 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.