[wd_asp elements=’search’ ratio=’100%’ id=1]

Displaying decimal format in PHP (bcmul)

2nd August 2016

Php - Miscellaneous

php codehaven

some times there are problems with displaying decimal numbers in PHP.

One I encountered was when I was displaying a number to 2 decimal places after multiplying by 10.
This causes it to become a float again and does not do what it should with number_format and sprint printf and round!

nothing will work except this….


$tenmonths = 29.877643;

// below does not work

//above does not work

//THIS WORKS