Page 1 of 1

what does At (@) do actually

Posted: Thu Sep 30, 2004 1:25 am
by harsha
I know that @ is used to suppress error messages
can i use some thing like this

@die("Error appears");

or @myfunc($var) or die("error");

function myfunc($var){
if($var < 1)
echo "error";
}

can I use some thing like this

:roll:

Posted: Thu Sep 30, 2004 1:35 am
by Sevengraff
@ wont suppress the message from die(), but it can work the way you want in myfunc if you use [php_man]set_error_handler[/php_man] or [php_man]trigger_error[/php_man].

if instead of doing

Code: Select all

echo "Error!";
you did

Code: Select all

trigger_error("Error!", E_USER_ERROR);
then it would work as intended.