PHP strtok() Function

The strtok() function splits a string into smaller strings (tokens).

string strtok ( string $str , string $token )
string strtok ( string $token )

Example -

Example #1 strtok() example

Example #2 strtok() behavior on empty part found

ParameterDescription
strThe string being split up into smaller strings (tokens).
tokenThe delimiter used when splitting up str.

A string token.