PHP 5.3.0 offers a wide range of new features:
const
keyword.
?:
.
<?php
class C {
public static $foo = 123;
}
$a = "C";
echo $a::$foo;
?>
Das oben gezeigte Beispiel erzeugt folgende Ausgabe:
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);
}
?>