П О Р Т А Л                            
С Е Т Е В Ы Х                          
П Р О Е К Т О В                        
  
Поиск по сайту:
                                                 
Главная

О проекте

Web-мастеру
     HTML & JavaScript
     SSI
     Perl
     PHP
     XML & XSLT
     Unix Shell

MySQL

Безопасность

Хостинг

Другое








Самое читаемое:

Учебник PHP - "Для Чайника".
Просмотров 5762 раз(а).

Иллюстрированный самоучитель по созданию сайтов.
Просмотров 7997 раз(а).

Учебник HTML.
Просмотров 4716 раз(а).

Руководство по PHP5.
Просмотров 1333 раз(а).

Хостинг через призму DNS.
Просмотров 6647 раз(а).

Подборка текстов стандартных документов.
Просмотров 57353 раз(а).

Учебник PHP - Самоучитель
Просмотров 4981 раз(а).

Документация на MySQL (учебник & справочное руководство)
Просмотров 11064 раз(а).

Внешние атаки...
Просмотров 6727 раз(а).

Учебник PHP.
Просмотров 4009 раз(а).

SSI в примерах.
Просмотров 1049 раз(а).



 
 
| Добавить в избранное | Сделать стартовой | Помощь





Руководство по PHP
Пред. Глава 16. Control Structures След.

while

while loops are the simplest type of loop in PHP. They behave just like their C counterparts. The basic form of a while statement is:

while (expr)
statement

The meaning of a while statement is simple. It tells PHP to execute the nested statement(s) repeatedly, as long as the while expression evaluates to TRUE. The value of the expression is checked each time at the beginning of the loop, so even if this value changes during the execution of the nested statement(s), execution will not stop until the end of the iteration (each time PHP runs the statements in the loop is one iteration). Sometimes, if the while expression evaluates to FALSE from the very beginning, the nested statement(s) won't even be run once.

Like with the if statement, you can group multiple statements within the same while loop by surrounding a group of statements with curly braces, or by using the alternate syntax:

while (expr):
statement
...
endwhile;

The following examples are identical, and both print numbers from 1 to 10:

<?php
/* example 1 */

$i = 1;
while (
$i <= 10) {
    echo
$i++;  /* the printed value would be
                    $i before the increment
                    (post-increment) */
}

/* example 2 */

$i = 1;
while (
$i <= 10):
    echo
$i;
    
$i++;
endwhile;
?>


Пред. Начало След.
Alternative syntax for control structures Уровень выше do-while


Если Вы не нашли что искали, то рекомендую воспользоваться поиском по сайту:
 





Copyright © 2005-2016 Project.Net.Ru