1

While reading the php documentation on the mysqli functions I came across some code that I wasn't sure what it meant:

$mysqli = @new mysqli('localhost', 'fake_user', 'my_password', 'my_db');

What does the "@" mean and what is its purpose?

http://php.net/manual/en/mysqli.connect-errno.php

Robert
  • 10,126
  • 19
  • 78
  • 130
  • 1
    Possible duplication of: http://stackoverflow.com/questions/1032161/what-is-the-use-of-symbol-in-php – Malachi Jun 11 '13 at 21:06
  • you mean ignore warnings? reference would be `&` – Dave Chen Jun 11 '13 at 21:06
  • @DaveChen if you are referring to the title of question I posted as duplicate, it's not about php reference mechanism, but 'question to refer to, when asked about "what does this symbol mean in php"' – dev-null-dweller Jun 11 '13 at 21:19

2 Answers2

4

The @ suppresses errors in php.

http://php.net/manual/en/language.operators.errorcontrol.php

Schleis
  • 41,516
  • 7
  • 68
  • 87
  • 2
    better to vote to close for the duplicate than have this answered for the billionth time –  Jun 11 '13 at 21:07
1

The @ operator suppresses error messages created by the following code. In this special case, a failure to connect will not result in a logged (or displayed) error, but will most likely be caught further on.

Eugen Rieck
  • 64,175
  • 10
  • 70
  • 92