Voting

: three plus zero?
(Example: nine)

The Note You're Voting On

kobrasrealm at gmail dot com
13 years ago
I wrote this dandy little function for using var_dump() on HTML documents so I don't have to view the source.

<?php
function htmldump($variable, $height="9em") {
echo
"<pre style=\"border: 1px solid #000; height: {$height}; overflow: auto; margin: 0.5em;\">";
var_dump($variable);
echo
"</pre>\n";
}
?>

You can pass arguments like this:
<?php
$sql
= mysql_query("SELECT id, name, value FROM table WHERE cond = 'value'");
$s = mysql_fetch_assoc($sql);

// Dump variable containing the result of the MySQL query
var_dump($s);
?>

The second parameter lets you specify the height of the box. Default is 9em, but if you're expecting a huge output you'll probably want a higher value.

<?php
var_dump
($s, "17em");
?>

Happy var_dumping.

<< Back to user notes page

To Top