[PHP]簡易速度検証[自分用]

PEAR入れるのが面倒だったり、入れられないとき用の簡易実行速度測定関数
??? /**
???? * 簡易 実行速度検証用
???? */
var $_lastTimer;
var $_startTime;
function printTimer($line = null){
list($msec, $sec) = explode(” “, microtime());
$nowTime = (float)$sec + (float)$msec;

if(!isset($this->_startTime)) $this->_startTime = $nowTime;

$resultTime = $nowTime – $this->_lastTimer;
$this->_lastTimer = $nowTime;

if(isset($line)) echo $line.”行 計測時間:”;
printf(“%f”, $resultTime);
echo “   経過時間:”.sprintf(“%f”,$nowTime – $this->_startTime);
echo “
\n”;
//error_log(date(“Ymd H:i:s”).” 実行時間:”.sprintf(“%f”,$resTime).” \n\n”, 3, LOG);
}

んでも、やっぱすちゃんとしたモジュール使った方がキメは細かいやね。
log4php
PEAR:Log
zend_log
PEAR:Benchmark

[PHP]ディレクトリ展開ソース[自分用]

自分メモ用。
作業ディレクトリの展開indexソース。

header(“Content-Type: text/html;charset=SHIFT_JIS”);
$server_name = $_SERVER[“HTTP_HOST”];

?>




$dh = opendir(dirname(__FILE__));
while (false !== ($filename = readdir($dh))) {
if($filename != ‘.’
&& $filename != ‘..’
){
$files[] = $filename;
}
}
sort($files);

for($i = 0; $i < count($files); $i++){
if(is_dir($files[$i])){
if($filename != “.” && $filename != “..”){
echo ““.$files[$i].”
“;
}
}
}

?>
phpinfo.php