philip          Sun Jun 22 19:17:14 2003 EDT

  Modified files:              
    /phpdoc/en/reference/array/functions        range.xml 
  Log:
  Clarify the feature of "character sequences", and caution that numeric strings 
  are seen as strings and not integers prior to PHP 4.3.3, so used as character 
sequences.
  This documents bug #24420
  
  
Index: phpdoc/en/reference/array/functions/range.xml
diff -u phpdoc/en/reference/array/functions/range.xml:1.8 
phpdoc/en/reference/array/functions/range.xml:1.9
--- phpdoc/en/reference/array/functions/range.xml:1.8   Tue Feb  4 12:19:32 2003
+++ phpdoc/en/reference/array/functions/range.xml       Sun Jun 22 19:17:14 2003
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.8 $ -->
+<!-- $Revision: 1.9 $ -->
 <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 -->
   <refentry id="function.range">
    <refnamediv>
@@ -39,8 +39,8 @@
       <programlisting role="php">
 <![CDATA[
 <?php
-// array(0,1,2,3,4,5,6,7,8,9)
-foreach(range(0, 9) as $number) {
+// array(0,1,2,3,4,5,6,7,8,9,10,11,12)
+foreach(range(0, 12) as $number) {
     echo $number;
 }
 
@@ -50,7 +50,7 @@
     echo $number;
 }
 
-// Use of characters introduced in 4.1.0
+// Use of character sequences introduced in 4.1.0
 // array('a','b','c','d','e','f','g','h','i');
 foreach(range('a', 'i') as $letter) {
     echo $letter;
@@ -66,11 +66,21 @@
     </para>
     <note>
      <para>
-      Prior to version 4.1.0 the <function>range</function> function
-      only generated incrementing integer arrays.  Support for
-      character sequences and decrementing arrays was added in 4.1.0.
+      Prior to PHP version 4.1.0, <function>range</function> only generated
+      incrementing integer arrays.  Support for character sequences and
+      decrementing arrays was added in 4.1.0.  Character sequence values
+      are limited to a length of one.  If a length greater than one is
+      entered, only the first character is used.
      </para>
     </note>
+    <caution>
+     <para>
+      In PHP versions 4.1.0 through 4.3.2, <function>range</function> sees
+      numeric strings as strings and not integers.  Instead, they will be
+      used for character sequences.  For example, <literal>"4242"</literal>
+      is treated as <literal>"4"</literal>.
+     </para>
+    </caution>
     <para>
      See also <function>shuffle</function> and
      <link linkend="control-structures.foreach">foreach</link>.



-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to