mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
- Added new example
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@257840 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
03f9b0759c
commit
5b79026e5c
1 changed files with 37 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.5 $ -->
|
||||
<!-- $Revision: 1.6 $ -->
|
||||
<chapter xml:id="language.exceptions" xmlns="http://docbook.org/ns/docbook">
|
||||
<title>Exceptions</title>
|
||||
|
||||
|
@ -58,7 +58,43 @@ Hello World
|
|||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
<example>
|
||||
<title>Nested Exception</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
class MyException extends Exception { }
|
||||
|
||||
class Test {
|
||||
public function testing() {
|
||||
try {
|
||||
try {
|
||||
throw new MyException('foo!');
|
||||
} catch (MyException $e) {
|
||||
/* rethrow it */
|
||||
throw $e;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
var_dump($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$foo = new Test;
|
||||
$foo->testing();
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
&example.outputs;
|
||||
<screen>
|
||||
<![CDATA[
|
||||
string(4) "foo!"
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
|
||||
<sect1 xml:id="language.exceptions.extending">
|
||||
<title>Extending Exceptions</title>
|
||||
<para>
|
||||
|
|
Loading…
Reference in a new issue