Register|Login

Have a question? Click here to ask the community.

Tutorial 15 – While Loop

| In: 15. While Loop | 7,421 views

Video Tutorial


Video Source Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
//File Description: PHP While Loop
 
/*
while (this condition is true) {
    execute this code
}
*/
 
// Example
 
$counter = 1; // keeps up with the current count in loop
 
while ($counter <= 25) {
    $answer = 3 * $counter; // perform calculation
    echo "3 * $counter = $answer <hr />"; // 3 * 2 = 6
    $counter++; // add 1 to counter
}
 
echo "Welcome to The PHP Basics <br>";
?>

Comment Form

You must be logged in to post a comment.