Reputation: 25525
I'm reporting form errors to the user with a nested arrays, because there are different groups to the form and I want to show the errors as such:
echo "<ul>\n";
foreach ($errors as $error) {
if (is_array($error)) {
echo "Item ".$i." error(s):\n";
echo "<ul>\n";
foreach ($error as $itemError) {
echo "<li>".$ItemError."</li>\n";
}
echo "</ul>\n";
} else {
echo "<li>".$error."</li>\n";
}
$i++;
}
echo "</ul>";
The nested arrays are recognized however the items in the nested arrays don't show up, so I get an empty sub list echoed.
Upvotes: 1
Views: 208