<?php
error_reporting(-1);
mb_internal_encoding('utf-8');

//$text = "ну что.      не смотрел еще black mesa.я собирался скачать  ,но все как-то некогда было.";
//$text = "roses are red,and violets are blue.whatever you do i'll keep it for you.";
$text = 'привет.есть 2 функции,preg_split и explode ,не понимаю,в чем между ними разница.';
function makeFirstLetterUppercase($text) {
	$partOne = mb_strtoupper(mb_substr($text, 0, 1));
	$partTwo = mb_substr($text,1);
    return $partOne . $partTwo;
}

function fixText($text) {
	$arr = preg_split("/(?<=\.)/u", $text, 0, PREG_SPLIT_NO_EMPTY);
	foreach ($arr as &$sent){
		$sent = trim($sent);
		$sent = makeFirstLetterUppercase($sent) ;
	}
	$sent = implode(" ", $arr);
	$sent = preg_replace("/( *([,!?]+))/u", "$2 ", $sent);
	return $sent;
}
$result = fixText($text);
echo $text;
echo "\n";
echo $result;