Extended strtok documentation to include information about multiple tokens

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@66939 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Zak Greant 2002-01-05 01:03:24 +00:00
parent bff8a39459
commit a5b950133b

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.150 $ -->
<!-- $Revision: 1.151 $ -->
<reference id="ref.strings">
<title>String functions</title>
<titleabbrev>Strings</titleabbrev>
@ -3386,16 +3386,19 @@ print $domain; // prints @designmultimedia.com
</funcprototype>
</funcsynopsis>
<para>
<function>strtok</function> is used to tokenize a string. That
is, if you have a string like "This is an example string" you
<function>strtok</function> splits a string (<parameter>arg1</parameter>)
into smaller strings (tokens), with each token being delimited by any
character from <parameter>arg2</parameter>.
That is, if you have a string like "This is an example string" you
could tokenize this string into its individual words by using the
space character as the token.
<example>
<title><function>strtok</function> example</title>
<programlisting role="php">
<![CDATA[
$string = "This is an example string";
$tok = strtok($string," ");
$string = "This is\tan example\nstring";
/* Use tab and newline as tokenizing characters as well */
$tok = strtok($string," \n\t");
while ($tok) {
echo "Word=$tok<br>";
$tok = strtok(" ");