So this code will make a while loop that will subtract 1 from the score at each loop until it reaches 6500 in score.
<?php
$i = $rows[score];
while ($i != 6500) {
echo $i--;
}
?>
But this is not what I want. What I want is to divide the score with 2 at each loop, until it reaches 6500.
Edited the code
<?php
$i = $rows[score];
$j = $i;
while ($i <= 6500) {
echo $j;
$j = $j/2;
$i--;
}
?>
Best to use <=
comparision as the division is unlikely to hit 6500.
$i = $rows[score];
while ($i <= 6500) {
echo $i = $i /2;
}
$i = $rows[score];
while ($i <= 6500) {
$i /= 2;
echo $i;
}
Something like this, maybe?
while( $i > 6500 ){
$i /= 2;
}
echo $i;