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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.