When reading PHP source codes, you may have found the symbol @ used sometimes. So, what's @ in PHP?
@ is an error controlling operator. If you prepend it to a PHP expression, the expression won't be throwing any errors. All the errors will be ignored. (Remember it as the "shut-up" operator)
<?php
$name = $_POST['name'];
$name = @$_POST['name'];
In this example, the first expressiom will throw an error if there's no post param "name" is set. But, the second one won't be throwing any error.
Here's another example
<?php
$i = 9;
echo @$i / 0; // Error thrown
echo @($i / 0); // No error
Simply, @ is affects the expression right after it. (By using parentheses, you can group several expressions into one)
Besides all of these, it is not a good practise to use @ as it shuts up PHP.
However, I found some interesting uses of the @ operator while reading some source codes.
// PHPMailer() library uses this
@mail($to, $subject, $body, $header);
// from CODOForum
// TIP: Apache sets the Server variable HTTPS to "on" when requested via HTTPs
define('PROTOCOL', @$_SERVER['HTTPS'] === 'on' ? 'https://' : 'http://');
If you know more uses of the @ operator please let me know via the comments below.
Thank you for reading.