#23022 [Com]: Supported dereferencing array indeces on arbitrary expressions
| From: | billyellison99 at gmail dot com | Date: | Thu, 31 Dec 2009 06:26:50 +0000 |
| Subject: | #23022 [Com]: Supported dereferencing array indeces on arbitrary expressions | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-146230@lists.php.net to get a copy of this message | ||
ID: 23022
Comment by: billyellison99 at gmail dot com
Reported By: mfischer@php.net
Status: Open
Bug Type: Feature/Change Request
Operating System: Any
PHP Version: 5CVS-2003-04-02 (dev)
New Comment:
I fully support this feature. It'd make my life a whole lot easier, and
make my code much neater and smaller.
Previous Comments:
------------------------------------------------------------------------
[2009-11-10 03:47:40] kexianbin at diyism dot com
For objects, you could hack like this:
class user
{public $username='jack';
public function __get($prop_name)
{return $this->$prop_name();
}
private function degree()
{return array('doctor', 'master');
}
}
$aUser=new user();
echo $aUser->degree[1];
------------------------------------------------------------------------
[2009-11-05 05:43:34] glennwidener at gmail dot com
I found this lack of symmetry in array references really lame too. If
an expression delivers an array, then you should be able to reference an
element of that array. The only question is operator precedence and
grouping: recommend following the C rules - primary expressions group
left to right, parenthesis disambiguate.
------------------------------------------------------------------------
[2009-02-26 08:44:45] kexianbin at diyism dot com
When could we realize this in php?
create_function('$v', <<<'fun_code'
echo $v;
fun_code
)('hello');
------------------------------------------------------------------------
[2009-02-26 08:20:58] kexianbin at diyism dot com
When could we realize this in php?
create_function('$v', <<<'fun_code'
echo $v;
fun_code
')('hello');
------------------------------------------------------------------------
[2009-02-09 03:13:11] Anatorian at gmail dot com
I think this feature is very important. It can make me happier in php
developing.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/23022
--
Edit this bug report at http://bugs.php.net/?id=23022&edit=1