Manußl PHP | ||
---|---|---|
P°edchßzejφcφ | Kapitola 11. ╪φdicφ struktury | Dal╣φ |
PHP nabφzφ alternativnφ syntaxi pro n∞kterΘ z °φdicφch struktur, jmenovit∞ if, while, for, foreach, a switch. V ka╛dΘm z t∞chto p°φpad∙ je zßkladnφm formßtem alternativnφ syntaxe zßm∞na otvφracφ zßvorky za dvojteΦku (:) a uzavφracφ zßvorky za endif;, endwhile;, endfor;, endforeach;, resp. endswitch;.
In the above example, the HTML block "A = 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:
P°edchßzejφcφ | Dom∙ | Dal╣φ |
elseif | Nahoru | while |