What is the difference in using the @ character with ini_set, a built-in function in PHP?

In one of my project configuration settings, I observed the following two lines at the beginning of the file:

@ini_set('memory_limit', '-1'); @set_time_limit(0); 

My doubt is, what is the difference in the two lines of code above and the following lines of code?

 ini_set('memory_limit', '-1'); set_time_limit(0); 

What is the @symbol prefix in PHP?

Please provide me with detailed information and answer the question.

Thanks in advance.

+6
source share
2 answers

@in php is just for fixing bugs.

eg:

 <?php $x = 5; $y = @$z; 

so $ y will be null

if you delete @ it throws an error.

+3
source

Error management statements

PHP supports one error control statement: the at sign (@). When adding an expression to PHP, any error messages that may be generated by this expression will be ignored.

Error control statements

+1
source

Source: https://habr.com/ru/post/980143/


All Articles