Re: Function proposal

From: Date: Mon, 16 May 2005 15:15:05 +0000
Subject: Re: Function proposal
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-16256@lists.php.net to get a copy of this message
AnteD wrote:
/** * Prints the variable in HTML format... * * @param mixed $var * @param bool $return return or print the var * @return string */ function print_pre($var, $return = false) {
    $retval = »<pre>«.print_r($var, true).</pre>«;
    if($return) return $retval;
    print($retval);
} ok....let the shooting begin :)
the xdebug extension has very nice html-ized var_dump(). Use that on your devel machine and you'll never need your print_pre again. Otherwise I find it easier to simply do this: <?php echo '<pre>'; var_dump($blah); echo '</pre>'; ?> than to write a function and make sure it is always there. Alternately, view source from your browser works great for grabbing var_dump()/print_r() output. Greg

« previous php.internals (#16256) next »