<?
$file_array = file ($file);
foreach ($file_array as $line)
{
$line_array = explode ("\t", $line);
$multi_array[] = array (
$line_array[0],
$line_array[1],
$line_array[2]
);
}
?>
$multi_array is now 2D array with all of the data in subarrays. I would suggest futhering modifying the above code with more meaningful key names:
<?
$file_array = file ($file);
foreach ($file_array as $line)
{
$line_array = explode ("\t", $line);
$date = $line_array[2];
$multi_array[$date] = array (
'article' => $line_array[0],
'poster' => $line_array[1],
'date' => $line_array[2]
);
}
?>
now $multi_array has associative subarrays with meaningful key names and has the date as the key so it can be easily sorted by date by using ksort() or krsort(). You can refer to various elements like this:
$multi_array['date']['article']
or
$multi_array['date']['poster']
*this code assumes that every element has a unique date, if not you may want to use timestamps as key names.