Jump to content

[SOLVED] Add zero to the hundredths place if needed


tqla

Recommended Posts

 

Hello. My code reads like this:

 

echo "Your discount is: $" . $discount;

 

Which in this case ends up reading like this

 

"Your discount is: $19.8"

 

As you can see, the value of $discount will omit the hundredths place if it is a zero. If it is not a zero it shows the actual number.

 

Is there any way to add a zero to the hundredths place if this is the case?

 

Thank you.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.