Jump to content

[SOLVED] PHP Division rounding to 2 decimal places?


Padgoi

Recommended Posts

Hi, I have this function but it's displaying a VERY long number.  I want to limit the number to 2 decimal places.  How would I go about doing this?  Any help is appreciated.

 

$total = $field / $get_topics[0];
$this->output .= "\t<td><font face=arial size=1/>$total</font></td>\n";

 

Thanks!

Sorry guys, my PHP is kinda weak.  I'm trying this but it's not working.

 

$total = $field / $get_topics[0];
round($total, 2);
$this->output .= "\t<td><font face=arial size=1/>$total</font></td>\n";

 

Where exactly do I put the round() function?

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.