Hi there. I'm a newbie and I'm learning about multidimensional arrays.
Below is some code which creates an array called $myarray.
My aim is to output the following:
The value of myarray1 is:
ACC201
ACC202
ACC203
The value of myarray2 is:
BBA201
BBA202
BBA203
BBA204
BBA205
Question is how? I've experimented with various nested foreach loops, but I'm just getting tripped up. Can anyone help me?
<?php
// Test array
$myarray [1][1]= "ACC201";
$myarray [1][2]= "ACC202";
$myarray [1][3]= "ACC203";
$myarray [2][1]= "BBA201";
$myarray [2][2]= "BBA202";
$myarray [2][3]= "BBA203";
$myarray [2][4]= "BBA204";
$myarray [2][5]= "BBA205";
foreach($myarray as $key=>$value) {
echo "The value is $value<br />";
}
?>