← All docs

preg_split()

Splits a string by a regular expression.

preg_split()

function preg_split(string $pattern, string $subject, int $limit = -1, int $flags = 0): array

Splits a string by a regular expression.

Parameters:

  • $pattern (string)
  • $subject (string)
  • $limit (int), default -1, optional
  • $flags (int), default 0, optional

Returns: array

No examples yet — check examples/ and showcases/ for usage patterns.

Internals

For how preg_split is implemented in the compiler, see the internals page.