Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between define(...) and @define(...)

Tags:

php

Quick question, what is the difference between the following two declarations:

define('I_LIKE_AT_SIGNS', false);

and

@define('I_LIKE_AT_SIGNS', true);

I.e. what does the @-sign do?

like image 785
Egil Hansen Avatar asked Jul 10 '11 18:07

Egil Hansen


People also ask

What's the difference between define and definition?

What is a Definition. The Oxford dictionary defines definition as “an exact statement or description of the nature, scope, or meaning of something” and the Merriam-Webster defines it as “a statement expressing the essential nature of something”. A definition is usually the meaning given in a dictionary.

What do we mean by define?

Definition of define transitive verb. 1a : to determine or identify the essential qualities or meaning of whatever defines us as human. b : to discover and set forth the meaning of (something, such as a word) how the dictionary defines "grotesque"

What's an example of define?

6. The definition of define is to describe the meaning or character of something. An example of define is when you tell someone what a word means. An example of define is when you set clear rules for living in your house. verb.


2 Answers

The @ symbol is PHP's only error control operator, and when prepended to any expression, all errors associated with that expression are suppressed.

In this case, any errors associated with your define expression will be suppressed.

Use of the @ error suppression technique generally isn't encouraged or recommended. Instead, it's much better to use other error capture techniques so you can detect and handle the error.

like image 171
Mark Elliot Avatar answered Oct 17 '22 03:10

Mark Elliot


It prevents error messages I believe.

"In PHP, it is used just before an expression to make the interpreter suppress errors that would be generated from that expression" -- From wikipedia

Use with Caution!!

like image 25
tcnarss Avatar answered Oct 17 '22 03:10

tcnarss