П О Р Т А Л                            
С Е Т Е В Ы Х                          
П Р О Е К Т О В                        
  
                                                 
Главная

О проекте

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

MySQL

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

Хостинг

Другое







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

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

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

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

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

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

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

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

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

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

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

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



 
 



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

elseif

elseif, as its name suggests, is a combination of if and else. Like else, it extends an if statement to execute a different statement in case the original if expression evaluates to FALSE. However, unlike else, it will execute that alternative expression only if the elseif conditional expression evaluates to TRUE. For example, the following code would display a is bigger than b, a equal to b or a is smaller than b:

<?php
if ($a > $b) {
    echo
"a is bigger than b";
} elseif (
$a == $b) {
    echo
"a is equal to b";
} else {
    echo
"a is smaller than b";
}
?>

There may be several elseifs within the same if statement. The first elseif expression (if any) that evaluates to TRUE would be executed. In PHP, you can also write 'else if' (in two words) and the behavior would be identical to the one of 'elseif' (in a single word). The syntactic meaning is slightly different (if you're familiar with C, this is the same behavior) but the bottom line is that both would result in exactly the same behavior.

The elseif statement is only executed if the preceding if expression and any preceding elseif expressions evaluated to FALSE, and the current elseif expression evaluated to TRUE.


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


 





Copyright © 2005-2011 Project.Net.Ru


Скрытый маркетинг, уникальный семинар включающий практикум от эксперта.