Bug #14763 Updated: Make [] of arrays readable
| From: | georg@php.net | Date: | Sun, 30 Dec 2001 09:45:50 +0000 |
| Subject: | Bug #14763 Updated: Make [] of arrays readable | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-75333@lists.php.net to get a copy of this message | ||
ID: 14763
Updated by: georg
Reported By: linus@mccabe.nu
Status: Open
Bug Type: Feature/Change Request
Operating System:
PHP Version: 4.1.1
New Comment:
There is no need to make an array '$a[]' readable.
$a[] = "foo";
is short for
$a[count($a)] = "foo";
if $a[] would be readable, result would be always NULL:
$b = $a[] ( which would be the same as $a[count($a)])
Previous Comments:
------------------------------------------------------------------------
[2001-12-30 04:29:01] linus@mccabe.nu
Currently in php, you can append to a variable by using the [] form:
$a[] = 'a';
$a[] = 'b';
It would be great if you could also read an array in the same manner, ie:
$lastadded = $a[];
which would be equivalent to
$lastadded = $a[count($a)-1];
which is what you have to do today.
/linus
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14763&edit=1