cinq
03-09-2005, 01:16 PM
Help jog this dummy's memory please :D
Array
(
[15] => Array
(
[0] => Array
(
[id] => 2
[name] => Tim
)
[1] => Array
(
[id] => 4
[name] => karl
)
}
[18] => Array
(
[0] => Array
(
[id] => 13
[name] => max
)
}
}
This is the array $guyscache
I want to find out the details of the first element of the main array ( [15] )
using a foreach statement, how would I do it ?
foreach ($guyscache AS $first)
{
foreach ($first AS $second)
{
$id=$second["id"];
$name=$second["name"];
echo $id.$name;
}
}
This basically will print out everyone on the list ( Tim, karl, max ).
However I only want (Tim and Karl printed).
How can I amend the above code ?
Thanks :)
Array
(
[15] => Array
(
[0] => Array
(
[id] => 2
[name] => Tim
)
[1] => Array
(
[id] => 4
[name] => karl
)
}
[18] => Array
(
[0] => Array
(
[id] => 13
[name] => max
)
}
}
This is the array $guyscache
I want to find out the details of the first element of the main array ( [15] )
using a foreach statement, how would I do it ?
foreach ($guyscache AS $first)
{
foreach ($first AS $second)
{
$id=$second["id"];
$name=$second["name"];
echo $id.$name;
}
}
This basically will print out everyone on the list ( Tim, karl, max ).
However I only want (Tim and Karl printed).
How can I amend the above code ?
Thanks :)