strtok

string strtok([string string], string delimiter) 

Fetches tokens from a string.

Returns:

String; FALSE when the end of the string is reached

Description:

strtok() is used to iteratively parse a string into substrings.

The function should initially be called with both string and delimiter arguments, which does the following:

  • Sets the string to be used by the function for subsequent calls.

  • Returns the first token from the string. The first token is defined as the substring that extends from the first character in the string to the first instance of any of the characters in delimiter . If none of the characters in delimiter are present in the string, the entire string is returned.

Subsequent calls to strtok() returns a new substring that ...

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.