Wednesday, October 24, 2012

PHP Do While Tutorial with Working Example

On reaching the control to do statement, the program proceeds to evaluated the body of the loop first. At the end of the loop, the test-condition in the while statement is evaluated,so it is categorized as post tested loop.
The basic format of do while() statement is:
      body of the loop

Lets have a working example
a program to enter a number and check entered number is Armstrong or Not (153 is a Armstrong number).                
if(isset($_POST['b1'])) {
                                 $msg="Not Armstrong";
                <form action="" method="post">
                Enter Number<input type="text" name="t1"><br>
                Status<input type="text" value="<?php echo $msg;?>"><br>
                <input type="submit" name="b1" value="Check">

Delicious Save this on Delicious

No comments :

Post a Comment

If you have any Question , Suggestion or idea then please comment regarding the post.