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

О проекте

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

MySQL

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

Хостинг

Другое








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

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

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

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

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

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

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

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

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

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

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

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



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





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

Alternative syntax for control structures

PHP offers an alternative syntax for some of its control structures; namely, if, while, for, foreach, and switch. In each case, the basic form of the alternate syntax is to change the opening brace to a colon (:) and the closing brace to endif;, endwhile;, endfor;, endforeach;, or endswitch;, respectively.

<?php if ($a == 5): ?>
A is equal to 5
<?php endif; ?>

In the above example, the HTML block "A is equal to 5" is nested within an if statement written in the alternative syntax. The HTML block would be displayed only if $a is equal to 5.

The alternative syntax applies to else and elseif as well. The following is an if structure with elseif and else in the alternative format:

<?php
if ($a == 5):
    echo
"a equals 5";
    echo
"...";
elseif (
$a == 6):
    echo
"a equals 6";
    echo
"!!!";
else:
    echo
"a is neither 5 nor 6";
endif;
?>

See also while, for, and if for further examples.



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





Copyright © 2005-2016 Project.Net.Ru