Jump to content

[SOLVED] php string question.


DamienRoche

Recommended Posts

Can I use a php string function to detect carriage returns and the start of new lines. Like th pre tags do.

 

Basically, I have a text file with some really long lines. WHat I want to do is put a <-p-> at the start of each line and a </-p-> at the end.

 

I already know how to use fopen etc. so it's just the string function I need to learn.

 

Has anyone got any ideas how I can do this?

 

Thanks.

Link to comment
Share on other sites

My long lines are being displayed none stop in the page.

 

like so:

 

I am a paragraph without a paragraph tab that is why I just can stop. ha that period doesn't stop me, I'm so clever, I just can stop. I am a paragraph without a paragraph tab that is why I just can stop. ha that

period doesn't stop me, I'm so clever, I just can stop. I am a paragraph without a paragraph tab that is why I just can stop. ha that period doesn't stop me, I'm so clever, I just can stop. I am a paragraph without a paragraph tab that is why I just can stop. ha that period doesn't stop me, I'm so clever, I just can stop. I am a paragraph without a paragraph tab that is why I just can stop. ha that period doesn't stop me, I'm so clever, I just can stop. I am a paragraph without a paragraph tab that is why I just can stop. ha that

period doesn't stop me, I'm so clever, I just can stop.

 

When really, it should break up a little. In the text file I just have really long lines for each paragraph.

 

I need to replace the start of each line with <-p-> and the end with </-p-> but I'm having trouble locating the beginning and the end of each line.

 

Thanks for the interest!

Link to comment
Share on other sites

In the text file I just have really long lines for each paragraph.

 

And did you read (or try) the suggestion I made about using the file() function?

 

Yes, well, you are my hero right now :)

 

I was writing that really long reply at I just thought it'd be a waste to chuck it so submitted it any way.

 

The file(); function worked a treat!

 

Thanks for your time!

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.