I have a large multidimentional array that I am looping through to change it's structure and theoretically this function will work accept the "variable array" part. And maybe that's not the right name for it as I have checked my resources and cannot come up with the right syntax for it but theoretically, I think I should be able to do it.

If you know what a variable variable is:

$variable = "blue";
$$variable = "red";

//what you get is
$blue = "red";

I am trying to do the same thing with an array:

$variable = "blue";
$$variable[] = "red";

//what I want is
$blue[0] = "red";

Does that make sense?

the syntax you are looking for is:

$variable = "blue";
${$variable}[] = "red";

//print array to see if it worked (did for me)
print_r(${$variable});
commented: I think I looked for about 3 hrs for that, thx. +1

Sweet, that's the ticket, thx.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.