how to convert all numbers to xx,xx decimal format without exploding number or string?
like;
8,9 --> 8,90
8,99 --> 8,99
12,1 --> 12,10
129,9 --> 129,90
any idea?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use number_format like:
If you have commas as decimal separators in your input you can convert values to float with:
str_replace('.', '', $string_number)is used to remove thousand separators.str_replace(',', '.', ... )is used to replace commas with dots.