Moonsoft Software Solutions

demical points dont show

Started 30 May 2013 · 1 reply

  1. moon_1066
    Hi there we have set the result to diplay to two decimal points. Could you help us witha small problem. the results show up and work fine but if the result amount does not need two decimals it removes the zero

    For example if result is 3.56 it works but if result is 3.30 its drops the zero and displays it as 3.3

    Because this is a currency value i need the zero to show up please help with this
  2. Moonsoft support
    Hello,
    in order to have fixed decimal positions, you have to apply a format to the number once you have finished calculations. Assuming that you have your number stored at the variable $result, you should add this line at the end of your code section:


    $result=number_format($result,2);


    This will format the number to 2 decimal positions.

    More information and examples about number_format function here:


    http://php.net/manual/en/function.number-format.php


    Hope this helps, regards

Still stuck?

Customers with an active license can open a support ticket.

Log in to open a ticket