What is this?
This is a collection of questions that come up every now and then about syntax in PHP. This is also a Community Wiki, so everyone is invited to participate in maintaining this list.
Why is this?
It used to be hard to find questions about operators and other syntax tokens.¹
The main idea is to have links to existing questions on Stack Overflow, so it’s easier for us to reference them, not to copy over content from the PHP Manual.
¹ Note: Since January 2013, Stack Overflow does support special characters. Just surround the search terms by quotes, e.g. [php] "==" vs "==="
What should I do here?
If you have been pointed here by someone because you have asked such a question, please find the particular syntax below. The linked pages to the PHP manual along with the linked questions will likely answer your question then. If so, you are encouraged to upvote the answer. This list is not meant as a substitute to the help others provided.
The List
If your particular token is not listed below, you might find it in the List of Parser Tokens.
&
Bitwise Operators or References
- What does it mean to start a PHP function with an ampersand?
- Understanding PHP & (ampersand, bitwise and) operator
- PHP "&" operator
- difference between & and && in PHP
- What does "&" mean here in PHP?
- what does & mean in this case?
- What does the & sign mean in PHP?
- What does this signature mean(&) in PHP?
- How does "&" operator work in PHP function?
- What does & in &2 mean in PHP?
- When should I use Bitwise operator?
- Is there ever a need to use ampersand in front of an object
=&
References
- Reference assignment operator in php =&
- what do "=&" / "&=" operators in php mean?
- What do the '&=' and '=&' operators do?
- What does =& mean in PHP?
- 'AND' vs '&&' as operator
- difference between & and && in PHP
- PHP: Is there a difference between operators AND and && here?
- PHP – and / or keywords
- What does the percent sign mean in PHP?
- What is the PHP operator % and how to use it in real world examples?
- What is the use of @ symbol in php?
- PHP – 'At' symbol before variable name: @$_POST
- PHP functions and @functions
- Should I use @ in my PHP code?
- What is ?: in PHP 5.3?
- What is the PHP ? : operator called and what does it do?
- ?: operator (the 'Elvis operator') in PHP
- Where can I read about conditionals done with ? and :
- Using PHP 5.3 ?: operator
??
Null Coalesce Operator (since PHP 7)
:
Alternative syntax for control structures, Ternary Operator
- What do two colons mean in PHP?
- What's the meaning of the PHP Token Name T_PAAMAYIM_NEKUDOTAYIM
- What's the difference between :: (double colon) and -> (arrow) in PHP?
- What exactly are late static bindings in PHP?
- static::staticFunctionName()
- Unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting T_NS_Separator
- What is the "->" PHP operator called and how do you say it when reading code out loud?
- where we use object operator "->" in php
- What's the difference between :: (double colon) and -> (arrow) in PHP?
- What does this PHP syntax mean: $var1->$var2
- Absolutely basic PHP question about the "-> " syntax
=>
Arrays
- What does <<<END mean in PHP?
- PHP <<<EOB
- In PHP, what does "<<<" represent?
- Using <<<CON in PHP
- What's this kind of syntax in PHP?
- php == vs === operator
- How do the PHP equality (== double equals) and identity (=== triple equals) comparison operators differ?
- PHP != and == operators
- The 3 different equals
- PHP Type-Juggling and (strict) Greater/Lesser Than Comparisons
- What does "===" mean?
- php == vs === operator
- How do the PHP equality (== double equals) and identity (=== triple equals) comparison operators differ?
- The 3 different equals
- PHP Type-Juggling and (strict) Greater/Lesser Than Comparisons
- PHP != and == operators
- Is there a difference between !== and != in PHP?
- comparing, !== versus !=
- What is the difference between <> and !=
- php operator <>
- php <> operator
- What is the difference between <> and !=
- PHP Type-Juggling and (strict) Greater/Lesser Than Comparisons
<=>
Comparison Operators (since PHP 7.0)
- What is the difference between the | and || operators?
- What Does Using A Single Pipe '|' In A Function Argument Do?
- What is the difference between the | and || operators?
- PHP – and / or keywords
- What exactly does || mean?
- The behaviour of the or operator in PHP
+
Arithmetic Operators, Array Operators
++
Incrementing/Decrementing Operators
<?=
Short Open Tags
[]
Arrays
- PHP arrays… What is/are the meaning(s) of an empty bracket?
- PHP : What is the meaning of []
- Php array_push() vs myArray[]
- What does [] mean when reading from a php array?
- Shorthand for arrays: literal
$var = []
empty array
...
Argument unpacking (since PHP 5.6)
**
Exponentiation (since PHP 5.6)
#
One-line shell-style comment
Source: Stackoverflow Php