The strtok() function is a tokenize string. It returns a string token.
Syntax
strtok(str, split)
Parameters
str − The string to split
split − Specifies one or more split characters
Return
The strtok() function returns a string token.
Example
The following is an example −
<?php $str = "This is it!"; $token = strtok($str, " "); while ($token !== false){ echo "$token<br>"; $token = strtok(" "); } ?>
Output
The following is the output −
This<br>is<br>it!<br>