Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #3516

Generating multi-level associative arrays

Path csiph.com!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail
From Victor Porton <porton@narod.ru>
Newsgroups comp.programming
Subject Generating multi-level associative arrays
Followup-To comp.programming
Date Sat, 22 Jun 2013 21:19:49 +0300
Organization Aioe.org NNTP Server
Lines 28
Message-ID <kq4ps2$ds$1@speranza.aioe.org> (permalink)
NNTP-Posting-Host MA/Qr1m4OFHuZQ7G9Jd9Dg.user.speranza.aioe.org
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Complaints-To abuse@aioe.org
User-Agent KNode/4.4.11
X-Notice Filtered by postfilter v. 0.8.2
Xref csiph.com comp.programming:3516

Followups directed to: comp.programming

Show key headers only | View raw


Suppose we have an array each element of which is an associative array:

[[a:1, b:2, c:3], ...]

I want to create an associative array out of it, indexed by values of some 
key (such as the key "a"):

[1:[[a:1, b:2, c:3], ...], ...]

(a value "1" of the key may be met more than once, thus with the value "1" 
of the key "a" is associated an array [[a:1, b:2, c:3], ...] not just [a:1, 
b:2, c:3].

It is easy to program in any modern language.

But what is the best way to do this if we want a MULTILEVEL associative 
array? (indexed by first key "a", then by key "b", etc.)

I want to discuss the most elegant, short, and practical solution for this 
kind of problems.

We could even write practically usable libraries of real code to do this 
kind of things.

Note that in fact I use PHP.

-- 
Victor Porton - http://portonvictor.org

Back to comp.programming | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Generating multi-level associative arrays Victor Porton <porton@narod.ru> - 2013-06-22 21:19 +0300
  Re: Generating multi-level associative arrays Rui Maciel <rui.maciel@gmail.com> - 2013-06-23 08:30 +0100
    Re: Generating multi-level associative arrays Victor Porton <porton@narod.ru> - 2013-06-23 15:16 +0300
      Re: Generating multi-level associative arrays Rui Maciel <rui.maciel@gmail.com> - 2013-06-23 16:02 +0100
        Re: Generating multi-level associative arrays Victor Porton <porton@narod.ru> - 2013-06-23 18:06 +0300
          Re: Generating multi-level associative arrays Rui Maciel <rui.maciel@gmail.com> - 2013-06-23 18:52 +0100
            Re: Generating multi-level associative arrays Victor Porton <porton@narod.ru> - 2013-06-24 14:52 +0300
              Re: Generating multi-level associative arrays Victor Porton <porton@narod.ru> - 2013-06-24 14:53 +0300
  Solved: Generating multi-level associative arrays Victor Porton <porton@narod.ru> - 2013-06-24 20:36 +0300

csiph-web