PHP 5.3.0 提供了广泛的新特性:
const
关键词声明
常量。
?:
。
<?php
class C {
public static $foo = 123;
}
$a = "C";
echo $a::$foo;
?>
以上例程会输出:
123
<?php
class MyCustomException extends Exception {}
try {
throw new MyCustomException("Exceptional", 112);
} catch (Exception $e) {
/* Note the use of the third parameter to pass $e
* into the RuntimeException. */
throw new RuntimeException("Rethrowing", 911, $e);
}
?>