I have the following script which is preparing user data for output:
// this first line simply read the data from the file into an array.
// memory usage at this point: 13.5830 MB
if ($val = baw_data($BAW_CURR['site_name'], "VISITOR", $BAW_CURR['yearmonth'])) {
// I want to summarize people which have a hit/page ratio <1 into the user 'script'
// so I prepare the array for it.
$val['script'] = array('script',0,0,0,0,'');
// now I iterate the data.
foreach ($val as $dns => $data) {
// this next line gives me a debug-output and tells me the memory usage & time spent.
baw_debug($dns . "start", false, true);
$ratio = 0;
if ($data[0] > 0) {
$ratio = baw_num_format($data[1] / $data[0], 2);
}
if ($ratio <= 1) {
$latest_date_bots = max($data[3], $latest_date_bots);
$val['script'] = array(
$BAW_MES['assumedscript'],
$val['script'][0] + $data[0],
$val['script'][1] + $data[1],
$val['script'][2] + $data[2],
baw_num_format(($val['script'][0] + $data[0]) / ($val['script'][1] + $data[1]),2),
$latest_date_bots
);
unset($val[$dns]);
} else {
$val[$dns] = array($dns,$data[0],$data[1],$data[2],$ratio,$data[3]);
}
baw_debug($dns . "end", false, true);
}
}