Name
strtok
Synopsis
string strtok(stringstring
, stringtoken
)string strtok(stringtoken
)
Breaks string
into tokens separated
by any of the characters in token
and
returns the next token found. The first time you call strtok( )
on a string, use the first
function prototype; afterward, use the second, providing only the
tokens. The function contains an internal pointer for each string it
is called with. For example:
$string = "This is the time for all good men to come to the aid of their country." $current = strtok($string, " .;,\"'"); while(!($current === FALSE)) { print($current . "<br />"; }
Get Programming PHP, 2nd Edition 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.