02-01-2008, 10:41 PM
|
#4 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
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($fp, 2048, '|'))); 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 ....
|
|
|
|