Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does @ means before include or require

i wonder what does @ means when we use it before include or require in php ?!

such as :

@include('block.php');

maybe its a noob question , but i need to know it guys ?!

so sorry for that

like image 507
Mac Taylor Avatar asked Dec 13 '22 22:12

Mac Taylor


1 Answers

@ is the shut-up operator. If something goes wrong, no error message will be shown. It's usually a bad practice to use it; first because error messages happen for a good reason, and second because it's ridiculously slow for what it does.

It's roughly equivalent to wrapping the statement in:

$oldErrorLevel = error_reporting(0);
// the statement
error_reporting($oldErrorLevel);

Here's the link to the PHP manual page documenting it.

like image 87
zneak Avatar answered Dec 28 '22 01:12

zneak