By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,607 Members | 2,008 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,607 IT Pros & Developers. It's quick & easy.

Formatting plain text

P: 6
I want to format 5,000 lines of plain text with the easiest way possible (due to tennis elbow injury). I have no php or programming experience. Below is what I have been told it should look like. With places to add peoples names later.

Expand|Select|Wrap|Line Numbers
  1. echo "$firstname1 and $firstname2. XXX XXXXXX XXXXXX XXXX XXXXX<br />";
  2. echo "XXXXXXXXX XXXXXXXX<br />";
  3. echo "<br />";
  6. echo "Mr. $lastname1 XXXXXXXXXXX XXX $firstname2 XXXXX<br />";
  7. echo "XXXXXXXXXXXX $firstname2 $lastname2 XXXXXXXXXXXX<br />";

Expand|Select|Wrap|Line Numbers
  1. fwrite($fh,"$firstname1 and $firstname2. XXX XXXXXX XXXXXX XXXX XXXXX\n");
  2. fwrite($fh,"XXXXXXXXX XXXXXXXX\n");
  3. fwrite($fh,"\n");
I hope that is enough information. (The uneditied versions match).

Is there a program that I should be using to do this formatting?

Apr 13 '10 #1
Share this Question
Share on Google+
7 Replies

code green
Expert 100+
P: 1,726
Don't understand what you mean by format but you don't need a new function call (echo and fwrite) for every new line.
it can be done in one call only
Expand|Select|Wrap|Line Numbers
  1. echo "$firstname1 and $firstname2. XXX XXXXXX XXXXXX XXXX XXXXX<br />XXXXXXXXX XXXXXXXX<br />......."
Where is this text coming from?
Apr 13 '10 #2

P: 6
I have to put stories on a website.
Apr 14 '10 #3

P: 6
That's exactly what I am looking for. I didn't know that.
"you don't need a new function call (echo and fwrite) for every new line.
it can be done in one call only"
How do I do it?
Apr 14 '10 #4

P: 6
Also the inverted commas and <br />
Apr 14 '10 #5

P: 6
I assume the call is added with the text already in place?
Apr 14 '10 #6

code green
Expert 100+
P: 1,726
How do I do it
I did post an example. Just place the <br> anywhere you like in the text I'll do it again
Expand|Select|Wrap|Line Numbers
  1. echo "$firstname1 and $firstname2. XXX XXXXXX XXXXXX XXXX XXXXX
The same idea for fwrite,
Apr 14 '10 #7

P: 6
Hello. How are you today? Code Green.
This is a simple message for formatting a php page.
Apr 14 '10 #8

Post your reply

Sign in to post your reply or Sign up for a free account.