php`:`符号用法

jol*_*olt 0 php

我想知道,有什么案例:可供使用?

我只知道:

if(expression):
    // do Something
endif;

while(expression):
    // and others: `for` `foreach` etc.
endwhile;
Run Code Online (Sandbox Code Playgroud)

还有其他用途吗?

Amb*_*ber 5

PHP为其某些控制结构提供了另一种语法; 即if,while,for,foreach,和switch.在每种情况下,替代语法的基本形式是将开括号更改为冒号(:)和闭括号到endif;,endwhile;,endfor;,endforeach;,或endswitch;,分别.

http://us3.php.net/manual/en/control-structures.alternative-syntax.php