DamienRoche Posted September 19, 2008 Share Posted September 19, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/125001-solved-php-string-question/ Share on other sites More sharing options...
aebstract Posted September 19, 2008 Share Posted September 19, 2008 Can I see how your long lines are being displayed? Quote Link to comment https://forums.phpfreaks.com/topic/125001-solved-php-string-question/#findComment-645904 Share on other sites More sharing options...
AndyB Posted September 19, 2008 Share Posted September 19, 2008 file() reads the contents into an array - http://ca.php.net/manual/en/function.file.php Then echo each array element between paragraph tags. Quote Link to comment https://forums.phpfreaks.com/topic/125001-solved-php-string-question/#findComment-645906 Share on other sites More sharing options...
DamienRoche Posted September 19, 2008 Author Share Posted September 19, 2008 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! Quote Link to comment https://forums.phpfreaks.com/topic/125001-solved-php-string-question/#findComment-645911 Share on other sites More sharing options...
AndyB Posted September 19, 2008 Share Posted September 19, 2008 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? Quote Link to comment https://forums.phpfreaks.com/topic/125001-solved-php-string-question/#findComment-645917 Share on other sites More sharing options...
DamienRoche Posted September 19, 2008 Author Share Posted September 19, 2008 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! Quote Link to comment https://forums.phpfreaks.com/topic/125001-solved-php-string-question/#findComment-645923 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.