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

О проекте

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

MySQL

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

Хостинг

Другое








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

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

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

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

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

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

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

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

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

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

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

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



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





Руководство по 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