<?php
$contents = file('php://stdin', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);

$data = array();
foreach ($contents as $line)
{
    if (preg_match('/^(.+?) pos (\d+) \(time: ([^,]+), (\d+) laps\), best lap: (\d+) \(([^)]+)\) (.+?) ([0-9a-f]+)$/', $line, $matches))
    {
        $d = new StdClass();
        list(, $d->player, $d->pos, $d->time, $d->laps, 
             $d->bestLapNo, $d->bestLap, $d->car, $d->playerId) = $matches;
	
        $data[] = $d;
    }
    
    else if (strpos($line, 'Lap times: ') === 0 && !empty($data))
    {
        $lapTimes = explode(' ', substr($line, 11));
        $data[count($data) - 1]->lapTimes = $lapTimes;
    }
}

print_r($data);
?>