[pmwiki-devel] php multi-dimensional array construction problem

Patrick R. Michaud pmichaud at pobox.com
Thu Feb 5 20:16:15 CST 2009


On Thu, Feb 05, 2009 at 10:40:21AM +0000, Hans wrote:
> Perhaps someone can help me out with this problem:
> 
> I got a string k1:k2:k3:....:kn  and a value val
> made up of alpha-numeric word strings of any length
> k1 ..kn, seperated by :
> The number n of the k members can vary.
> 
> I like to construct an array out of this like
> array[k1][k2][k3]....[kn] = val
> so each word string k will become a key of the array, in sequence of
> the original series, resulting in an array with n keys.

What happens with...?

    a:b:c = val1
    a:b   = val2

It would seem that array[a][b] can't simultaneously be a value and an array.

Pm



More information about the pmwiki-devel mailing list