Forum Moderators: coopster

Message Too Old, No Replies

what is the @ sign used for in php

         

sdave

7:28 am on Mar 23, 2004 (gmt 0)

10+ Year Member



I see the @ sign being used in some sample scripts i'm downloading. What is the difference when a function has or does not have the @ sign in front of it. Thanks

Dave

thing3b

10:51 am on Mar 23, 2004 (gmt 0)

10+ Year Member



You can preface a (builtin php?) function call with an @ sign, as in:

@foo();

This will supress the injection of error messages into the data stream output to the web client. You might do this, for example, to supress the display of error messages were foo() a database function and the database server was down. However, you're probably better off using php configuration directives or error handling functions than using this feature.


User comment on [nz.php.net...]

Nova Reticulis

4:38 pm on Mar 24, 2004 (gmt 0)

10+ Year Member



Notice that this trick doesn't work with foreach()!