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

=& References

&= Bitwise Operators

&& Logical Operators

% Arithmetic Operators

!! Logical Operators

@ Error Control Operators

?: Ternary Operator

?? Null Coalesce Operator (since PHP 7)

?string ?int ?array ?bool ?float Nullable return type declaration (since PHP 7.1)

: Alternative syntax for control structures, Ternary Operator

:: Scope Resolution Operator

\ Namespaces

-> Classes And Objects

=> Arrays

^ Bitwise Operators

>> Bitwise Operators

<< Bitwise Operators

<<< Heredoc or Nowdoc

= Assignment Operators

== Comparison Operators

=== Comparison Operators

!== Comparison Operators

!= Comparison Operators

<> Comparison Operators

<=> Comparison Operators (since PHP 7.0)

| Bitwise Operators

|| Logical Operators

~ Bitwise Operators

+ Arithmetic Operators, Array Operators

+= and -= Assignment Operators

++ and -- Incrementing/Decrementing Operators

.= Assignment Operators

. String Operators

, Function Arguments

, Variable Declarations

$$ Variable Variables

` Execution Operator

<?= Short Open Tags

[] Arrays (short syntax since PHP 5.4)

<? Opening and Closing tags

... Argument unpacking (since PHP 5.6)

** Exponentiation (since PHP 5.6)

# One-line shell-style comment

:? Nullable return types