[lang-ref] ( split_words ) ( php )
<?php
public function testSplitWords(): void
{
// preg_split('/\s+/', $s)
$text = "This is a pen.\nI'm not a pen. (not a pen)";
$elems = preg_split('/\s+/', $text, -1, PREG_SPLIT_NO_EMPTY);
$this->assertNotFalse($elems);
$this->assertSame(['This', 'is', 'a', 'pen.', "I'm", 'not', 'a', 'pen.', '(not', 'a', 'pen)'], $elems);
}