oncombeureum 0 Report post Posted May 21, 2005 i implement this <?$fp = fopen('data.txt', 'r');if ($fp) { while (!feof($fp)) { $texts = fread($fp, 4096); echo 'this is -> ' . $texts . '\n <br?'; } fclose($fp);}?> for the data file:data.txtsatu@mon.com,combo@bakso.com,special@monyong.com,kuya.batok@forever.and.ever.com,special.pake.telor.2@tolong.jangan.lama.com the result :this is -> satu@mon.com combo@bakso.com special@monyong.com kuya.batok@forever.and.ever.com special.pake.telor.2@tolong.jangan.lama.com \nwhat i want iscan it read line by line ?no matter how long the line isdankeOncom Beureum Share this post Link to post Share on other sites
vujsa 0 Report post Posted May 21, 2005 Using the spilt() function on $text will insert the contents of data.txt into an array if you use the linebreak as the delimiter for the split() function.This would give you an array like so: (Simplified)$arrayname[0] = data.txt$arrayname[1] = satu@mon.com,$arrayname[2] = combo@bakso.com,$arrayname[3] = special@monyong.com,$arrayname[4] = kuya.batok@forever.and.ever.com,$arrayname[5] = special.pake.telor.2@tolong.jangan.lama.comOf course this would only be possible if you can predict where your delimiter is located.You can skip the first array entry several ways depending on whether or not you want that data to be used.Then to output the data, you'll ned to cycle through the array and output each item idividually.This isn't a very detailed explaination but I hope it will get you pointed in the right direction.Try the PHP Site for more information.http://php.net/Hope this helps,vujsa Share this post Link to post Share on other sites
oncombeureum 0 Report post Posted May 21, 2005 i found it..use the fgets functionleave the data ...FGETS will read line by line:)bitte schon Share this post Link to post Share on other sites
CrazyPensil 0 Report post Posted March 20, 2006 Actually, The method split(); is what you need here, but as for the question you asked - How to read a line - just use fgets() function. Share this post Link to post Share on other sites