Nested Array with one foreach Loop?
Posted
by streetparade
on Stack Overflow
See other posts from Stack Overflow
or by streetparade
Published on 2010-04-13T13:08:30Z
Indexed on
2010/04/13
13:13 UTC
Read the original article
Hit count: 188
I need to have access to a array which looks like this.
Array
(
[0] => Array
(
[54] => Array
(
[test] => 54
[tester] => result
)
)
)
foreach($array as $key=>$value)
{
echo $key;// prints 0
echo $value;// prints Array
/*
now i can iterate through $value but i dont want it solve that way example:
foreach($value as $k=>$v)
{
echo $k;//prints test
echo $v; //prints 54
}
*/
}
How can iterate just once ? to get the values of test and tester? I hope i could explain my problem clear
© Stack Overflow or respective owner