what does At (@) do actually

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
harsha
Forum Contributor
Posts: 103
Joined: Thu Jul 11, 2002 1:35 am
Location: Bengaluru (Bangalore) > Karnataka > India

what does At (@) do actually

Post 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:
User avatar
Sevengraff
Forum Contributor
Posts: 232
Joined: Thu Apr 25, 2002 9:34 pm
Location: California USA
Contact:

Post 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.
Post Reply