Return to Snippet

Revision: 13562
at April 27, 2009 20:35 by ikimozu


Initial Code
function d($var){
	$args=func_get_args();
	if(count($args)>1){
		$var=$args;
	}
	ob_start();
	var_dump($var);
	$dump=ob_get_contents();
	ob_end_clean();
	$trace=debug_backtrace();
	$file=str_replace($_SERVER['DOCUMENT_ROOT'],"",$trace[0]['file']);
	$line=$trace[0]['line'];
	echo '<pre>';
	echo '<b>'.$file.' (Line:'.$line.')</b>'."\n";
	echo str_replace('<','&lt;',str_replace('>','&gt;',$dump));
	echo '</pre><br>'."\n";
}

Initial URL

                                

Initial Description
displayed filename and line number.

//normal use

d( $arg );

//some arguments

d( $arg1 , $arg2 , ... );

Initial Title
var_dump wrapper

Initial Tags
debug

Initial Language
PHP