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 :)

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to