PHP strtok() Function
PHP strtok() Function
The strtok() function in PHP splits a string into smaller strings or tokenize the specified string.
Syntax
strtok ( string $str , string $token )
Parameter
str(required)- This parameter represents the input string to split into smaller strings or tokens.
token(required)- It signifies the delimiter which is used in splitting up the str parameter.
Return
This function returns a string token.
Example 1
Output
String: Hello User! How you have been? Removing the spaces in between the string New string: HelloUser!Howyouhavebeen?Example 2
Output
String: Hello User! How you have been? Returned string: Hello UserExample 3
Output
Students List: Reema Rahul Varun Amar Shivam Radha