note 31661 deleted from language.variables by nlopess
| From: | nlopess@php.net | Date: | Fri, 24 Dec 2004 20:32:27 +0000 |
| Subject: | note 31661 deleted from language.variables by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-82270@lists.php.net to get a copy of this message | ||
Note Submitter: pekka at SPAMphotography-on-theSPAM dot net
----
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);