note 31661 added to language.variables
| From: | pekka at SPAMphotography-on-theSPAM dot net | Date: | Tue, 29 Apr 2003 17:55:35 +0000 |
| Subject: | note 31661 added to language.variables | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-47250@lists.php.net to get a copy of this message | ||
For us newbies:
During developement time you often want to display only some variables on page for debugging. With
this function you can you can save some typing time.
function printvars ($name,$hidden) {
if ($hidden == "1") print "<!-- ";
foreach ($name as $k) {
global ${$k};
print "<br><b>$$k:</b> " . ${$k};
}
if ($hidden == "1") print " -->";
return;
}
Use it by first creating an array of variable names (without $'s) you want to display:
$track =
array("name","address","car","hobby","favbeer");
and then run the function (use 1 as second parameter if you want to hide the output into html source
code):
printvars ($track,0);
--
http://www.php.net/manual/en/language.variables.php
http://master.php.net/manage/user-notes.php?action=edit+31661
http://master.php.net/manage/user-notes.php?action=delete+31661
http://master.php.net/manage/user-notes.php?action=reject+31661