I have an array inside an array,
Array
(
[0] => Array
(
[title] => Title 1
[contentbody] => Body 1.
)
[1] => Array
(
[title] => Title 2
[contentbody] => Body 2.
)
)
I tried to print it with
foreach ($array as $i) {
foreach ($array[$i] as $k => $v) {
echo $k.$v."\n";
}
}
But as you may have guessed, that did not work. How does one go about printing the data of an array, within an array? (Besides using $array[0]['title'] as the content is all dynamic)
edit:
I've used
$count = count($array);
for ($i = 0; $i <= $count; $i++) {
foreach ($array[$i] as $k => $v) {
echo $k.$v."\n";
}
}
But I'm still getting a Invalid argument supplied for foreach() warning.. Is there a proper way to be doing this?