note 54342 added to function.var-dump
| From: | As at osu1 dot php dot net | Date: | Thu, 30 Jun 2005 20:58:24 +0000 |
| Subject: | note 54342 added to function.var-dump | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91224@lists.php.net to get a copy of this message | ||
The dumped variables don't have html entities encoded. So if your variable contains < in the
data, your browser will see it as the start of an html tag. Additionally the dump has lots of =>
in it, which are also not escaped, although your browser does manage to figure out to display them
as is. But they are errrors though.
Wrapping it in PRE doesn't help. Using the XMP tag will work, but it's a depreciated tag.
I'm using it anyway, since it does what I need, and this function isn't (usually) used for
production code anyway.
<?php
echo "<XMP>";
var_dump(get_defined_vars());
echo "</XMP>";
?>
XMP is your best bet, or use output control and the htmlspecialchars function.
----
Manual Page -- http://www.php.net/manual/en/function.var-dump.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54342
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54342&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54342&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54342&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54342&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54342&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54342&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54342&report=yes
Search -- http://master.php.net/manage/user-notes.php