Home Tutorial Php Phpbasics Tutorial PHP Trigger Error

 
 

PHP Trigger Error
Posted on: March 5, 2010 at 12:00 AM
In the current tutorial we will study about trigger error method, This method is used to trigger an user level error message, it can be displayed along with the built-in-error handler, or with a user defined function. Along with it we will study what is the functionality of it, how it should be implemented etc.

PHP Trigger Error

PHP trigger_error generates an error, warning, notice message. Basic format of the trigger_error is as follows:

boolean trigger_error ( string $error_message <, int $error_type = E_USER_NOTICE >)

The return data type of this method is Boolean, first argument is necessary to mention and the next one is optional (that's why it is enclosed within angular bracket )

This method is used to trigger an user level error message, it can be displayed along with the built-in-error handler, or with a user defined function.

Example of PHP Trigger Error Handling:

<?php

$div=0;

if($div==0){

trigger_error("Cannot divide by zero");

}

?>

Output:

Notice: Cannot divide by zero in ../trigger_error.php on line 4

 

Related Tags for PHP Trigger Error:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.