PHP strtok() Function
The strtok()
function is used to splits a string into smaller strings used tokenize.
Syntax
strtok(string,split)
- String - (Required) Specify the string to split.
- split - (Required) Specify the one or more split characters.
Example
<?php $a = "Good Morning Students.Have a nice day"; $token = strtok($a, " "); while ($token !== false) { echo "$token<br>"; $token = strtok(" "); } ?>
Output
Good Morning Students.Have a nice day