I’m interested in how could I create my own function allowing it to be executed without error logging, but only if executed with @ operator, like @function();?
Function:
public function query($sql, $id = false){
$this->query_id = mysqli_query($this->connection, $sql);
if(!$this->query_id){
// I want to suppress this error call here...
psyo::error("Error while executing query (sql: {$sql}).");
return NULL;
}else{
$this->result = mysqli_store_result($this->connection);
$this->affected = mysqli_affected_rows($this->connection);
return $id ? $this->query_id : $this;
}
}
P.S. I’m using my own error handling class, and it isn’t operated with error_log(); or so.
Thanks in advance!
The
@operator is just shorthand for the following:In other words,
@temporarily sets the error reporting level to 0. While you can’t check whether or not the current error reporting level is due to an@operator or not, you can check the current error reporting level, and bypass your own error handling if the level is 0.What you probably want is this: