### What is this?

This is a collection of questions that come up 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, and not to copy over content from the PHP Manual.

Note: Since January 2013, Stack Overflow [does support special characters][1]. Just surround the search terms by quotes, e.g. [`[php] "==" vs "==="`][2]

### **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](http://php.net/manual/en/index.php) 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 for the help others provide.

## The List

If your particular token is not listed below, you might find it in the [List of Parser Tokens][3].

---

`&` [Bitwise Operators][4] or [References][5]

 - https://stackoverflow.com/questions/1676897
 - https://stackoverflow.com/questions/600202
 - https://stackoverflow.com/questions/2209934/
 - https://stackoverflow.com/questions/2376348
 - https://stackoverflow.com/questions/1006652
 - https://stackoverflow.com/questions/2297592
 - https://stackoverflow.com/questions/2422907
 - https://stackoverflow.com/questions/2478149
 - https://stackoverflow.com/questions/3957584
 - https://stackoverflow.com/questions/4705262
 - https://stackoverflow.com/questions/4705838
 - https://stackoverflow.com/questions/21058439 (&$)

---

`=&` [References][5]

 - https://stackoverflow.com/questions/1768343
 - https://stackoverflow.com/questions/1367454
 - https://stackoverflow.com/questions/3177342
 - https://stackoverflow.com/questions/2081806

---

`&=` [Bitwise Operators][4]

 - https://stackoverflow.com/questions/1367454
 - https://stackoverflow.com/questions/3177342

---

`&&` [Logical Operators][6]

 - https://stackoverflow.com/questions/2803321
 - https://stackoverflow.com/questions/2376348
 - https://stackoverflow.com/questions/4746865
 - https://stackoverflow.com/questions/4502092

---

`%` [Arithmetic Operators][7]

 - https://stackoverflow.com/questions/1934173
 - https://stackoverflow.com/questions/3204919

---

`!!` [Logical Operators][6]

 - https://stackoverflow.com/questions/2127260

---

`@` [Error Control Operators][8]

 - https://stackoverflow.com/questions/1032161
 - https://stackoverflow.com/questions/3551527
 - https://stackoverflow.com/questions/3984864
 - https://stackoverflow.com/questions/4872340
 - https://stackoverflow.com/questions/3621215

---

`?:` [Ternary Operator][9]

 - https://stackoverflow.com/questions/1080247
 - https://stackoverflow.com/questions/1993409
 - https://stackoverflow.com/questions/4055355
 - https://stackoverflow.com/questions/4210187

---

Double question mark

`??` [Null Coalesce Operator][10] (since PHP 7)

 - https://stackoverflow.com/questions/7278835

---

A question mark followed by a type declaration

