Processing String or Text with Line Numbering
Posted: Fri Feb 05, 2010 7:25 pm
Hi,
Kindly consider this code fragment:
It is clear that the variable $message would contain whatever data / text was passed through the text field txtMessage.
Let the contents of the textarea field named txtMessage look like this:
Note: The above text essentially contains a line break at the end of each line.
Now I want to process the contents of $message in a way as to put a Line Number at the start of each line.
So, the final output would looke like this:
How to accomplish it- the Line Numbering Thing?
Note: In fact, the contents of the $message are being emailed and I want to format the contents as shown above. Moreover, the text in the textarea field could be very lengthy.
Kindly consider this code fragment:
Code: Select all
$message = $_REQUEST['txtMessage'];Let the contents of the textarea field named txtMessage look like this:
Code: Select all
Line Number One
Line Number Two
Line Number ThreeNow I want to process the contents of $message in a way as to put a Line Number at the start of each line.
So, the final output would looke like this:
Code: Select all
1# Line Number One
2# Line Number Two
3# Line Number Three
Note: In fact, the contents of the $message are being emailed and I want to format the contents as shown above. Moreover, the text in the textarea field could be very lengthy.