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 Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Wolphie Posted July 10, 2008 Share Posted July 10, 2008 Just use $val = (float) str_replace(".", "," $val); Quote Link to comment 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.