Forum Moderators: coopster

Message Too Old, No Replies

@ in php

can anyone tell me it's exact purpose

         

HelenDev

4:15 pm on Jun 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I see the at sign in many php scripts I come across, but I don't know it's exact meaning and purpose. Can anyone tell me? Feel free to point me to the relevant part of the php manual.

I've had a hard time googling for '@' or 'at sign' ;)

stevenmusumeche

4:20 pm on Jun 25, 2004 (gmt 0)

10+ Year Member



It is to supress error/warning messages for the command that it preceeds.

jatar_k

4:20 pm on Jun 25, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Error Control Operators [ca2.php.net]

bcolflesh

4:21 pm on Jun 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Be careful - it also suppresses all other error messages in the file - as noted in the comments on:

[us4.php.net...]

HelenDev

4:27 pm on Jun 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for the info guys :)

So, what is the benefit of using it?

bcolflesh

4:29 pm on Jun 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not exposing server or path information to web users if your code fails.

jatar_k

5:00 pm on Jun 25, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I don't really use it much actually

It is only useful for live code that has been thoroughly tested and QA'ed.

In development I want to see all the mess of errors.

Once live, I prefer to use functions to handle errors and show nice user friendly messages yet give a full report to me in the logs.