summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/ZEND_CHANGES37
1 files changed, 26 insertions, 11 deletions
diff --git a/Zend/ZEND_CHANGES b/Zend/ZEND_CHANGES
index 57b02ea677..5f399ba4ec 100644
--- a/Zend/ZEND_CHANGES
+++ b/Zend/ZEND_CHANGES
@@ -47,22 +47,37 @@ Changes in the Zend Engine 2.0
Example
- try {
- code
+ <?php
+ class MyException {
+ function MyException($_error) {
+ $this->error = $_error;
+ }
+
+ function getException() {
+ return $this->error;
+ }
+ }
- if (failure) {
- throw new MyException(Failure);
+ function ThrowException() {
+ throw new MyException("'This is an exception!'");
}
- code
- } catch ($exception) {
- handle exception
+ try {
+ } catch ($exception) {
+ print "There was an exception: " . $exception->getException();
+ print "\n";
+ }
- throw $exception; // Re-throw exception.
- }
+ try {
+ ThrowException();
+ } catch ($exception) {
+ print "There was an exception: " . $exception->getException();
+ print "\n";
+ }
+ ?>
- Old code that does not use exceptions will run without
- modifications.
+ Old code that does not define user-space functions 'catch',
+ 'throw' and 'try' will run without modifications.
* Namespaces.