Formatting does not work

2

I am using this formatting so that the total returns the correct value. But this line returns me without the pennies. The value has to return for example: 23.99 and is returning 23.00.

How to solve?

$total = number_format($total,2, ',' , '.');
echo '<tr>
     <td colspan="5">TOTAL</td>
     <td><hr>  '.$total.'  </td>
     </tr>';
    
asked by anonymous 15.06.2018 / 15:46

1 answer

0

If it's just a mask issue. If the value is being handled correctly (decimal or double) use that of jquery;

Tem que colocar a referencia para :

jquery.maskMoney.min.js

$("#valor").maskMoney({
    prefix: "R$:",
    decimal: ",",
    thousands: "."
});

HTML:

<input class="form-control" type="text" id="valor"  value="0" />
    
15.06.2018 / 22:18