WHILE LOOP IN PHP URDU

How to use while loop in php:
very easy to use while loop in php
php video tutorials in urdu

while loop in php 

you will use while loop to do some work continuously until some condition comes
example:
suppose you have 10 rupees and you are happy with this  money.
$r=10;

you go to some shop.pay 1 rupee to buy something..
now you have 9 rupee left.

buy some other 1 rupee
now you have 8 rupee
.
.
.
at the end you will have 0 rupee . and now you can not buy anything more.. so this is the condition of while loop that when $r==0 you must leave the shop if not continue  ......


[code]

<?php

$r=10; //you have 10 rupees

while ($r!=0)  // $r is not zero then go inside
{

echo "you have ".$r." rupee left";
echo "...buy something<br/> "; //<br/> use to new line

$r--; // minus one value from it like $r=$r- 1;
}

 echo "now you are out of while loop because r =0 now"

?>


[/code]

0 comments: