我想知道,有哪些:使用案例?
我只知道:
if(expression):
// do Something
endif;
while(expression):
// and others: `for` `foreach` etc.
endwhile;
还有其他用途吗?
我想知道,有哪些:使用案例?
我只知道:
if(expression):
// do Something
endif;
while(expression):
// and others: `for` `foreach` etc.
endwhile;
还有其他用途吗?
PHP 为它的一些控制结构提供了另一种语法;即 ,
if,while,for,foreach和switch。在每种情况下,备用语法的基本形式是将左大括号更改为冒号 (:),将右大括号分别更改为endif;,endwhile;,endfor;,endforeach;, orendswitch;。
http://us3.php.net/manual/en/control-structures.alternative-syntax.php
三元条件:($a == $b) ? true : false.
类内的静态调用:self::$a.
静态方法调用:MyClass::MyMethod(),
类内的静态变量:MyClass::MyVariable
父方法调用:parent::hello()
switch将其用于case 123:和default:。
::用于访问静态类成员。
它也用作三元运算符“?:”的一部分。