Jump to content

Ignoring New Lines in text fields


RabPHP

Recommended Posts

Hey Guys,

 

I have a text file that is deliminated by either Semi-Colons or Pipes.

 

I am using this function to read them and put into an array:

 

$readfile = file("testimport1.txt");

 

for ($k=0; $k<=count($readfile)-1; $k++) {

    $fields = split(";",$readfile[$k]);

 

One of the fields is a description containing several paragraphs.  I find that this function will not recognize that the description is between semi-colons or Pipes and counts each new line in that field as a new record.  Is there anyway to get around this?

 

Rab

 

 

Link to comment
https://forums.phpfreaks.com/topic/114985-ignoring-new-lines-in-text-fields/
Share on other sites

Ultimately I am trying to take this data out of a huge text file that I can't control the output.  If this field were enclosed with quotes is there a function or something in PHP that I can use specifically for this field?

 

I am looking for some sort of insight into how I can make this work.

 

Thanks for your help.

 

Rab

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.