PHP Word count and sentence break

I have a form that I want to submit a Large set of text into.

I want to break it into paragraphs.

So I want to count in 3 -5 Sentences  add a line break and put in a word like BREAK or #BREAK# in between each set then echo it back to the screen.

How would this be done?
A sentence ends with a      .    or a ! or a ?
Also how can I show a total word count of the input text?

Here is the form that I have that submits the data.

<html>
<head>
<title>paragraph burst</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="form1" method="post" action="<? $phpself; ?>">
  <p> Insert Text<br>
    <textarea name="original_text" cols="150"></textarea>
  </p>
  <p>min Sentence
    <input name="min" type="text" value="3" size="4">
    Max sentence
    <input name="max" type="text" value="5" size="4">
    <br>
    Break Token
    <input name="break_name" type="text" value="#BREAK#">
  </p>
  <p>
    <input type="submit" name="Submit" value="Submit">
  </p>
</form>
</body>
</html>


I hope that this is easy..
LVL 3
jbrashear72Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JB04Commented:
I dont full understand your question, however to wrap a line of text use wordwrap


$text = "The quick brown fox jumped over the lazy dog.";
$newtext = wordwrap($text, 20, "<br />\n");

echo $newtext;



www.php.net/wordwrap



to count the characters use the strlen function


$test = 'hello';

echo strlen($test); - outputs 5

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Strychni9eCommented:
you can use <a href="http://us2.php.net/manual/en/function.preg-split.php">preg_split()</a>

and a perl regexp to split it into arrays of sentances something like preg_split("[.!?]",$mytext)

then output then from the array as use feel the need

foreach( $array as $key => $value){}
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.