I have been working on the formatting issue for awhile and have almost fixed what I need with one exception - splitting words at the end of a line and returning the other part to a newline. I don't do a very good job sometimes of making myself clear, so let me post the code and an example.
$fp = fopen("file.txt", "r");
while (!feof($fp)) {
$new = fgets($fp, 59);
echo $new."<br>";
}
What this does is format the text into a specified width that I require, but as I said it splits words into characters - not whole or hyphenated words. For example:
Text file contents:
I want this line formatted properly.
Simulated result using code above:
I want this line fo
rmatted properly.
What I would like is for the output to return the entire word to a newline...
I want this line
formatted
properly.
...or to hyphenate the word properly...
I want this line for-
matted properly.
Any ideas on how I can do this?
Thanks in advance!