note 28287 deleted from ref.array by sniper
| From: | sniper@php.net | Date: | Sat, 18 Oct 2003 18:02:34 +0000 |
| Subject: | note 28287 deleted from ref.array by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58832@lists.php.net to get a copy of this message | ||
Note Submitter: philNOSPAMippe@moNO-SPAMrange.n-e-t
----
Hi,
I took the function from spam (at) speedcapture . com
I simplified it just a little, and here is the result.
Thanks for sharing this great tool with us. Simple, but sooooo usefull :)
function view_array($arr, $td=0)
{
if ($td) {
echo '<td>';
}
echo '<table>';
foreach ($arr as $key => $elem) {
echo '<tr>';
echo '<td>'.$key.' </td>';
if (is_array($elem)) {
view_array($elem, 1);
}
else {
echo '<td>'.htmlspecialchars($elem).' </td>';
}
echo '</tr>';
}
echo '</table>';
if ($td) {
echo '</td>';
}
}
You call it as you used to:
Let $myArray be an array of any kind,
simply do view_array($myArray);