Skip to content

Instantly share code, notes, and snippets.

@robert-wallis
Created September 17, 2011 06:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robert-wallis/1223678 to your computer and use it in GitHub Desktop.
Save robert-wallis/1223678 to your computer and use it in GitHub Desktop.
nicely styled, easy to read, debug($someval, __FILE__.__LINE__); because nobody I know uses zend debugger :(
<?php
// debug() - Copyright (C) 2006-2009 Robert Wallis
// print out the value to be read in the browser
if (!function_exists('debug'))
{
function debug($value, $name='')
{
print('<pre>');
if ($name)
print(
'<div style="background-color:#313131; color:#FFFFFF; padding: 10px 10px 0px 10px; font-size:16px; font-family: sans-serif;">'.$name.'</div>'.
'<div style="background-color:#525252; color:#FF9900; padding: 0px 10px 10px 10px; font-size:13px;">'
);
else
print('<div style="background-color:#525252; color:#FF9900; padding: 10px 10px 10px 10px; font-size:13px;">');
ob_start();
var_dump($value);
$output = ob_get_contents();
ob_end_clean();
print(htmlentities($output).'</div></pre>');
} // debug
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment