Return to Snippet

Revision: 13853
at May 19, 2009 04:34 by PeteW


Updated Code
/**
 * simple display function for debugging
 *
 * @param mix $mixObj
 * @param string $strLabel
 */
function display( $mixObj, $strLabel = null) {

	// show nothing on production server
	if ( 1 == ini_get( 'display_errors' ) ) {

		$backtrace = debug_backtrace();

		echo "
		<div style=\"border: 1px dotted #000; width: 100%;\">
			<strong>$strLabel</strong> - Called from: " .$backtrace[0]['file'] . " (line " . $backtrace[0]['line'] . ")
			<pre style=\"border: 1px dotted #000; margin-top: 0px\">" . print_r($mixObj, true ) . "</pre>
		</div>";

	}

}

Revision: 13852
at May 8, 2009 05:24 by PeteW


Updated Code
/**
 * simple display function for debugging
 *
 * @param mix $mixObj
 * @param string $strLabel
 */
function display( $mixObj, $strLabel = null) {

	// show nothing on production server
	if ( 1 == ini_get( 'display_errors' ) ) {

		$backtrace = debug_backtrace();

		echo "
		<div style=\"border: 1px dotted #000\">
			<strong>$strLabel</strong> - Called from: " .$backtrace[0]['file'] . " (line " . $backtrace[0]['line'] . ")
		</div>
		<pre style=\"border: 1px dotted #000; margin-top: 0px\">" . print_r($mixObj, true ) . "</pre>";

	}

}

Revision: 13851
at May 8, 2009 05:10 by PeteW


Initial Code
function display( $obj, $strLabel = null) {

	$backtrace = debug_backtrace();

	echo "
	<b>$strLabel</b> - Called from: " .$backtrace[0]['file'] . " (line " . $backtrace[0]['line'] . ")
	<pre>" . print_r(	$obj, true ) . "</pre>";

}

Initial URL
http://twitter.com/PeteWilliams

Initial Description
A simple replacement for print_r or whatever you use to display debug info.

Initial Title
PHP Debug Display

Initial Tags
php, debug

Initial Language
PHP