View Single Post
Old 02-01-2008, 10:41 PM   #4 (permalink)
Salathe
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

How about:
PHP Code:
<?php header('Content-Type: text/plain; charset=UTF-8');

$comments = array();

$fp fopen('comments.txt''r+');
if ( ! 
$fp) die ('Unable to load comments');
while ( ! 
feof($fp) && $comments[] = array_filter(fgetcsv($fp2048'|')));
fclose($fp);


foreach (
$comments as $comment)
{
    
$comment array_combine(array('user''date''body'), array_values($comment));
    echo 
'Who posted: '$comment['user'], "\n",
         
'Date: '$comment['date'], "\n",
         
'Comment: '$comment['body'], "\n\n";
}
The important one being line 7: while ....
Salathe is offline  
Reply With Quote
The Following User Says Thank You to Salathe For This Useful Post:
buildakicker (02-01-2008)