Hello i have this value
171024 and i want to make it
1,710.24 i tried the
number_format but cant find the combination to give
The code i did is:
and the result is
I followed this page: https://www.w3schools.com/php/phptryit.asp?filename=tryphp_func_string_number_format
but its limited not showing excaclty what i need.
Thank you in advance!
You want to format
1710.24, but you’re starting with
171024 so you need to do some arithmetic first
Convert your string to a float, then divide by 100:
Then format the result, give it two decimal places and set the decimal and thousands separators:
echo number_format((float)"171024"/100,2,".",","); // 1,710.24