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

О проекте

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

MySQL

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

Хостинг

Другое








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

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

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

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

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

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

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

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

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

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

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

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



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





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