<?php
$text0 = "ну что. не смотрел еще black mesa.я собирался скачать ,но все как-то некогда было." ;
$text1 = "roses are red,and violets are blue.whatever you do i'll keep it for you." ;
$text2 = "привет.есть 2 функции,preg_split и explode ,не понимаю,в чем между ними разница." ;
$textArray = array ( $text0 , $text1 , $text2 ) ;
foreach ( $textArray as $currentSentence ) {
$clearedSentence = preg_replace ( '/[ ]{2,}/' , "" , $currentSentence ) ; $noSpaceComas = preg_replace ( '/[ ],/' , "," , $clearedSentence ) ; $clearSpaces = preg_replace ( '/[ ][ ]/' , " " , $addSpaceComas ) ; $sentenceBreak = preg_split ( '/[.]/' , $clearSpaces , - 1 , PREG_SPLIT_NO_EMPTY
) ; foreach ( $sentenceBreak as $singleSentence ) {
echo ( toUpperCase( $singleSentence ) ) ;
}
}
function toUpperCase ( $sentence ) {
$finalSentence = $firstLetter . $otherLetters . ". " ;
return $finalSentence ;
}
PD9waHAKCmVycm9yX3JlcG9ydGluZygtMSk7Cm1iX2ludGVybmFsX2VuY29kaW5nKCd1dGYtOCcpOwoKJHRleHQwID0gItC90YMg0YfRgtC+LiAgICAgINC90LUg0YHQvNC+0YLRgNC10Lsg0LXRidC1IGJsYWNrIG1lc2Eu0Y8g0YHQvtCx0LjRgNCw0LvRgdGPINGB0LrQsNGH0LDRgtGMICAs0L3QviDQstGB0LUg0LrQsNC6LdGC0L4g0L3QtdC60L7Qs9C00LAg0LHRi9C70L4uIjsKJHRleHQxID0gInJvc2VzIGFyZSByZWQsYW5kIHZpb2xldHMgYXJlIGJsdWUud2hhdGV2ZXIgeW91IGRvIGknbGwga2VlcCBpdCBmb3IgeW91LiI7CiR0ZXh0MiA9ICLQv9GA0LjQstC10YIu0LXRgdGC0YwgMiDRhNGD0L3QutGG0LjQuCxwcmVnX3NwbGl0INC4IGV4cGxvZGUgLNC90LUg0L/QvtC90LjQvNCw0Y4s0LIg0YfQtdC8INC80LXQttC00YMg0L3QuNC80Lgg0YDQsNC30L3QuNGG0LAuIjsKJHRleHRBcnJ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