Tuesday, 15 August 2017
What does @ mean in PHP?
Answer
Answer
Possible Duplicate:
Reference - What does this symbol mean in PHP?
I was wondering what @ means in PHP language. I have seen people using
$connect = @mysql_query('sql query here');
Not sure why. Could someone explain it for me?
Answer
The @ operator tells PHP to suppress error messages, so that they will not be shown.
For instance, using:
$result = mysql_query("this is an invalid query");
would result in a warning being shown, telling you that the MySQL query is invalid, while
$result = @mysql_query("this is still an invalid query");
would not.
Note, however, that this is very bad programming practice as it does not make error disappear, it just hides them, and it makes debugging a heck of a lot worse since you can't see what's actually wrong with your code.
Instead of using @, you should disable just error_reporting and display_errorsdisplay_errors in php.ini
casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV
In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...
-
I'm using Simple HTML DOM to extract data from a HTML document, and I have a couple of issues that I need some help with. On the line th...
-
I've just started to learn CodeIgniter and gotten trouble with example below: My Controller: class Site extends CI_Controller ...
-
I've got a just installed ubuntu 11.10. I follow the first answer in this question. I installed: freeglut3 freeglut3-dev igor@ubuntu:~$...
No comments:
Post a Comment