PHPを使いながら、役に立ちそうなコードを集めて行くメモです。
PHP ckeck memory's usage
echo "first:".memory_get_usage() / (1024 * 1024)."MB\n";
$arr = [];
for($i=0;$i<10000;$i++) {
$arr[] = $i;
}
echo "now:".memory_get_usage() / (1024 * 1024)."MB\n";
PHP check the launch time
$time_start = microtime(true);
// ...計測したい処理
$time = microtime(true) - $time_start;
echo "{$time} 秒";