.*)\t(?.*) führt mit (?.*) eine.*erwirtschaftet (?.*) Goldmünzen/m", $protocol, $res);
$dtact = date('m.Y');
$vms = $newest = [];
for($i = 0; $i < count($res['datetime']); $i++) {
$tmpdt = date('m.Y', strtotime($res['datetime'][$i]));
if(!array_key_exists($tmpdt, $vms)) {
$vms[$tmpdt] = [
'user' => [],
'gm' => 0,
'list' => [],
'dtact' => $tmpdt
];
}
if(!array_key_exists($res['amt'][$i], $vms[$tmpdt]['user']))
$vms[$tmpdt]['user'][$res['amt'][$i]] = 1;
else
$vms[$tmpdt]['user'][$res['amt'][$i]] += 1;
$laeufer = explode(', ', str_replace(' und ', ', ', trim($res['laeufer'][$i], ',')));
foreach($laeufer as $tmp) {
if(!array_key_exists($tmp, $vms[$tmpdt]['user']))
$vms[$tmpdt]['user'][$tmp] = 1;
else
$vms[$tmpdt]['user'][$tmp] += 1;
}
arsort($vms[$tmpdt]['user']);
$vms[$tmpdt]['gm'] += (int)str_replace('.', '', $res['gm'][$i]);
$vms[$tmpdt]['list'][] = [
'datum' => $res['datetime'][$i],
'gold' => (int)str_replace('.', '', $res['gm'][$i]),
'amt' => $res['amt'][$i],
'laeufer' => $laeufer,
'a' => (int)str_replace('.', '', $res['gm'][$i]) / (count($laeufer) + 1)
];
}
$tpl['data'] = [
'protocol' => $protocol,
'vms' => $vms,
'newest' => array_shift($vms)
];
}
else {
$tpl['data'] = [
'protocol' => $protocol
];
}