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 Rocha
  • 9,510
  • 18
  • 69
  • 121
  • 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
  • 37,924
  • 7
  • 65
  • 84
  • 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
  • 62,299
  • 10
  • 67
  • 91