[PHP-DOC] cvs: phpdoc /en/language types.xml From: jim winstead (jimw <email protected>)
Date: 10/30/01

jimw Tue Oct 30 21:02:21 2001 EDT

  Modified files:
    /phpdoc/en/language types.xml
  Log:
  put overflow examples together, and division example on its own. fix typo and another dash.
  
Index: phpdoc/en/language/types.xml
diff -u phpdoc/en/language/types.xml:1.57 phpdoc/en/language/types.xml:1.58
--- phpdoc/en/language/types.xml:1.57 Tue Oct 30 20:53:22 2001
+++ phpdoc/en/language/types.xml Tue Oct 30 21:02:20 2001
@@ -1,5 +1,5 @@
 <?xml encoding="iso-8859-1"?>
-<!-- $Revision: 1.57 $ -->
+<!-- $Revision: 1.58 $ -->
  <chapter id="language.types">
   <title>Types</title>
 
@@ -312,38 +312,26 @@
     <sect2 id="language.types.integer.overflow">
      <title>Integer overflow</title>
      <para>
- If you specify a number beyond the bounds of the <type>integer</type> type,
- it will be interpreted as a <type>float</type> instead.
- </para>
- <para>
- In PHP there is also no such thing as integer division.
- <literal>1/2</literal> yields the <type>float</type>
- <literal>0.5</literal>. <!-- See ??? for more information. (with the
- operators, or with type-jug) -->
+ If you specify a number beyond the bounds of the <type>integer</type>
+ type, it will be interpreted as a <type>float</type> instead. Also, if
+ you perform an operation that results in a number beyond the bounds of
+ the <type>integer</type> type, a <type>float</type> will be returned
+ instead.
+
       <informalexample>
        <programlisting role="php">
 $large_number = 2147483647;
 var_dump($large_number);
 // output: int(2147483647)
+
 $large_number = 2147483648;
 var_dump($large_number);
 // output: float(2147483648)
 
 // this goes also for hexadecimal specified integers:
-
 var_dump( 0x80000000 );
 // output: float(2147483648)
 
-var_dump( 25/7 );
-// output: float(3.5714285714286)
- </programlisting>
- </informalexample>
- Furthermore, if some function or operator yields a number that is beyond
- the boundaries of <type>integer</type>, it will also
- be automatically converted to
- <type>float</type>.
- <informalexample>
- <programlisting role="php">
 $million = 1000000;
 $large_number = 50000 * $million;
 var_dump($large_number);
@@ -360,10 +348,22 @@
         positive there is no problem.
        </simpara>
        <simpara>
- This is solved in PHP 4.1.0
+ This is solved in PHP 4.1.0.
        </simpara>
       </warning>
      </para>
+ <para>
+ There is no integer division operator in PHP.
+ <literal>1/2</literal> yields the <type>float</type>
+ <literal>0.5</literal>. <!-- See ??? for more information. (with the
+ operators, or with type-jug) -->
+ <informalexample>
+ <programlisting role="php">
+var_dump( 25/7 );
+// output: float(3.5714285714286)
+ </programlisting>
+ </informalexample>
+ </para>
     </sect2>
    
 
@@ -373,8 +373,8 @@
        To explicitly convert a value to <type>integer</type>, use either
        the <literal>(int)</literal> or the <literal>(integer)</literal> cast.
        However, in most cases you do not need to use the cast, since a value
- will be autmatically converted if an operator, function or
- control structure requires a <type>integer</type>-argument.
+ will be automatically converted if an operator, function or
+ control structure requires a <type>integer</type> argument.
       </simpara>
       <simpara>
        See also <link linkend="language.types.type-juggling">type-juggling</link>.