function summarize($text, $numSentences) { print "This is inside the function summarize $text
"; $found = 0; $i = 0; $done = false; $minChars = 50; $maxChars = 500 * $numSentences; if($done == false) { for($i=1;$i<=$numSentences; $i++) { $found = strpos($text, "." , found + 1); echo "
Inside forloop $found
"; } if($found < minChars) { $numSentences = 1; } else { $done = true; } if(($found > maxChars) && ($numSentences > 1) ) { $numSentences = 1; $found = 0; $done = false; } } echo "
Outside forloop $found
"; return $found; }