Re: Function proposal

From: Date: Tue, 17 May 2005 03:11:57 +0000
Subject: Re: Function proposal
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-16261@lists.php.net to get a copy of this message
Hello AnteD, Friday, May 13, 2005, 1:29:36 PM, you wrote: > Hi guys... > Yes I know that this is a small function and yes I know it can be > copy-paste with every new project you do but from the first day I've > been using PHP until today this function follows me everywhere and I now > that everyone is using it one way or the other for debugging...... > the problem is when you want to debug a piece of code separately or use > it in one script then you have to find the function...copy paste to that > script or write it again just for that script...and so on...it would be > great if it could be in the php core.... > I have a very basic knowledge of C so implementing this function would > be a nightmare for me but for someone who knows C and the inner > "mysteries" of the Zend Engine :) this is a piece of cake.... > Ok...here it is...don't laugh :) > /** > * 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 :) Why not simply write this function to a seperate file and auto prepend it by appropriate ini setting to any script you run - no more change needed :-) -- Best regards, Marcus mailto:mail@marcus-boerger.de

« previous php.internals (#16261) next »