note 27300 added to function.print-r
| From: | Michael at rack1 dot php dot net | Date: | Sun, 01 Dec 2002 07:27:33 +0000 |
| Subject: | note 27300 added to function.print-r | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-40202@lists.php.net to get a copy of this message | ||
I liked the way coldfusion outputs a list of all the variables at the bottom of the page so I wrote
a little script to reproduce it. Thought people might appreciate it...
NOTE: you should correct the < br>. It contains an extra space because this page is not
escaped properly.
<?
$variableSets = array(
"Post:" => $HTTP_POST_VARS,
"Get:" => $HTTP_GET_VARS,
"Session:" => $HTTP_SESSION_VARS,
"Cookies:" => $HTTP_COOKIE_VARS,
"Server:" => $HTTP_SERVER_VARS,
"Environment:" => $HTTP_ENV_VARS
);
function printElementHtml( $value, $key ) {
echo $key . " => ";
print_r( $value );
echo "< br>";
}
foreach ( $variableSets as $setName => $variableSet ) {
if ( isset( $variableSet ) ) {
echo "< br>< br><hr size='1'>";
echo "$setName< br>";
array_walk( $variableSet, 'printElementHtml' );
}
}
?>
kind regards
Michael McCallum
--
http://www.php.net/manual/en/function.print-r.php
http://master.php.net/manage/user-notes.php?action=edit+27300
http://master.php.net/manage/user-notes.php?action=delete+27300
http://master.php.net/manage/user-notes.php?action=reject+27300