Hi Reader's,
Welcome to FindNerd, today we are going to discuss what is the use of the @ symbol in PHP ?
so basically @ symbol is an "Error Control Operators" and it's works only on expressions.
In other word we can say that this symbol is used for hiding error message.
let see in bellow example:
Suppose you are not using the "@" operator then your code will look like this:
$file = fopen($fileName, $attributes);
But when you will open file it will show not found, and It will show an error message as you are not using @ operator/symbol.
Now using "@" operator your code will look like:
$file = @fopen($fileName, $attributes);
when you will open file it will show not found, but It will not show any error message.
So the difference is only that if you are not using @ operator the error message will appear and if you are using @ operator the error message will not appear
0 Comment(s)