0

Possible Duplicate:
What is the use of @ symbol in php?

I been working with PHP right now but a question pops in my mind what the @ sign means? I saw it always before method or functions calls. and I try to remove them there is no changes. Can anyone explain me what is the purpose of this @ sign??

 @imagecreatefromjpeg($file);
Community
  • 1
  • 1
Netorica
  • 18,523
  • 17
  • 73
  • 108
  • 6
    It makes you unable to find problems with your scripts. – Ignacio Vazquez-Abrams Oct 07 '11 at 02:25
  • See also http://stackoverflow.com/questions/136899/suppress-error-with-operator-in-php – Michael Berkowski Oct 07 '11 at 02:28
  • i didn't notice someone already asked it... thanks everyone... but suppressing errors is not a must during development phase ^_^ – Netorica Oct 07 '11 at 02:30
  • See also "[http://php.net/@](http://php.net/@)". Take care that it only suppresses the error *display* and only with the *default* error handler. Unlike e.g. isset-suppressed messages they can easily be brought back via for example `set_error_handler("var_dump");` – mario Oct 07 '11 at 02:36

3 Answers3

3

It suppresses error messages - see http://us3.php.net/manual/en/language.operators.errorcontrol.php in the PHP manual.

Sam Casil
  • 938
  • 1
  • 11
  • 16
3

Simply put, @ allows you to suppress any errors that arise from the call to a function.

Jacob Relkin
  • 161,348
  • 33
  • 346
  • 320
  • so this is an alternative in using try and catch statement? where in catch do nothing to suppress the error? – Netorica Oct 07 '11 at 02:26
  • 2
    @Mahan: no, it is not alternative – zerkms Oct 07 '11 at 02:26
  • 1
    `@` suppresses errors, not exceptions. Errors and exceptions are, unfortunately, two completely separate systems in PHP. –  Oct 07 '11 at 02:47
1

I believe it suppresses error reporting.

wmfox3
  • 2,141
  • 4
  • 21
  • 28