Jump to content

[SOLVED] Need help with converting % to dec.


mazman13

Recommended Posts

Ok I'm writing a CSI program for a body shop and need to be able to take % from the data they receive.

 

This works well:

 

EI:

 

$yes = "30";

$total = "170";

 

$newtotal = ($yes * 100) / $total;

 

echo"$newtotal%";

 

Answer is: 17.647058823529411764705882352941%

 

How can I get the answer to just get:

17.6%?

 

Any ideas to limit this string?

Thanks

Link to comment
https://forums.phpfreaks.com/topic/71812-solved-need-help-with-converting-to-dec/
Share on other sites

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.