02-01-2008, 09:54 PM
|
#1 (permalink)
|
|
The Acquainted
Join Date: Jan 2008
Posts: 119
Thanks: 21
|
Echoing Text File Rows into Array Display...
Hi all
Right now i can display each row of my text file using echo... I have my rows divided up by ||... for example:
me||10-02-07||information on php
you||1-12-07||some more info...
I would like to make it look like:
Who posted: ME
Date: 10-02-07
Comment: information on php
Right now I am using a foreach loop to grab the data.
PHP Code:
$fp = fopen("comments.txt", "r+");
while(!feof($fp)){
$line_of_text = fgets($fp);
$parts = explode('||', $line_of_text);
foreach($parts as $part){
echo $part;
}
}
fclose($fp);
I need to have 2 arrays here right? $part[0][1]; or something like that?
Thanks! 
|
|
|
|