/** This function is used to debug variables during page execution
* @param $what , the variable which need to debug,can be array or single variable
* @param $more , to know the method and line number where that variable is used
* @param $die , set TRUE if want to stop the page
* how to use : debug::watch($postarray,1,1);
* @author keshav mohta
* @date Aug 12, 2010
*/
class debug()
{
static function watch($what,$more=FALSE,$die=FALSE)
{
$d = debug_backtrace();
if($more && isset($d[1]))
{
echo "<br/>METHOD:".$d[1]['class']."::".$d[1]['function'];
echo "<br/>LINE:".$d[0]['line'];
}
echo "<br/>";
if( is_array($d[0]['args'][0]) || is_object($d[0]['args'][0]) )
{
echo "DATA:<pre>";
print_r($d[0]['args'][0]);
echo "</pre>";
}
else
{
echo "Data:".$d[0]['args'][0];
}
if($die)
{
echo "<br/>";
die('ends here');
}
}
}