I can't see to find an answer for this, but it's been bugging me for a while.
When using multidimensional arrays in php (or any language for that matter), do you get any efficiency and productivity out of saving an array of a multidimensional array as its separate array or accessing that "array" element directly from the whole array?
For example,
print_r($myArray);
Array
(
[2] => Array
(
[7.0] => Array
(
[0] => 1
[1] => 23
)
[16.0] => Array
(
[0] => 4
[1] => 28
)
)
[5] => Array
(
[17.0] => Array
(
[0] => 1
[1] => 3
)
)
)
If I needed to REPEATABLY access the array of [16.0], would it be better to just save that entry as its own array until I don't need it anymore, or is it better just to access it directly?
Option 1:
$tempArray=$myArray[2]["16.0"];
echo "Index=".$tempArray[0].";
or
Option 2:
echo "Index=".$myArray[2]["16.0"][0];
Of course this is just a tiny example, but if the values in (arbitrary) $array[.][.][n][...] are being accessed more than once, and the value of n depends on the index of a loop, is there any difference between accessing the element directly or saving that array (deep down on the layers of the array) as its own array and accessing its values that way?