I'll preface this by saying that I'm more of a "big picture" developer. The finer nuances of syntax are not my specialty.
I'm looking to take an array, e.g.:
$someArray = array(0, 9, 10, 11, 12, 23);
and create an integer inside of a different multi-dimensional array, whose value would, when hard-coded, be assigned using the following:
$anotherArray[0][9][10][11][12][23] = 1;
For reference, when var_dump()'d, the above code outputs:
Array
(
[0] => Array
(
[9] => Array
(
[10] => Array
(
[11] => Array
(
[12] => Array
(
[23] => 1
)
)
)
)
)
)
Naturally, I would also like to be able to read from the array, with something like:
$myInt = $anotherArray[0][9][10][11][12][23];
I have tried to create the array with (following from the above examples):
$container = array();
for ($j = 0; $j < count($someArray); $j++) {
$dimensions .= '[' . $someArray[$j] . ']';
}
$container[]{$dimensions} = 1;
The problem is that, when var_dump()'d, $container looks like this:
[0] => Array
(
[[0][9][10][11][12][23]] => 1
)
I need the nested structure, as demonstrated a few code-blocks up.
To be clear, the 0, 9, 10, etc. in the above examples are dynamic; there could be any number of dimensions to the array, and I need for this to work within a "for" loop.
Thanks for any help!