codehaven - php snippets - coding help
Generic filters
Exact matches only
  • 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….

    Was this code snippet helpful?