<?php
function capitalize_story($story) {
//list everything that could end a sentence.
$punctuation = array('.','?','!');
foreach($punctuation as $ender) {
//turn the story into an array of sentences that end
//with the current punctuation
$temp = explode($ender,$story);
//empty story so we can rebuild it
$story = '';
//capitalize the first letter of each sentence.
foreach($temp as $sentence) {
$sentence = ltrim($sentence);
$sentence = ucfirst($sentence);
$story .= $sentence . $ender . ' ';
} //end foreach
} //end foreach
return $story;
} //end capitalize_story
?>
okay I fixed it so it puts the puncutation back now. As far as using the space after punctuation. If you don't trust them to capitalize the first word of a sentence do you really trust them to put a space in?