nicobn          Fri Aug 17 13:58:28 2007 UTC

  Modified files:              
    /phpdoc/en/reference/sockets/functions      socket-last-error.xml 
  Log:
  Added more verbose example + fixed grammatical error in synopsis
  
  
http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/sockets/functions/socket-last-error.xml?r1=1.11&r2=1.12&diff_format=u
Index: phpdoc/en/reference/sockets/functions/socket-last-error.xml
diff -u phpdoc/en/reference/sockets/functions/socket-last-error.xml:1.11 
phpdoc/en/reference/sockets/functions/socket-last-error.xml:1.12
--- phpdoc/en/reference/sockets/functions/socket-last-error.xml:1.11    Tue Jul 
 3 19:53:55 2007
+++ phpdoc/en/reference/sockets/functions/socket-last-error.xml Fri Aug 17 
13:58:27 2007
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.11 $ -->
+<!-- $Revision: 1.12 $ -->
 <refentry xmlns="http://docbook.org/ns/docbook"; 
xml:id="function.socket-last-error">
  <refnamediv>
   <refname>socket_last_error</refname>
@@ -16,22 +16,12 @@
    If a socket resource is passed to this function, the last error which
    occurred on this particular socket is returned. If the socket resource is
    omitted, the error code of the last failed socket function is returned.
-   The latter is in particular helpful for functions like
+   The latter is particularly helpful for functions like
    <function>socket_create</function> which don't return a socket on
    failure and <function>socket_select</function> which can fail for reasons
    not directly tied to a particular socket.  The error code is suitable to
    be fed to <function>socket_strerror</function> which returns a string
    describing the given error code.
-   <programlisting role="php">
-<![CDATA[
-<?php
-if (false == ($socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP))) {
-    die("Couldn't create socket, error code is: " . socket_last_error() .
-        ",error message is: " . socket_strerror(socket_last_error()));
-}
-?>
-]]>
-   </programlisting>
   </para>
  </refsect1>
 
@@ -58,6 +48,29 @@
   </para>
  </refsect1>
 
+ <refsect1 role="examples">
+  &reftitle.examples;
+  <para>
+   <example>
+    <title><function>socket_last_error</function> example</title>
+    <programlisting role="php">
+<![CDATA[
+<?php
+$socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
+
+if ($socket === false) {
+    $errorcode = socket_last_error();
+    $errormsg = socket_strerror($errorcode);
+    
+    die("Couldn't create socket: [$errorcode] $errormsg");
+}
+?>
+]]>
+    </programlisting>
+   </example>
+  </para>
+ </refsect1>
+
  <refsect1 role="notes">
   &reftitle.notes;
   <note>

Reply via email to