I do this:

<?
$num = 5;
echo $num / 100;
?>

The result is: 0.05

I want to show: 5%

Is there a function that converts decimals to percentages?

    you already have the integer. why do you need to divide by 100 to get the percent?

    $num = 5;
    echo $num . '%';
    

      I just posted that as an example. I intend to have some other math queries that are not as straight-forward.

      For example:

      <? echo $var1/$var2; ?>
      

      The variables are pulled from a db. Var2 is the total of all transactions processd for one day, while var1 is a total of successful transactions.

      See what I mean?

        Good point, all I needed to do was multiply the variable by 100.

        thanks!

          Write a Reply...