php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #64270 Operator precedence table incomplete
Submitted: 2013-02-21 20:29 UTC Modified: 2013-02-27 04:27 UTC
From: phpbugs at geniusdex dot net Assigned:
Status: Wont fix Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-02-21 20:29 UTC] phpbugs at geniusdex dot net
Description:
------------
The table in the documentation containing the operator precedence is incomplete; see http://www.php.net/manual/en/language.operators.precedence.php .

For example, the object operator (->), the scope resolution operator (::) and the namespace operator (\) are not included in the table.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-27 04:27 UTC] frozenfire@php.net
The mentioned operators are not the same "sort" of operators as those listed in 
the operator precedence table. It would not provide any benefit to list them 
there, as they have ultimate precedence in any statement, and no combination of 
them is both valid and ambiguous.
 [2013-02-27 04:27 UTC] frozenfire@php.net
-Status: Open +Status: Wont fix
 [2014-02-25 04:16 UTC] reinard at reinard dot com
I feel that it's actually important to know whether :: or -> has higher precedence. consider:

\Namespace::$static_public_object->public_method();

Am I resolving the namespace first on $object or am I looking for a $object in the current context and attempt to call it's method() first?

or what about a static method in the above example?

\Namespace::$static_public_object::static_public_method();

which scope gets resolved first?

Even though the "incorrect" interpretation would probably result in parser errors, there would be no harm in clarifying this for users.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 28 02:01:31 2024 UTC