Public feed #893811

Something

public php v1 · immutable
Raw Edit
·published 2008-02-06 14:06 UTC
rendered paste body
function debug($note = null){  static $start_time = NULL;  static $start_code_line = 0;  global $debugf;  $call_info = array_shift( debug_backtrace() );  $code_line = $call_info['line'];  $file = array_pop( explode('/', $call_info['file']));  if( $start_time === NULL )  {      $debug = "debug: ".$note." ".$file."> initialize</br>";      $start_time = time() + microtime();      $start_code_line = $code_line;      return 0;  }  $debugf .= sprintf("debug: %s %s> Line: %d-%d time: %.4f mem: %d KB</br>", $note, $file, $start_code_line, $code_line, (time() + microtime() - $start_time), ceil( memory_get_usage()/1024));  $start_code_line = $code_line;}debug();debug('All good'):debug('Something whent wrong');echo $debugf;