pregSplit() публичный Метод

Examples:: String.pregSplit("foo bar baz", "/\s+/") == ['foo', 'bar', 'baz'] String.pregSplit("first second third", "/\s+/", 2) == ['first', 'second third']
public pregSplit ( string $string, string $pattern, integer $limit = null ) : array
$string string The input string
$pattern string A PREG pattern
$limit integer The maximum amount of items to return, in contrast to split() this will return all remaining characters in the last item (see example)
Результат array An array of the splitted parts, excluding the matched pattern
 /**
  * @test
  * @dataProvider pregSplitExamples
  */
 public function pregMSplitWorks($string, $pattern, $limit, $expected)
 {
     $helper = new StringHelper();
     $result = $helper->pregSplit($string, $pattern, $limit);
     $this->assertSame($expected, $result);
 }