I am a newbie in PHP.
I do not know the meaning of @, for example:
$key = @$_REQUEST['key'];
I have searched in google but can not find anything.
Some help me! Please !
I am a newbie in PHP.
I do not know the meaning of @, for example:
$key = @$_REQUEST['key'];
I have searched in google but can not find anything.
Some help me! Please !
The @
symbol tells the function to fail silently instead of dumping some sort of error message. It is listed under error control operators in the PHP manual.
It suppresses any errors that the line would normally produce. In this case if the key doesn't exist, an error will occur but the error text will be silenced.
It suppresses warnings in PHP. In that example it could be used to suppress and undefined index warning, if $_REQUEST['key']
doesn't exist. It's usually better practice to write:
$key = isset($_REQUEST['key']) ? $_REQUEST['key'] : 'default value for key here';