← All built-ins / str_split()

str_split()

str_split(...$args): mixed

Parameters

NameTypeDescription
$sstringstring to cut
$lenintchunk length (default 1)optional

Return value

Array of chunks.

Example

echo implode("|", str_split("abc")), "
";
echo implode("|", str_split("abcdef", 2)), "
";
a|b|c
ab|cd|ef

See also

explode()str_repeat()