WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Sets a user-defined exception handler function

set_exception_handler

(PHP 5)

set_exception_handler Sets a user-defined exception handler function

Description

string set_exception_handler ( callback $exception_handler )

Sets the default exception handler if an exception is not caught within a try/catch block. Execution will stop after the exception_handler is called.

Parameters

exception_handler

Name of the function to be called when an uncaught exception occurs. This function must be defined before calling set_exception_handler(). This handler function needs to accept one parameter, which will be the exception object that was thrown.

Return Values

Returns the name of the previously defined exception handler, or NULL on error. If no previous handler was defined, NULL is also returned.

Examples

Example #1 set_exception_handler() example

<?php
function exception_handler($exception) {
  echo 
"Uncaught exception: " $exception->getMessage(), "\n";
}

set_exception_handler('exception_handler');

throw new 
Exception('Uncaught Exception');
echo 
"Not Executed\n";
?>

See Also


Setting up multiple virtual servers and host headers on IIS4
Categories : WinNT, IIS, Web Servers
Database and Recordset classes fo SyBASE Usage is obvious.
Categories : Sybase, Databases, PHP Classes, PHP
A PHP function to force a browser to download a given file in the web server. It's also possible to set the max download speed via a second argument.
Categories : PHP, Filesystem



HTML_Graphs uses PHP to provide a consistent interface for creating HTML based charts. The user of the class sets up arrays that are passed to html_graph() which then takes care of all the messy HTML layout.
Categories : Graphics, Arrays, PHP, PHP Classes, Charts and Graphs
Nicely Formatted Exceptions
Categories : PHP, PHP Classes
'Ripple effect text' - This sequentially changes the case and color for a short set time period for each character in a text string. It provides a simple 'Ripple' text effect.
Categories : Java Script
This Knowledge Base article will briefly describe the steps involved to set up remote debugging for use with Visual InterDev Version 6.0
Categories : WinNT, Debugging, IIS, Web Servers
Which Storage Engine (table handler) to use with MySQL?
Categories : Databases, MySQL
Building a basic error handler with custom error types
Categories : PHP, PHP Classes, Errors and Logging
A quick way set data from a form to a function or other places where you can lose scope.
Categories : PHP, HTML and PHP, Variables
How to set the date on a Linux machine.
Categories : Linux
Change the background color of a website daily dynamically using the php date function to get the current day of the week and depending on that day, set the background color for the web page.
Categories : PHP, Date Time, Beginner Guides, Web Design
A function that generates random numbers between 0 and 1 with precision that you set
Categories : PHP, Math.
Complex paging with no resultset limit
Categories : PHP, MySQL, Databases, Output Control, HTML and PHP