Networking, Programming and Graphics Tutorials

How to use PHP while operator [1/2]

Type: Code Networking, Programming and Graphics Tutorials
How to use PHP while operator
Level: Beginner Networking, Programming and Graphics Tutorials 
How to use PHP while operator
Date: 2007-Apr-11
How to use PHP while operator
Visited: 2249 times
How to use PHP while operator
Rating: How to use PHP while operator
How to use PHP while operator
Author: Ivory Morhuld

This tutorial will show you how to use PHP while operator

while loops are the simplest type of loop in PHP. They behave just like their C counterparts.

Next example will show you simple code for printing the digits from 10 to 1.

<?php
$k
=10;
while(
$k!=0) {
    echo 
"$k\n";
    
$k--;
}
?>
The result from above PHP script will be:

10
9
8
7
6
5
4
3
2
1
Networking, Programming and Graphics Tutorials - How to use PHP while operator [1/2] - Networking, Programming and Graphics Tutorials

Need a specific tutorial? Do not hesitate and submit a request!
Related Tags: precedence of operator or hierarchy of operator of C++  php for while operator  php AND operator  php while operator  "while operator"  php while operator  while operator  & * operator in c++  php while +operator  operator c++ ^= += -= *= /=  while operator ftp  while operator php  while operator php  What is an operator in c++  php operator while  while operator =  while = operator  php while operator OR  php for operator  overloading the == operator in c++