Doc #66772 [Opn]: Comma operator has insufficient documentation
| From: | yohgaki@php.net | Date: | Sun, 06 Jul 2014 02:52:11 +0000 |
| Subject: | Doc #66772 [Opn]: Comma operator has insufficient documentation | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-11336@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66772&edit=1
ID: 66772
Updated by: yohgaki@php.net
Reported by: cmbecker69 at gmx dot de
Summary: Comma operator has insufficient documentation
Status: Open
Type: Documentation Problem
Package: Documentation problem
Operating System: *
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
I think ',' is used to divide expressions just like C/C++, isn't? Therefore,
echo 1,2,3,4;
as well as
$i=0;
echo ++$i, ++$i, ++$i;
works.
http://en.cppreference.com/w/cpp/language/operator_precedence
http://www.difranco.net/compsci/C_Operator_Precedence_Table.htm
I'm not sure what do you mean by "the operator precedence table seems to be in
error."
Previous Comments:
------------------------------------------------------------------------
[2014-02-25 20:35:18] cmbecker69 at gmx dot de
Description:
------------
The section "Operator Precedence"[1] lists all operators and gives
a link to the manual section where they are described; for the
comma operator it only says "many uses". It seems to be
appropriate to list these many uses in an own section.
OTOH, from what I can tell from Zend/zend_language_parser.y[2] the
only actual place where the comma is used as operator (opposed to
a list delimiter) is inside for_expr. This usage is explained in
the "for" section[3]. If this is indeed the only use, the operator
precendence table seems to be in error.
[1] <http://www.php.net/manual/en/language.operators.precedence.php>
[2] <http://lxr.php.net/xref/PHP_5_5/Zend/zend_language_parser.y>
[3] <http://www.php.net/manual/en/control-structures.for.php>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66772&edit=1