← All built-ins / preg_split()

preg_split()

preg_split(...$args): mixed

Parameters

NameTypeDescription
$patternstring/…/ pattern acting as delimiter
$subjectstringstring to split

Return value

Array of the pieces between matches.

Example

$p = preg_split("/[,:]+/", "a,b:c,,d");
echo implode("|", $p);
a|b|c|d

See also

explode()preg_match()