Hi all,
I have a 2D array, which I am trying to access, but I am having
problems doing this:
If, for instance, I use a nested for loop to go through the values,
using something like
echo "$MyArray[$loop_var_one][$loop_var_two]";
I get the following:
Array[1]
Array[2]
Array[3]
etc.
If I do a var_dump($MyArr ay[$loop_var_one][$loop_var_two])
I get
string(1) "2"
string(1) "0"
string(1) "3"
etc.
Now, if I do a count($MyArray[$loop_var_one]);
to see how many array elements are in the 2nd array index (for the
for...loop), I get zero!
Also, if I do the following
$new_array = $MyArray[$loop_var_one];
to try and populate a second array, and then do a var_dump(
$new_array), I get nothing as well.
Can anyone help please?
TIA
Paul
I have a 2D array, which I am trying to access, but I am having
problems doing this:
If, for instance, I use a nested for loop to go through the values,
using something like
echo "$MyArray[$loop_var_one][$loop_var_two]";
I get the following:
Array[1]
Array[2]
Array[3]
etc.
If I do a var_dump($MyArr ay[$loop_var_one][$loop_var_two])
I get
string(1) "2"
string(1) "0"
string(1) "3"
etc.
Now, if I do a count($MyArray[$loop_var_one]);
to see how many array elements are in the 2nd array index (for the
for...loop), I get zero!
Also, if I do the following
$new_array = $MyArray[$loop_var_one];
to try and populate a second array, and then do a var_dump(
$new_array), I get nothing as well.
Can anyone help please?
TIA
Paul
Comment