Hey there,

try this...

<?

$allan[1][0] = 1;
$allan[1][1] = "Alpha";
$allan[2][0] = 2;
$allan[2][1] = "Beta";


reset($allan);

echo "This is after";

while (list ($key1) = each ($allan)) {

echo "$key1<br>\n";

while (list ( , $val) = each ($allan[$key1])) {

echo " - $val<br>\n";

}

}

?>


Abe

----- Original Message -----
From: "Cybercandy Ltd" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 11, 2001 12:57 PM
Subject: [PHP] iterating multidimensional arrays


> sorry previous message was incomplete:
>
> I'm trying to get my head around multidimensional arrays and iterating
using
> each().
>
> I don't get why this script:
>
> <?
>
> $allan[1][0] = 1;
> $allan[1][1] = "Alpha";
> $allan[2][0] = 2;
> $allan[2][1] = "Beta";
>
> While ($output = each($allan)){
> print $output[1];
> }
>
> ?>
>
> prints ArrayArray
>
> rather than AlphaBeta
>
> can someone help me clear the fog?
>
> Allan
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to