php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #46590 several operator precedence like things are not clear
Submitted: 2008-11-17 06:13 UTC Modified: 2009-11-20 12:02 UTC
From: chx1975 at gmail dot com Assigned: torben (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2008-11-17 06:13 UTC] chx1975 at gmail dot com
Description:
------------
What does $foo->$bar[3] mean? is $bar an array, of which we take the third element and the string found therein is the name of the property of the $foo object. Or is $foo-$bar an array of which we take the third element?

Wthat does new $foo(3) mean? Do we call the function name found in $foo with the argument 3 or we create a class which name is found in $foo and the constructor gets the argument 3?

What does $foo->$bar(3) mean? I wont go into the same painstaking detail as above but I think it's clear that there is a need for the precedence of () and -> be documented.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-10 05:52 UTC] torben@php.net
An addition to the Variable Variables section has been made to address your first concern, along with a note in the Strings section on how this may be done inside an interpolated string. Please note that the documentation is not generated from the XML sources every day, so it may be a little while before the change shows up in the online documentation.

Your second example is explained on the PHP 5 Objects and Classes
Basics page: http://www.php.net/manual/en/language.oop5.basic.php

Your third example is explained on the Variable Functions page:
http://ca.php.net/manual/en/functions.variable-functions.php

I am leaving this bug open, however, and assigning it to myself as a reminder to look into creating a Variable Members section to deal with this specifically in a more centralized location.

Thanks for the note and for helping us make the documentation better!
 [2009-11-20 12:02 UTC] vrana@php.net
Everything documented.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Jun 17 13:08:35 2026 UTC