Re: associative arrays
| From: | Tedd Sperling | Date: | Tue, 02 Nov 2021 20:03:30 +0000 |
| Subject: | Re: associative arrays | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-327811@lists.php.net to get a copy of this message | ||
> On Nov 2, 2021, at 2:25 PM, Christoph M. Becker <cmbecker69@gmx.de> wrote:
>
> On 02.11.2021 at 07:24, JEFFRY KILLEN wrote:
>> Hello:
>>
>> I have been programming php and javascript for some time.
>> I have not come on a way to navigate upward in javascript
>> objects (it does not have associative arrays but objects are
>> often used in the same way associative arrays are used)
>>
>> To create a metaphor: it is like a squirrel jumps from another tree and lands on a branch.
>> It
>> can find its way to the trunk and to the ground.
>
> The squirrel doesn't ask the branch how to get to the trunk or to the
> ground, though. Instead, it remembers its way so far. :)
>
> --
> Christoph M. Becker
Not quite, a better analogy would be the squirrel doesn’t know on what branch his father found his
mother.
More specifically, an array inside another array doesn’t know it’s inside another array. In
fact, it’s simply a memory address that can only be located via an index inside another array,
which is yet another memory address. Ask any memory address where it is and it can answer you, but
it can’t offer much more information other than what it is — after all, it’s just a memory
address.
If you want data to tell you what data proceeded it, then look into a double linked-list. That might
solve your problem.
Cheers,
Tedd
Tedd Sperling
tedd.sperling@gmail.com