how to split the text file???

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kanchan
Forum Commoner
Posts: 80
Joined: Tue Nov 30, 2004 12:03 pm

how to split the text file???

Post by kanchan »

i have a text file... which is of very heavy size.... do u guys have any tools to extract the text in easy way????
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post by infolock »

quick and diry that will parse a text file and split it up based on comma-delimited and space delimited ...

Code: Select all

$file_contents = file('styletest.css');
foreach ($file_contents as $num => $line_data) 
{
  $line_no = $num + 1; 
  $parsed_data = preg_split("/[\s,]+/", $line_data);
  //do something...
}
Post Reply