note 112528 deleted from language.exceptions by cmb
| From: | cmb@php.net | Date: | Tue, 25 Aug 2015 00:31:49 +0000 |
| Subject: | note 112528 deleted from language.exceptions by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-203459@lists.php.net to get a copy of this message | ||
Note Submitter: sander at rotorsolutions dot nl
----
Just an example why finally blocks are usefull (5.5)
<?php
//without catch
function example() {
try {
//do something that throws an exeption
}
finally {
//this code will be executed even when the exception is executed
}
}
function example2() {
try {
//open sql connection check user as example
if(condition) {
return false;
}
}
finally {
//close the sql connection, this will be executed even if the return is called.
}
}
?>