derick          Fri May 28 06:56:37 2004 EDT

  Modified files:              
    /phpdoc/en/appendices       migration5.xml 
    /phpdoc/en/reference/network/functions      ip2long.xml 
  Log:
  - Document ip2long() change.
  
  
http://cvs.php.net/diff.php/phpdoc/en/appendices/migration5.xml?r1=1.20&r2=1.21&ty=u
Index: phpdoc/en/appendices/migration5.xml
diff -u phpdoc/en/appendices/migration5.xml:1.20 
phpdoc/en/appendices/migration5.xml:1.21
--- phpdoc/en/appendices/migration5.xml:1.20    Wed May 26 08:29:17 2004
+++ phpdoc/en/appendices/migration5.xml Fri May 28 06:56:36 2004
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.20 $ -->
+<!-- $Revision: 1.21 $ -->
  <appendix id="migration5">
   <title>Migrating from PHP 4 to PHP 5</title>
 
@@ -80,6 +80,11 @@
       that rely on the previous behaviour (the class name was lowercased).
       A possible solution is to search for <function>get_class</function> in
       all your scripts and use <function>strtolower</function>.
+    </simpara></listitem>
+    <listitem><simpara>
+      <function>ip2long</function> now returns FALSE when an invalid IP
+      address is passed as argument to the function, and no longer
+      <literal>-1</literal>.
     </simpara></listitem>
    </itemizedlist>
 
http://cvs.php.net/diff.php/phpdoc/en/reference/network/functions/ip2long.xml?r1=1.5&r2=1.6&ty=u
Index: phpdoc/en/reference/network/functions/ip2long.xml
diff -u phpdoc/en/reference/network/functions/ip2long.xml:1.5 
phpdoc/en/reference/network/functions/ip2long.xml:1.6
--- phpdoc/en/reference/network/functions/ip2long.xml:1.5       Sat Apr  3 08:51:25 
2004
+++ phpdoc/en/reference/network/functions/ip2long.xml   Fri May 28 06:56:36 2004
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.5 $ -->
+<!-- $Revision: 1.6 $ -->
 <!-- splitted from ./en/functions/network.xml, last change in rev 1.18 -->
   <refentry id="function.ip2long">
    <refnamediv>
@@ -21,6 +21,12 @@
      representation.  If <parameter>ip_address</parameter> is invalid then
      <literal>-1</literal> is returned.  Note that <literal>-1</literal>
      does not evaluate as &false; in PHP.
+    </para>
+    <para>
+     In PHP 5 <function>ip2long</function> returns <literal>FALSE</literal>
+     when the <parameter>ip_address</parameter> is in valid.
+    </para>
+    <para>
      <example>
       <title><function>ip2long</function> Example</title>
       <programlisting role="php">
@@ -34,6 +40,8 @@
 ]]>
       </programlisting>
      </example>
+    </para>
+    <para>
      <note>
       <para>
        Because PHP's integer type is signed, and many IP addresses will
@@ -42,10 +50,12 @@
        the string representation of the unsigned IP address.
       </para>
      </note>
+    </para>
+    <para>
      This second example shows how to print a converted address with the
-     <function>printf</function> function :
+     <function>printf</function> function in PHP 4:
      <example>
-      <title>Displaying an IP address</title>
+      <title>Displaying an IP address (PHP 4)</title>
       <programlisting role="php">
 <![CDATA[
 <?php
@@ -65,6 +75,29 @@
      </example>
     </para>
     <para>
+     This third example shows how to print a converted address with the
+     <function>printf</function> function in PHP 5:
+     <example>
+      <title>Displaying an IP address (PHP 4)</title>
+      <programlisting role="php">
+<![CDATA[
+<?php
+$ip   = gethostbyname("www.example.com");
+$long = ip2long($ip);
+
+if ($long === false) {
+    echo "Invalid IP, please try again";
+} else {
+    echo $ip   . "\n";           // 192.0.34.166
+    echo $long . "\n";           // -1073732954
+    printf("%u\n", ip2long($ip)); // 3221234342
+}
+?>
+]]>
+      </programlisting>
+     </example>
+    </para>
+    <para>
      <function>ip2long</function> will also work with non-complete ip
      adresses. Read <ulink url="&url.ip2long.tech;">&url.ip2long.tech;</ulink>
      for more info.
@@ -72,7 +105,7 @@
     <note>
      <para>
       <function>ip2long</function> will return <literal>-1</literal> for
-      the ip 255.255.255.255
+      the IP 255.255.255.255
      </para>
     </note>
     <para>

Reply via email to