In this case, the @
will suppress the regular PHP database connection error (which may contain sensitive information). In case of a connection error, the "or die" part will be executed, failing with a generic error message. The line is probably copied from a "quick and dirty" example.
Using the error suppression operator @
is considered bad style, especially when other forms of error handling are missing. It complicates debugging - how can you find out about in error without any indication that it occured? In a production system it's better to log all errors to a file and suppress the rendering of errors on the page. You could do that in the php.ini
file or (if you are on a shared host and not allowed to make config changes) with the following code.
ini_set('display_errors', false);
ini_set('log_errors', true);
ini_set('error_log', '/var/log/apache/php-errors.log');