Я пытаюсь разделить строку с помощью preg_split, но хочу включить разделители и не хочу захватывать пустую строку. Как бы мне это сделать?
$inputX = "hello1.hello2.";
$tempInput = preg_split( "~(\?|\.|!|\,)~", $inputX); //split the input at .!?,
print_r($tempInput)
Результат:
Array ( [0] => hello1 [1] => hello2 [2] => )
Нужный результат:
Array ( [0] => hello1. [1] => hello2.
Подробнее здесь: https://stackoverflow.com/questions/332 ... he-symbols