Forum Moderators: coopster

Message Too Old, No Replies

'@' before function name - significance?

I've noticed some functions in scripts are preceeded with '@'

         

AstonJay32

3:31 pm on Sep 16, 2005 (gmt 0)

10+ Year Member



I've been in the process of building my own MySQL class and in working through some tutorials I've noticed that some of the built in PHP functions are preceeded by a '@'.

Example - $result = @mysql_query("SELECT * from name");

What's the significance of this?

FlipFlops

3:33 pm on Sep 16, 2005 (gmt 0)



This is used in PHP to suppress errors. In other words, in the example you've given -- if the mySQL statement is not executed or produces any errors, no mention of it would be sent to the browser.

AstonJay32

4:02 pm on Sep 16, 2005 (gmt 0)

10+ Year Member



makes sense, thanks!

jatar_k

4:12 pm on Sep 16, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



[php.net...]