How can I display values in a two dimensional array?
You were along the right lines with the foreach command - you simply need to nest a foreach within another foreach, like this:
<?php
$myarray = array();
$myarray[0] = array(1,2,3,4);
$myarray[1] = array(5,6,7,8);
//
foreach($myarray as $v) {
foreach($v as $myv) {
echo "$myv<br>";
}
}
//prints 1 through 8 on screen
?>
Comments on this Question/Answer
What are the major difference between php4 and php5.By: Sunil, 26 Jun 2009 21:50:23
Reply to comments / post your own comment >>>
ASK A QUESTION
More arrays PHP Questions
reverse an arrayI have the following list : Tom T1 Tom T2 Bill T1 Bill T2 Jack T1 Jack T2 I need it converted into : Tom T1,T2 Bill T1,T2 Jack T1,T2
How can I mix up the order of values in an array?
How can I loop through the members of an array?
How do I write my own sort function?
