Monday, 19 August 2013

Change Variable Value in While Looping

Change Variable Value in While Looping

I want to know how to modify variable value each time while looping.
Please guide me what i am doing wrong in below coding.
$amount = 500;
while ($amount > 0) {
$a = $amount - 50;
echo $a . "<br>";
}
I am receiving this:
450 450 450 450 450 450 450 450 450
But i want that:
450 400 350 300 250 200 150 100 50

No comments:

Post a Comment