note 77234 added to function.var-dump
| From: | thriller dot ze at gmail dot com | Date: | Tue, 21 Aug 2007 08:49:01 +0000 |
| Subject: | note 77234 added to function.var-dump | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-129661@lists.php.net to get a copy of this message | ||
As Bryan said, it is possible to capture var_dump() output to a string. But it's not quite
exact if the dumped variable contains HTML code.
You can use this instead:
<?php
echo '<pre>'; // This is for correct handling of newlines
ob_start();
var_dump($var);
$a=ob_get_contents();
ob_end_clean();
echo htmlspecialchars($a,ENT_QUOTES); // Escape every HTML special chars (especially > and < )
echo '</pre>';
?>
----
Server IP: 195.221.21.36
Probable Submitter: 83.179.129.107
----
Manual Page -- http://www.php.net/manual/en/function.var-dump.php
Edit -- https://master.php.net/note/edit/77234
Del: integrated -- https://master.php.net/note/delete/77234/integrated
Del: useless -- https://master.php.net/note/delete/77234/useless
Del: bad code -- https://master.php.net/note/delete/77234/bad+code
Del: spam -- https://master.php.net/note/delete/77234/spam
Del: non-english -- https://master.php.net/note/delete/77234/non-english
Del: in docs -- https://master.php.net/note/delete/77234/in+docs
Del: other reasons-- https://master.php.net/note/delete/77234
Reject -- https://master.php.net/note/reject/77234
Search -- https://master.php.net/manage/user-notes.php