How to use user error in PHP

This article describe about user_error() Function in PHP.
  • 1431

user_error() Function

This function create user define error message.

This function generate the trigger an error at a use-defined condition. And used with the built-in error handler, or user specified 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

user_error (error_message, error_type)

Example

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

Output

pic24.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

© 2020 DotNetHeaven. All rights reserved.