What is the use @ symbol in PHP? | @ symbol in PHP
×


What is the use of @ in php ?

2786

The @ symbol is works as error control operator in PHP. It prevents to display error messages like notice, warning, fatal, etc generated by the particular PHP expression.

Remark: By using @ symbol we can avoid the use of isset() function to avoid variable undefined errors.

Example:

Without using @ symbol

<?php 
$var1="codingtag";
echo $var1;
echo $var2; // it will produce error because var2 is not defined.
?

Output:



After using @ symbol

<?php 
$var1="codingtag";
echo $var1;
echo @$var2; // it will not produce any error just because of @ symbol
?> 

Output:




Best WordPress Hosting


Share:


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price



Leave a Reply


Comments
    Waiting for your comments