note 28609 deleted from function.array-walk by aidan
| From: | aidan@php.net | Date: | Sun, 11 Jul 2004 02:09:01 +0000 |
| Subject: | note 28609 deleted from function.array-walk by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73033@lists.php.net to get a copy of this message | ||
Note Submitter: dakota@tensen.net
----
I have often found it helpful in form post situations to be able to view all of the values that have
been submitted by the form to make sure that they are being sent right. I used to have a page that
did this but I then realized that I could make a function out of it. So I did this and then I
realized I could make this take any array variable and so I made it recursive and so it shows
everything inside an array, perhaps like the 'array_walk()' function but I never could get
that to work.
function view_values($VARS)
{
$row = 0;
echo("<table>");
while (list ($key, $val) = each ($VARS))
{
echo ("<tr bgcolor=#" . (($row/2) == floor($row/2) ? "444444" :
"666666") . "><td>$key</td><td>");
if(!is_array($val))
echo("$val</td></tr>\n");
else
echo(view_values($val));
$row++;
}
echo("</table>");
}