PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #46590 several operator precedence like things are not clear
Submitted:17 Nov 2008 6:13am UTC Modified: 20 Nov 12:02pm UTC
From:chx1975 at gmail dot com Assigned to:torben
Status:Closed Category:Documentation problem
Version:Irrelevant OS:
View/Vote Developer Edit Submission

[17 Nov 2008 6:13am 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.

[10 Sep 5:52am 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!
[20 Nov 12:02pm UTC] vrana@php.net
Everything documented.

RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC