Like most of our code base, our mysql handling functions are custom built.
They work very well and include a number of logging forks.
A simplified version of our query execution function looks like this:
if(!$result=mysql_query($query)){
file_put_contents(QUERYLOG,'Query '.$query.' failed execution');
}
This is overly simplified, but you get the basic idea: If queries fail, they will be logged to a separate query log.
This is a great way of keeping track of any queries that need to be looked at.
My question is as follows:
With the above, the tiny problem is that if a query fails both our query log, AND our php log will be stamped with the error as a mysql_query (… or mysql_connect, mysql_select_db, etc …) will produce a php error.
What we want to do is surpress the php error via:
.... $result=@mysql_query($query ....
So, as far as the question goes:
Does using the @ error suppression mechanism in php cause any performance impacts if no error is produced? Or does it only affect performance if an error is produced?
I know I know, micro optimization, but as you can guess, or query execution function is used millions of times a day, so even a small performance hit is worth examining.
made a little “research”
gives
1.1205673217773E-5and if i use
$b = @$a[1];i get a bit more:1.5974044799805E-5so: yes, there is a difference, but no, you should not bother.