Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@ symbol before php function [duplicate]

Tags:

php

I'm don't understand what mean @ symbol before php function for example: @mysql_query(), if someone know please explain for me.

like image 885
Wizard Avatar asked Sep 26 '12 16:09

Wizard


People also ask

What does <=> mean in PHP?

The spaceship operator <=> is the latest comparison operator added in PHP 7. It is a non-associative binary operator with the same precedence as equality operators ( == , !=

What means & before variable PHP?

To assign by reference, simply prepend an ampersand (&) to the beginning of the variable which is being assigned (the source variable).

What is the use of & in PHP?

The & is used to get a reference to a variable. It's similar to references in other languages like C++, with some significant differences. See the PHP Manual's section on references. Your thinking of the @ symbol.

Which symbol tells PHP to support any errors generated by any function?

The at sign (@) is used as error control operator in PHP. When an expression is prepended with the @ sign, error messages that might be generated by that expression will be ignored.


2 Answers

It's the error suppression operator, normally not a good idea to use it as you should be trapping errors cleanly rather than simply hiding them

like image 100
Mark Baker Avatar answered Oct 12 '22 15:10

Mark Baker


It will silent error messages. See http://php.net/manual/en/language.operators.errorcontrol.php

like image 22
mbinette Avatar answered Oct 12 '22 15:10

mbinette