summaryrefslogtreecommitdiff
path: root/Zend/ZEND_CHANGES
diff options
context:
space:
mode:
authorSebastian Bergmann <sebastian@php.net>2002-01-14 12:14:18 +0000
committerSebastian Bergmann <sebastian@php.net>2002-01-14 12:14:18 +0000
commit7e1957044d7d9e1b58b0bd862fa625a36cb400f7 (patch)
tree8e53e38a52f0d6189239103b618dfe020a897258 /Zend/ZEND_CHANGES
parent0544cdca3a87cad721451ea9d234c348cfbadf03 (diff)
downloadphp-git-7e1957044d7d9e1b58b0bd862fa625a36cb400f7.tar.gz
Update Exceptions example.
Diffstat (limited to 'Zend/ZEND_CHANGES')
-rw-r--r--Zend/ZEND_CHANGES29
1 files changed, 15 insertions, 14 deletions
diff --git a/Zend/ZEND_CHANGES b/Zend/ZEND_CHANGES
index 49e5e239de..f17f4e3003 100644
--- a/Zend/ZEND_CHANGES
+++ b/Zend/ZEND_CHANGES
@@ -321,30 +321,31 @@ Changes in the Zend Engine 2.0
<?php
class MyException {
- function MyException($_error) {
- $this->error = $_error;
+ function __construct($exception) {
+ $this->exception = $exception;
}
- function getException() {
- return $this->error;
+ function Display() {
+ print "MyException: $this->exception\n";
}
}
- function ThrowException() {
- throw new MyException("'This is an exception!'");
+ class MyExceptionFoo extends MyException {
+ function __construct($exception) {
+ $this->exception = $exception;
+ }
+
+ function Display() {
+ print "MyException: $this->exception\n";
+ }
}
try {
- } catch ($exception) {
- print "There was an exception: " . $exception->getException();
- print "\n";
+ throw new MyExceptionFoo("Hello");
}
- try {
- ThrowException();
- } catch ($exception) {
- print "There was an exception: " . $exception->getException();
- print "\n";
+ catch (MyException $exception) {
+ $exception->Display();
}
?>