question about multidimension array
| From: | Zenith | Date: | Mon, 19 Feb 2001 17:42:54 +0000 |
| Subject: | question about multidimension array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-40594@lists.php.net to get a copy of this message | ||
Consider the following code:
$ary1 = array ("one","two");
$ary2 = array ("three","four");
$2d_Dimension[] = $ary1;
$2d_Dimension[] = $ary2;
// is $2d_Dimension a 2 dimensional array?
// and the next question, how to get out content of the $2d_Dimension[]
array
while ( list ( $rec_no, $ary ) = each ( $2d_Dimension ) )
{
echo ("Record No $rec_no:");
while ( list ( $element1, $element2 ) = each ( $ary ) )
echo "$element1, $element2";
}
// I want to use the above code to print something like
// Record No 0:one, two
// Record No 1:three, four
// But I only got the following
//Record No 0:
//Warning: Variable passed to each() is not an array or object in
d:/project/bizvista/testinc.php on line 27
What's the problem?