Works same as trigger_error, in fact, it is the alias of trigger error.
function myFunction($arg)
{
if (is_numeric($arg)) {
echo 'Good';
} else {
user_error(__FUNCTION__ . " Requires a numeric argument, You have given " . gettype($arg) . " Value: {$arg}");
}
}
myFunction(3);
myFunction('a');
/************************
* Output
*************************/
>> Good
>> Notice: myFunction Requires a numeric argument, You have given string Value: a