I have number from database where the column type is set to string. I have no control of the database since I am just consuming it as an api. What I need is to convert and format it according to its decimal values(not count)
So
37.2348 should be 37.24
What I tried
number_format(37.2348, 2) -> 37.23
round(37.2348, 2) -> 37.23
There's no need to convert the result from string to decimal, as I noticed the Php built in number_format function can automatically convert and format it. Any Ideas ?