php - Output currency after calculating (Sprintf)


i calculate via smarty like this:

{math equation='system - user' user=31.400 system=50.000}

The Output im getting is18.6but i want18.600

The Output should be like:

20.000 = ```20.000```<br>
400 = ```400```<br>
1.000,44 = ```1.000,44```<br>

i tried it with different formats i saw on the sprintf manual but nothing helped.

Hope you can help me, thank you.




You can useformat attribute.

Like this :

{math equation='system - user' user=31.400 system=50.000 format="%.3f" }

%.3f => result with 3 decimals

People are also looking for solutions to the problem: php - I want to make two button one that maximise and the other one that minimise the size of the page of my browser


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.