All pastes #296017 Raw Edit

Untitled

public php v1 · immutable
#296017 ·published 2006-12-29 22:10 UTC
rendered paste body
if(1){	define('TICKS','profile.log.txt');	define('TICK_START',microtime(true));	function profile_function(){		static $last;		$t=microtime(true)-TICK_START;		$d=debug_backtrace();		$l = $d[0]['line'];		array_shift($d);		if(!$d) return;		if($last==$d[0]['line']) return;		$last=$d[0]['line'];		$g='';		foreach(array_reverse($d) as $x){			if(isset($x['class'])) $g.= " {$x['class']}{$x['type']}{$x['function']}";			else $g.= " {$x['function']}";		}		$g.=" on line $l (";		foreach($d[0]['args'] as $v){			if(is_string($v)) $g.=" ".var_export(substr($v,0,50),true);			else if(is_object($v)) $g.= " [object]";			else if(is_array($v)) $g.= " [array]";			else $g.=" ".var_export($v,true);		}		$g.=" )";		$c=count($d);		file_put_contents(TICKS,"$t$g\n",FILE_APPEND);	}	register_tick_function('profile_function');	declare(ticks=1);}