I have an array that looks like this except with over 40 more
Array
(
[0] => stdClass Object
(
[id] => 1
[name] => name
[cost] => 20
[firstname] =>
(
[0] => first 1
[1] => first 2
)
[lastname] =>
(
[0] => last 1
[1] => last 2
)
[username] =>
(
[0] => username 1
[1] => username 2
)
)
[0] => stdClass Object
(
[id] => 1
[name] => name
[cost] => 20
[firstname] =>
(
[0] => first 1
[1] => first 2
)
[lastname] =>
(
[0] => last 1
[1] => last 2
)
[username] =>
(
[0] => username 1
[1] => username 2
)
)
(
I am doing something like this to get the non nested arrays:
foreach($data as $row){
echo $row->id
}
but what would I do to get the nested arrays? I wanna be able to display them as:
firstname lastname
username
edit:
You should organize your array a bit better, if these are people who did product reviews:
Then you can do