derick          Sun Dec 16 05:34:01 2001 EDT

  Modified files:              
    /phpdoc/en/functions        strings.xml 
  Log:
  - Added changed strtok behavior to the manual
  
  
Index: phpdoc/en/functions/strings.xml
diff -u phpdoc/en/functions/strings.xml:1.139 phpdoc/en/functions/strings.xml:1.140
--- phpdoc/en/functions/strings.xml:1.139       Sat Dec 15 09:52:19 2001
+++ phpdoc/en/functions/strings.xml     Sun Dec 16 05:34:01 2001
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.139 $ -->
+<!-- $Revision: 1.140 $ -->
  <reference id="ref.strings">
   <title>String functions</title>
   <titleabbrev>Strings</titleabbrev>
@@ -3424,6 +3424,41 @@
      multiple tokens in the token parameter.  The string will be
      tokenized when any one of the characters in the argument are
      found.
+    </para>
+    <para>
+     The behavior when an empty part was found changed with PHP 4.1.0. The old
+     behavior returned an empty string, while the new, correct, behavior
+     simply skips the part of the string:
+     <example>
+      <title>Old <function>strtok</function> behavior</title>
+      <programlisting role="php">
+<![CDATA[
+    $first_token  = strtok('/something', '/');
+    $second_token = strtok('/');
+    var_dump ($first_token, $second_token);
+
+/* Output:
+    string(0) ""
+    string(9) "something"
+*/    
+]]>
+      </programlisting>
+     </example>
+     <example>
+      <title>New <function>strtok</function> behavior</title>
+      <programlisting role="php">
+<![CDATA[
+    $first_token  = strtok('/something', '/');
+    $second_token = strtok('/');
+    var_dump ($first_token, $second_token);
+
+/* Output:
+    string(9) "something"
+    bool(false)
+*/    
+]]>
+      </programlisting>
+     </example>
     </para>
     <para>
      Also be careful that your tokens may be equal to "0". This


Reply via email to