Percentages in PHP

edited May 2007 in Vanilla 1.0 Help
First of all let me say that, as a student in elementary school I had problems with mathematics.

Secondly, I know very little PHP and what I do know is hacked from other sources.

The problem...
    I have 130 people visit my site.
    65 of them have made comments.

Now even I know that's 50% of them, but what equation in PHP would I use to work it out?

Posted: Thursday, 3 May 2007 at 1:16PM

Comments

  • (65/130) * 100
  • Thanks mate, the formula wasn't the problem, it was the syntax, structure and the rounding of the decimals.
    In case anyone else is interested...
    <?php $visitors = 130; $commentors = 65; echo 'Visitors: '.$visitors; echo'<br>'; echo 'Commenters: '.$commentors; echo'<br>'; $percy = round(($commentors/$visitors)*100, 0); echo $percy.'% of visitors have made comments'; ?>

    Posted: Thursday, 3 May 2007 at 2:07PM

  • excellent job Wanderer: i could probably use this.
This discussion has been closed.