if ($bbcode == strtoupper($bbcode)) { $bbarr = explode ('.', $bbcode); $bbcode = ""; foreach ($bbarr as $bbsentence) { if (trim($bbsentence) != "") { $bbcode .= ucfirst(strtolower(ltrim($bbsentence))) . "."; } } }