<?php
$text = "привет.есть 2 функции,preg_split и explode ,не понимаю,в чем между ними разница.";
// Для тестов
// $text = 'roses are red,and violets are blue.whatever you do i'll keep it for you.';
// $text = 'привет.есть 2 функции,preg_split и explode ,не понимаю,в чем между ними разница.';
$regexp = '/[.!?]/u';
$sentence = preg_split($regexp, $text, -1, PREG_SPLIT_NO_EMPTY
);
foreach ($sentence as $value){
$uppertext = $uppertext. $value. ". ";
};
$regexpArray = [
'/[ ]+([.,:;!?])/u' => '$1',
'/([.,:;!?])([а-яёa-z])/u' => '$1 $2'
];
foreach($regexpArray as $regKey => $regValue){
};
echo $uppertext;
PD9waHAKCmVycm9yX3JlcG9ydGluZygtMSk7Cm1iX2ludGVybmFsX2VuY29kaW5nKCd1dGYtOCcpOwoKJHRleHQgPSAi0L/RgNC40LLQtdGCLtC10YHRgtGMIDIg0YTRg9C90LrRhtC40LgscHJlZ19zcGxpdCDQuCBleHBsb2RlICzQvdC1INC/0L7QvdC40LzQsNGOLNCyINGH0LXQvCDQvNC10LbQtNGDINC90LjQvNC4INGA0LDQt9C90LjRhtCwLiI7Ci8vINCU0LvRjyDRgtC10YHRgtC+0LIKLy8gJHRleHQgPSAncm9zZXMgYXJlIHJlZCxhbmQgdmlvbGV0cyBhcmUgYmx1ZS53aGF0ZXZlciB5b3UgZG8gaSdsbCBrZWVwIGl0IGZvciB5b3UuJzsKLy8gJHRleHQgPSAn0L/RgNC40LLQtdGCLtC10YHRgtGMIDIg0YTRg9C90LrRhtC40LgscHJlZ19zcGxpdCDQuCBleHBsb2RlICzQvdC1INC/0L7QvdC40LzQsNGOLNCyINGH0LXQvCDQvNC10LbQtNGDINC90LjQvNC4INGA0LDQt9C90LjRhtCwLic7CgokcmVnZXhwID0gJy9bLiE/XS91JzsKCiRzZW50ZW5jZSA9IHByZWdfc3BsaXQoJHJlZ2V4cCwgJHRleHQsIC0xLCBQUkVHX1NQTElUX05PX0VNUFRZKTsKCmZvcmVhY2ggKCRzZW50ZW5jZSBhcyAkdm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