Question: how to calculate ratio of 2 numbers in php?
Answer: function getRatio($num1, $num2){
for($i = $num2; $i > 1; $i--) {
if(($num1 % $i) == 0 && ($num2 % $i) == 0) {
$num1 = $num1 / $i;
$num2 = $num2 / $i;
echo getRatio(2, 4), '<br>';
echo getRatio(2, 10), '<br>';