`?string`
`?int`
`?array`
`?bool`
`?float` [Nullable type declaration][11] (since PHP 7.1)

 - [How to use a nullable type](https://stackoverflow.com/a/48450841)
 - [Nullable return type declaration](https://stackoverflow.com/a/54217328/250259)

---

`?->` question mark followed by object operator is a [NullSafe Operator][37] (since PHP 8.0)

- https://stackoverflow.com/questions/12351737/is-there-a-nullsafe-operator-in-php

---

`:` [Alternative syntax for control structures][13], [Ternary Operator][9], [Return Type Declaration](https://www.php.net/manual/en/language.types.declarations.php)

 - https://stackoverflow.com/questions/2908095
 - https://stackoverflow.com/questions/4747761
 - https://stackoverflow.com/questions/40346754

---

`::` [Scope Resolution Operator][14]

 - https://stackoverflow.com/questions/2903564
 - https://stackoverflow.com/questions/2588298
 - https://stackoverflow.com/questions/3173501
 - https://stackoverflow.com/questions/1912902
 - https://stackoverflow.com/questions/4120755
 - https://stackoverflow.com/questions/8734823

---

`\` [Namespaces][15]

 - https://stackoverflow.com/questions/10788400
 - https://stackoverflow.com/questions/4790020

---

`->` [Classes And Objects][16]

 - https://stackoverflow.com/questions/2588149
 - https://stackoverflow.com/questions/3037526
 - https://stackoverflow.com/questions/3173501
 - https://stackoverflow.com/questions/2316370
 - https://stackoverflow.com/questions/4502587

---

`=>` [Arrays][17]

 - https://stackoverflow.com/questions/1241819
 - https://stackoverflow.com/questions/1655336
 - https://stackoverflow.com/questions/4758791

---

`^` [Bitwise Operators][4]

 - https://stackoverflow.com/questions/2674920
 - https://stackoverflow.com/questions/2724936

---

`>>` [Bitwise Operators][4]

 - https://stackoverflow.com/questions/2790329

---

`<<` [Bitwise Operators][4]

- https://stackoverflow.com/questions/9718689/strange-print-behaviour-in-php

---

`<<<` [Heredoc or Nowdoc][18]

 - https://stackoverflow.com/questions/5539669
 - https://stackoverflow.com/questions/1048481
 - https://stackoverflow.com/questions/3700042
 - https://stackoverflow.com/questions/2090081
 - https://stackoverflow.com/questions/2333779

---

`=` [Assignment Operators][19]

 - https://stackoverflow.com/questions/2063480

---

`==` [Comparison Operators][20]

 - https://stackoverflow.com/questions/80646
 - https://stackoverflow.com/questions/1663451
 - https://stackoverflow.com/questions/2063480
 - https://stackoverflow.com/questions/15813490/

---

`===` [Comparison Operators][20]

 - https://stackoverflow.com/questions/1117967
 - https://stackoverflow.com/questions/80646
 - https://stackoverflow.com/questions/2063480
 - https://stackoverflow.com/questions/15813490/

---

`!==` [Comparison Operators][20]

 - https://stackoverflow.com/questions/1298083
 - https://stackoverflow.com/questions/1139154

---

`!=` [Comparison Operators][20]

 - https://stackoverflow.com/questions/1663451
 - https://stackoverflow.com/questions/1139154
 - https://stackoverflow.com/questions/6356826
 - https://stackoverflow.com/questions/9671785/what-is-the-difference-between-and

---

`<>` [Comparison Operators][20]

 - https://stackoverflow.com/questions/249312
 - https://stackoverflow.com/questions/589391
 - https://stackoverflow.com/questions/9671785
 - https://stackoverflow.com/questions/15813490/

---

`<=>` [Comparison Operators][20] (since PHP 7.0)

 - [Spaceship (three way comparison) operator][21]

---

`|` [Bitwise Operators][4]

 - https://stackoverflow.com/questions/2233835
 - https://stackoverflow.com/questions/13811922

---

`||` [Logical Operators][6]

 - https://stackoverflow.com/questions/2233835
 - https://stackoverflow.com/questions/4502092
 - https://stackoverflow.com/questions/5666741
 - https://stackoverflow.com/questions/12213283

---

`~` [Bitwise Operators][4]

 - https://stackoverflow.com/questions/1967360

---

`+` [Arithmetic Operators][7], [Array Operators][22]

 - https://stackoverflow.com/questions/2140090

---

`+=` and `-=` [Assignment Operators][19]

 - https://stackoverflow.com/questions/542995
 - https://stackoverflow.com/questions/7140158

---

`++` and `--` [Incrementing/Decrementing Operators][23]

 - https://stackoverflow.com/questions/1968371
 - [Answer below][24]

---

`.=` [Assignment Operators][19]

 - https://stackoverflow.com/questions/2202331
 - https://stackoverflow.com/questions/1241432

---

`.` [String Operators][25]

 - https://stackoverflow.com/questions/1466408
 - https://stackoverflow.com/questions/6484968

---

`,` [Function Arguments][26]

 - https://stackoverflow.com/questions/1466408

`,` [Variable Declarations][27]

 - https://stackoverflow.com/questions/41383218

---

`$$` [Variable Variables][28]

 - https://stackoverflow.com/questions/2715654
 - https://stackoverflow.com/questions/4169882
 - https://stackoverflow.com/questions/4891872

---

`` ` `` [Execution Operator][29]

 - https://stackoverflow.com/questions/6002296

---

`<?=` [Short Open Tags][30]

 - https://stackoverflow.com/questions/1963901
 - https://stackoverflow.com/questions/2020445
 - https://stackoverflow.com/questions/1959256/what-does-mean

---

`[]` [Arrays][17] (short syntax since PHP 5.4)

 - https://stackoverflow.com/q/20709055/2758197
 - https://stackoverflow.com/questions/6933345
 - https://stackoverflow.com/questions/2431629
 - https://stackoverflow.com/questions/3908576
 - [Shorthand for arrays: literal `$var = []` empty array](https://stackoverflow.com/questions/4271874)


---

`<?` [Opening and Closing tags][31]

 - https://stackoverflow.com/questions/200640

---

`..` Double-dot character range

- [Native PHP functions that allow double-dot range syntax][32]

---

`...` [Argument unpacking][33] (since PHP 5.6)

---
`**` [Exponentiation][34] (since PHP 5.6)

---
`#` [One-line shell-style comment][35]

 - [Can I use hashes for comments in PHP?][36]

---
`#[]` [Attributes][38] (since PHP 8)

---


  [1]: https://meta.stackexchange.com/questions/160100/a-new-search-engine-for-stack-exchange
  [2]: https://stackoverflow.com/search?q=%5Bphp%5D%20%22===%22%20vs%20%22==%22
  [3]: http://secure.php.net/manual/en/tokens.php
  [4]: http://secure.php.net/manual/en/language.operators.bitwise.php
  [5]: http://secure.php.net/manual/en/language.references.php
  [6]: http://secure.php.net/manual/en/language.operators.logical.php
  [7]: http://secure.php.net/manual/en/language.operators.arithmetic.php
  [8]: http://secure.php.net/manual/en/language.operators.errorcontrol.php
  [9]: http://php.net/manual/en/language.operators.comparison.php#language.operators.comparison.ternary
  [10]: https://www.php.net/manual/en/migration70.new-features.php#migration70.new-features.null-coalesce-op
  [11]: https://www.php.net/manual/en/migration71.new-features.php
  [12]: https://stackoverflow.com/questions/48881489/php-method-argument-type-hinting-with-question-mark-type
  [13]: http://secure.php.net/manual/en/control-structures.alternative-syntax.php
  [14]: http://secure.php.net/manual/en/language.oop5.paamayim-nekudotayim.php
  [15]: http://php.net/namespaces
  [16]: http://secure.php.net/manual/en/language.oop5.php
  [17]: http://secure.php.net/manual/en/language.types.array.php
  [18]: http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
  [19]: http://secure.php.net/manual/en/language.operators.assignment.php
  [20]: http://secure.php.net/manual/en/language.operators.comparison.php
  [21]: https://stackoverflow.com/a/31298778
  [22]: http://secure.php.net/manual/en/language.operators.array.php
  [23]: http://secure.php.net/manual/en/language.operators.increment.php
  [24]: https://stackoverflow.com/a/3737177
  [25]: http://secure.php.net/manual/en/language.operators.string.php
  [26]: http://php.net/manual/en/functions.arguments.php
  [27]: http://php.net/manual/en/language.variables.scope.php
  [28]: http://php.net/manual/en/language.variables.variable.php
  [29]: http://php.net/manual/en/language.operators.execution.php
  [30]: http://php.net/manual/en/ini.core.php#ini.short-open-tag
  [31]: http://secure.php.net/manual/en/language.basic-syntax.php
  [32]: https://stackoverflow.com/q/72865138/2943403
  [33]: http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list
  [34]: http://secure.php.net/manual/en/migration56.new-features.php#migration56.new-features.exponentiation
  [35]: http://php.net/manual/en/language.basic-syntax.comments.php
  [36]: https://stackoverflow.com/questions/9093609/can-i-use-hashes-for-comments-in-php
  [37]: https://stackoverflow.com/a/62178856/250259
  [38]: https://stackoverflow.com/a/71641821/6660678