php strtok() function


  Translation results:

UK[ˈtəʊkən] US[ˈtoʊkən]

##n. Symbol; mark; token

adj. Symbolic; as a guarantee for something; as a sign

vt. Omen: omen or symbol, omen

php strtok() functionsyntax

Function:Split the string one by one

Syntax: strtok(string,split)

Parameters:

Parameter Description
stringRequired. Specifies the string to be split.
splitRequired. Specifies one or more delimiting characters.

Description: strtok() function splits a string into smaller strings (markers).

php strtok() functionexample

<?php
$string = "Hello world. I'm study in php.cn!";
$token = strtok($string, ".");
while ($token !== false)
{    
echo "$token<br>";    
$token = strtok(".");
}
?>

Run instance»

Click the "Run instance" button to view the online instance

Output:

Hello world
I'm study in php
cn!

Home

Videos

Q&A