Re: [PHP4BETA] no reverse fetch of arrays is BAD!
| From: | Yury Bokhoncovich | Date: | Wed, 23 Feb 2000 06:44:28 +0000 |
| Subject: | Re: [PHP4BETA] no reverse fetch of arrays is BAD! | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-10695@lists.php.net to get a copy of this message | ||
Hi!
Faisal Nasim wrote:
>
> Hi,
>
> This is somewhat a feature request....
>
> PHP should be able to:
>
> $x[] = 10;
> $x[] = 20;
> print $x[-1]; // 20, but PHP doesn't support this!
>
> But as I tested, it will accept negative index too!
>
> $x[-1] = 30;
> print $x[-1]; // 30, doesn't seem to affect any positive index
>
> Is that a feature?
I think that negative indeces maybe a useful feature, because a few
languages have this
already (notably MUMPS AFAIK).
The main difficulty for the such implementation in "C" or derived
languages is the method of calculating "effective address". IMHO the PHP
has not such limitations, because it has
got dynamically allocated cells in arrays (I can note big convergence
both PHP and MUMPS
in this issue).
--
WBR, Yury Bokhoncovich,
SysAdmin at FIS.