You seem to have three different ideas/questions... let me attempt to answer

> Hi. I want to be able to access a key in a multidimensional array at some
> depth "n" without knowing before runtime what the keys are.

let's take a multidimensional array $x
$x = array(

echo $x[0]; should print 'somevar'
echo $x[1]; should print 'Array'
echo $x[1][0]; should print 'otherval'
echo $x[1][1]; should print 'evenmore'

> I thought this might be possible using variable variables. Here's some
> sample code using variable variables and multidimensional arrays:
> $y = 'a';
> $z = 'b';
> $t = 'c';
> $x = array("a"=>array("b"=>array("c"=>TRUE)));

> // I want to be able to concatenate the array indexes into one variable
> variable. This would be done in a loop at runtime.
if you want to concat all the key's of an array with a loop you could do:

reset($x); //just to make sure we are at the first key
while(list($key,$val) = each($x)){
    $my_keys .= $key
echo $my_keys;

should result in: (using $x from my code above)

1 (I think it might even come out as 01 -- but probally 1 since it will be
treated as a int maybe =) )

> Any help would greatly be appreciated,
> Charlie

Hope that helps, still not sure what your question was or if i answered it


PHP General Mailing List (
To unsubscribe, visit:

Reply via email to