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


Groups > comp.lang.php > #18690

convert array keys to paths

From alex <1j9448a02@lnx159sneakemail.com.invalid>
Newsgroups comp.lang.php
Subject convert array keys to paths
Date 2021-06-28 12:57 +0200
Organization Aioe.org NNTP Server
Message-ID <sbc9ua$11kl$1@gioia.aioe.org> (permalink)

Show all headers | View raw


Look at this array

array (
   'a' =>
   array (
     'b1' =>
     array (
       'c1' => 1,
       'c2' => 2,
       'c3' => 3,
     ),
     'b2' =>
     array (
       'c' => 4,
     ),
   ),
)

You can convert it to

array (
   'a/b1/c1' => 1,
   'a/b1/c2' => 2,
   'a/b1/c3' => 3,
   'a/b2/c' => 4,
)

Possibly without using a complex set of instructions:
foeach, array_map (), etc.

Back to comp.lang.php | Previous | NextNext in thread | Find similar


Thread

convert array keys to paths alex <1j9448a02@lnx159sneakemail.com.invalid> - 2021-06-28 12:57 +0200
  Re: convert array keys to paths Arne Vajhøj <arne@vajhoej.dk> - 2021-07-23 21:14 -0400
    Re: convert array keys to paths alex <1j9448a02@lnx159sneakemail.com.invalid> - 2021-07-24 09:06 +0200
      Re: convert array keys to paths Arne Vajhøj <arne@vajhoej.dk> - 2021-07-24 20:36 -0400
        Re: convert array keys to paths alex <1j9448a02@lnx159sneakemail.com.invalid> - 2021-07-25 12:50 +0200
          Re: convert array keys to paths He Llo <ya12983@mail.com> - 2021-08-05 05:25 -0700

csiph-web