Here is the formula:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | <?php $number1 = 8; $number2 = 4; $total_votes = 12; $calculate_nr_1 = ($number1/$total_votes)*100; echo round($calculate_nr_1, 2).'%'; echo '<hr>'; $calculate_nr_2 = ($number2/$total_votes)*100; echo round($calculate_nr_2, 2).'%'; ?> |
You can add as many numbers as you want.
If you need more help, leave in the comments, I always read them.