<?php

error_reporting(-1);
mb_internal_encoding('utf-8');
header("Content-type: text/plain");
$text = "ну что.     не смотрел еще black mesa.я собирался скачать  ,но все как-то некогда было.";
function lowerCaseToUpperCase($text)
{
    $fixedText = "ы";
    $reg = '/\\./';
    $sentences = preg_split($reg, $text, 0, PREG_SPLIT_NO_EMPTY);
    foreach ($sentences as $sentence) {
        $sentence = trim($sentence);
        $firstLetter = "а";
        $firstLetter = $sentence[0];
        $firstLetter = mb_strtoupper($firstLetter);
        $sentence[0] = $firstLetter[0];
        $fixedText .= $sentence . ". ";
    }
    return $fixedText;
}
function fixText($text)
{
    echo "Вы ввели {$text} \r\n";
    $fixedText = lowerCaseToUpperCase($text);
    $reg = "/(\\s+\\,)|\\,\\S/";
    $fixedText = preg_replace($reg, ', ', $fixedText);
    return $fixedText;
}
print_r(fixText($text));
Exemplo n.º 2
0
Arquivo: footer.php Projeto: DbyD/cruk
        if ($mess["award"] == 'm') {
            ?>
									<i class="icon-icons_mail"></i>
									<?php 
        } else {
            ?>
									<i class="icon-icons_star"></i>
									<?php 
        }
        ?>
									<span class="right"><?php 
        echo date("l d/m/y", strtotime($mess["date"]));
        ?>
</span>
									<p class="text"> <?php 
        echo fixText($mess["text"]);
        ?>
</p>
								</div>
						<?php 
    }
}
?>
							<div class="row">
								<i class="icon-icons_mail"></i><span class="right"><?php 
echo date("l d/m/y");
?>
</span>
								<p class="text">Welcome to the Our Heroes portal where you can nominate colleagues in recognition of their contribution to Cancer Research.</p>
							</div>
							<div class="row">