How to use trigger error in PHP

This article describe about trigger_error() function in PHP.
  • 1338

trigger_error() function

This function create user define error message.

This function is used to trigger an error message at a user_defined condition. and used with the built-in error handler, or also user-defined function set by the set_error_handler() function.

It is most useful  function to display user-define error on the define error.

On unvalid user define error return FALSE otherwise TRUE.

Syntax

trigger_error (error_message, trigger_type)

Example

<html>
<body>
<?php
$test=2;
if ($test>1)
{
trigger_error("A custom error has been triggered");
}
?>
</body>
</html>

Output

pic23.jpg

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.