PhpStorm
 
Get PhpStorm
You are viewing the documentation for an earlier version of PhpStorm.

Code Inspection: Comma expression

Last modified: 21 March 2023

Reports a comma expression. Such expressions are often a sign of overly clever code, and may lead to subtle bugs. Comma expressions in the initializer or in the update section of for loops are ignored.

In the following example, a potentially confusing one-line comma expression is rewritten using three separate statements:

For more information, refer to Comma operator (MDN).