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?
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?
The @
suppresses errors in php.
http://php.net/manual/en/language.operators.errorcontrol.php
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.