PDA

View Full Version : Got a Q


i am coo man
Fri 1st Aug '03, 10:25pm
Ok so whats with the @ sign?

Like when you do @set_cookie('yay','yay', time()+10000);

?

Whats that extra @ sign do. I notice that its used for headers and DB connections to.

Thanks for any help!

Floris
Fri 1st Aug '03, 10:26pm
If there is an error, it will not echo it out on the screen.

i am coo man
Fri 1st Aug '03, 11:54pm
AHA!!!!!!! That makes sense now, thanks a bunch!

Chen
Sat 2nd Aug '03, 9:34am
Just bear in mind that if the error is critical (which means the script has to stop execution), suppressing the error will only prevent the output - the script will still exit.

i am coo man
Sat 2nd Aug '03, 9:39am
Yeah, actually I don't see a lot of use for it, I mean isn't it better to at least know the error is there and just fix it right of the bat?

Heh fixing login problems is hard enough without having to first find out that there IS a cookie error at all! :p

Floris
Sat 2nd Aug '03, 10:06am
It is cool, because you can now catch errors and show them as you want, without getting 500 error msgs for a loop that goes wrong. Stuff like that. It also helps not showing numbers on the screen that are only to be used in functions, saves getting useless stuff posted. (erhm, i don't know how to properly explain that)

Chen
Sat 2nd Aug '03, 10:09am
It is cool, because you can now catch errors and show them as you want, without getting 500 error msgs for a loop that goes wrong. Stuff like that. It also helps not showing numbers on the screen that are only to be used in functions, saves getting useless stuff posted. (erhm, i don't know how to properly explain that)
No, for that you would use something like set_error_handler() and not the @ operator.

Floris
Sat 2nd Aug '03, 10:12am
I understand, but .. you can supress it there and catch it in the function, like you mentioned. I know it won't be like @(); :P

Chen
Sat 2nd Aug '03, 10:14am
I understand, but .. you can supress it there and catch it in the function, like you mentioned. I know it won't be like @(); :P


There is no need to suppress the error using the @ operator because if you have a custom error handler, PHP itself will not output the error information (your error handler is responsible for doing that).

Floris
Sat 2nd Aug '03, 10:39am
Thank you for explaining !