corean          Tue Jan  9 17:05:50 2001 EDT

  Added files:                 
    /phpdoc/kr/functions        apache.xml array.xml aspell.xml bc.xml 
                                calendar.xml ccvs.xml classobj.xml com.xml 
                                cpdf.xml curl.xml cybercash.xml datetime.xml 
                                dba.xml dbase.xml dbm.xml dir.xml domxml.xml 
                                errorfunc.xml exec.xml fdf.xml filepro.xml 
                                filesystem.xml ftp.xml funchand.xml 
                                gettext.xml gmp.xml http.xml hw.xml ibase.xml 
                                icap.xml ifx.xml image.xml imap.xml info.xml 
                                ingres_ii.xml ldap.xml mail.xml math.xml 
                                mcal.xml mcrypt.xml mhash.xml misc.xml 
                                msql.xml mssql.xml mysql.xml network.xml 
                                nis.xml oci8.xml openssl.xml oracle.xml 
                                outcontrol.xml ovrimos.xml pcre.xml pdf.xml 
                                pfpro.xml pgsql.xml posix.xml pspell.xml 
                                readline.xml recode.xml regex.xml 
                                satellite.xml sem.xml sesam.xml session.xml 
                                shmop.xml snmp.xml sockets.xml strings.xml 
                                swf.xml sybase.xml uodbc.xml url.xml var.xml 
                                wddx.xml xml.xml xslt.xml yaz.xml zlib.xml 

  Modified files:              
    /phpdoc/kr/functions        dl.xml 
  Log:
  ¿µ¾î¹öÀüÀ» UTF-8·Î ¿£ÄÚµùÇØ¼­ ¿Ã¸²
  
  
  
Index: phpdoc/kr/functions/dl.xml
diff -u /dev/null phpdoc/kr/functions/dl.xml:1.5
--- /dev/null   Tue Jan  9 17:05:48 2001
+++ phpdoc/kr/functions/dl.xml  Tue Jan  9 17:05:47 2001
@@ -0,0 +1,43 @@
+ <reference id="ref.dl">
+  <title>Dynamic Loading functions</title>
+  <titleabbrev>Dyn.loading</titleabbrev>
+
+  <refentry id="function.dl">
+   <refnamediv>
+    <refname>dl</refname>
+    <refpurpose>load a PHP extension at runtime</refpurpose>
+   </refnamediv>
+   <refsect1>
+    <title>Description</title>
+    <funcsynopsis>
+     <funcprototype>
+      <funcdef>int <function>dl</function></funcdef>
+      <paramdef>string <parameter>library</parameter></paramdef>
+     </funcprototype>
+    </funcsynopsis>
+    <para>
+     Loads the PHP extension defined in
+     <parameter>library</parameter>.  See also the <link
+     linkend="ini.extension-dir">extension_dir</link> configuration
+     directive.
+    </para>
+   </refsect1>
+  </refentry>
+ </reference>
+
+<!-- Keep this comment at the end of the file
+Local variables:
+mode: sgml
+sgml-omittag:t
+sgml-shorttag:t
+sgml-minimize-attributes:nil
+sgml-always-quote-attributes:t
+sgml-indent-step:1
+sgml-indent-data:t
+sgml-parent-document:nil
+sgml-default-dtd-file:"../../manual.ced"
+sgml-exposed-tags:nil
+sgml-local-catalogs:nil
+sgml-local-ecat-files:nil
+End:
+-->

Index: phpdoc/kr/functions/apache.xml
+++ phpdoc/kr/functions/apache.xml
 <reference id="ref.apache">
  <title>Apache-specific Functions</title>
  <titleabbrev>Apache</titleabbrev>

  <refentry id="function.apache-lookup-uri">
   <refnamediv>
    <refname>apache_lookup_uri</refname>
    <refpurpose>
     Perform a partial request for the specified URI and return all
     info about it
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>class <function>apache_lookup_uri</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This performs a partial request for a URI.  It goes just far
     enough to obtain all the important information about the given
     resource and returns this information in a class.  The properties
     of the returned class are:
     <simplelist>
      <member>status</member>
      <member>the_request</member>
      <member>status_line</member>
      <member>method</member>
      <member>content_type</member>
      <member>handler</member>
      <member>uri</member>
      <member>filename</member>
      <member>path_info</member>
      <member>args</member>
      <member>boundary</member>
      <member>no_cache</member>
      <member>no_local_copy</member>
      <member>allowed</member>
      <member>send_bodyct</member>
      <member>bytes_sent</member>
      <member>byterange</member>
      <member>clength</member>
      <member>unparsed_uri</member>
      <member>mtime</member>
      <member>request_time</member>
     </simplelist>
    </para>
    <note>
     <simpara>
      <function>Apache_lookup_uri</function> only works when PHP
      is installed as an Apache module.
     </simpara>
    </note>
   </refsect1>
  </refentry>
  
  <refentry id="function.apache-note">
   <refnamediv>
    <refname>apache_note</refname>
    <refpurpose>Get and set apache request notes</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>apache_note</function></funcdef>
      <paramdef>string <parameter>note_name</parameter></paramdef>
      <paramdef>string 
       <parameter>
        <optional>note_value</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Apache_note</function> is an Apache-specific function
     which gets and sets values in a request's
     <literal>notes</literal> table. If called with one argument, it
     returns the current value of note
     <literal>note_name</literal>. If called with two arguments, it
     sets the value of note <literal>note_name</literal> to
     <literal>note_value</literal> and returns the previous value of
     note <literal>note_name</literal>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.getallheaders">
   <refnamediv>
    <refname>getallheaders</refname>
    <refpurpose>Fetch all HTTP request headers</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>getallheaders</function></funcdef>
      <paramdef>void<parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns an associative array of all the HTTP
     headers in the current request.
    </para>
    <para>
     <note>
      <para>
       You can also get at the value of the common CGI variables by
       reading them from the environment, which works whether or not
       you are using PHP as an Apache module. Use
       <function>phpinfo</function> to see a list of all of the
       environment variables defined this way.
      </para>
     </note>
    </para>
    <para>
     <example>
      <title><function>getallheaders</function> Example</title>
      <programlisting role="php">
$headers = getallheaders();
while (list ($header, $value) = each ($headers)) {
    echo "$header: $value&lt;br&gt;\n";
}
      </programlisting>
     </example>
    </para>
    <para>
     This example will display all the request headers for the current
     request.
     <note>
      <simpara>
       <function>Getallheaders</function> is currently only supported
       when PHP runs as an <productname>Apache</productname> module.
      </simpara>
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.virtual">
   <refnamediv>
    <refname>virtual</refname>
    <refpurpose>Perform an Apache sub-request</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>virtual</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Virtual</function> is an Apache-specific function which
     is equivalent to &lt;!--#include virtual...--&gt; in mod_include.
     It performs an Apache sub-request.  It is useful for including
     CGI scripts or .shtml files, or anything else that you would
     parse through Apache.  Note that for a CGI script, the script
     must generate valid CGI headers.  At the minimum that means it
     must generate a Content-type header.  For PHP files, you need to
     use <function>include</function> or <function>require</function>;
     <function>virtual</function> cannot be used to include a document
     which is itself a PHP file.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ascii2ebcdic">
   <refnamediv>
    <refname>ascii2ebcdic</refname>
    <refpurpose>Translate string from ASCII to EBCDIC</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ascii2ebcdic</function></funcdef>
      <paramdef>string <parameter>ascii_str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ascii2ebcdic</function> is an Apache-specific function which
     is available only on EBCDIC based operating systems (OS/390, BS2000).
     It translates the ASCII encoded string <parameter>ascii_str</parameter>
     to its equivalent EBCDIC representation (binary safe), and returns
     the result.
    </para>
    <para>
     See also the reverse function <function>ebcdic2ascii</function> 
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ebcdic2ascii">
   <refnamediv>
    <refname>ebcdic2ascii</refname>
    <refpurpose>Translate string from EBCDIC to ASCII</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ebcdic2ascii</function></funcdef>
      <paramdef>string <parameter>ebcdic_str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ebcdic2ascii</function> is an Apache-specific function which
     is available only on EBCDIC based operating systems (OS/390, BS2000).
     It translates the EBCDIC encoded string <parameter>ebcdic_str</parameter>
     to its equivalent ASCII representation (binary safe), and returns
     the result.
    </para>
    <para>
     See also the reverse function <function>ascii2ebcdic</function> 
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/array.xml
+++ phpdoc/kr/functions/array.xml
 <reference id="ref.array">
  <title>Array Functions</title>
  <titleabbrev>Arrays</titleabbrev>
  <partintro>
   <simpara>
    These functions allow you to interact with and manipulate
    arrays in various ways. Arrays are essential for storing,
    managing, and operating on sets of variables.
   </simpara>
   <simpara>
    Simple and multi-dimensional arrays are supported, and may be
    either user created or created by another function.
    There are specific database handling functions for populating
    arrays from database queries, and several functions return arrays.
   </simpara>
   <para>
    See also <function>is_array</function>, <function>explode</function>, 
    <function>implode</function>, <function>split</function> 
    and <function>join</function>.
   </para>
  </partintro>

  <refentry id="function.array">
   <refnamediv>
    <refname>array</refname>
    <refpurpose>
     Create an array
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>array</function></funcdef>
      <paramdef>mixed 
       <parameter><optional>...</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of the parameters.  The parameters can be given
     an index with the <literal>=&gt;</literal> operator.
    </para>
    <para>
     <note>
      <para>
       <function>Array</function> is a language construct used to
       represent literal arrays, and not a regular function.
      </para>
     </note>
    </para>
    <para>
     Syntax "index =&gt; values", separated by commas, define index
     and values. index may be of type string or numeric. When index is
     omitted, a integer index is automatically generated, starting
     at 0. If index is an integer, next generated index will
     be the biggest integer index + 1. Note that when two identical
     index are defined, the last overwrite the first.
    </para>
    <para>
     The following example demonstrates how to create a
     two-dimensional array, how to specify keys for associative
     arrays, and how to skip-and-continue numeric indices in normal
     arrays.
     <example>
      <title><function>Array</function> example</title>
      <programlisting role="php">
$fruits = array (
    "fruits"  =&gt; array ("a"=&gt;"orange", "b"=&gt;"banana", "c"=&gt;"apple"),
    "numbers" =&gt; array (1, 2, 3, 4, 5, 6),
    "holes"   =&gt; array ("first", 5 =&gt; "second", "third")
);
      </programlisting>
     </example>
    </para>
    <para>
     <example>
      <title>Automatic index with <function>Array</function></title>
      <programlisting role="php">
$array = array( 1, 1, 1, 1,  1, 8=>1,  4=>1, 19, 3=>13);
print_r($array);
      </programlisting>
     </example>
     which will display : 
     <informalexample>
      <programlisting>
Array
(
    [0] => 1
    [1] => 1
    [2] => 1
    [3] => 13
    [4] => 1
    [8] => 1
    [9] => 19
)
      </programlisting>
     </informalexample>
     Note that index '3' is defined twice, and keep its final value of 13.
     Index 4 is defined after index 8, and next generated index (value 19)
     is 9, since biggest index was 8. 
    </para>
    <para>
     This example creates a 1-based array.
     <example>
      <title>1-based index with <function>Array</function></title>
      <programlisting role="php">
        $firstquarter  = array(1 => 'January', 'February', 'March');
        print_r($firstquarter);
      </programlisting>
     </example>
     which will display : 
     <informalexample>
      <programlisting>
Array 
(
    [1] => 'January'
    [2] => 'February'
    [3] => 'March'
)
      </programlisting>
     </informalexample>
    </para>
    <para>
     See also: <function>list</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.array-count-values">
   <refnamediv>
    <refname>array_count_values</refname>
    <refpurpose>Counts all the values of an array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>array_count_values</function></funcdef>
      <paramdef>array <parameter>input</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Array_count_values</function> returns an array using
     the values of the <parameter>input</parameter> array as keys and
     their frequency in <parameter>input</parameter> as values.
    </para>
    <para>
     <example>
      <title><function>Array_count_values</function> example</title>
      <programlisting role="php">
$array = array (1, "hello", 1, "world", "hello");
array_count_values ($array); // returns array (1=&gt;2, "hello"=&gt;2, "world"=&gt;1)
      </programlisting>
     </example>     
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.array-diff">
   <refnamediv>
    <refname>array_diff</refname>
    <refpurpose>Computes the difference of arrays</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>array_diff</function></funcdef>
      <paramdef>array <parameter>array1</parameter></paramdef>
      <paramdef>array <parameter>array2</parameter></paramdef>
      <paramdef>array
       <parameter><optional> ...</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Array_diff</function> returns an array
     containing all the values of <parameter>array1</parameter>
     that are not present in any of the other arguments.
     Note that keys are preserved.
    </para>
    <para>
     <example>
      <title><function>Array_diff</function> example</title>
      <programlisting role="php">
$array1 = array ("a" =&gt; "green", "red", "blue");
$array2 = array ("b" =&gt; "green", "yellow", "red");
$result = array_diff ($array1, $array2);
      </programlisting>
     </example>
    </para>     
    <para>
     This makes <varname>$result</varname> have <literal>array
     ("blue");</literal>
    </para>
    <para>
     See also <function>array_intersect</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.array-flip">
   <refnamediv>
    <refname>array_flip</refname>
    <refpurpose>Flip all the values of an array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>array_flip</function></funcdef>
      <paramdef>array <parameter>trans</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Array_flip</function> returns an array in flip order.
    </para>
    <para>
     <example>
      <title><function>Array_flip</function> example</title>
      <programlisting role="php">
$trans = array_flip ($trans);
$original = strtr ($str, $trans);
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.array-intersect">
   <refnamediv>
    <refname>array_intersect</refname>
    <refpurpose>Computes the intersection of arrays</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>array_intersect</function></funcdef>
      <paramdef>array <parameter>array1</parameter></paramdef>
      <paramdef>array <parameter>array2</parameter></paramdef>
      <paramdef>array
       <parameter><optional> ...</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Array_intersect</function> returns an array
     containing all the values of <parameter>array1</parameter>
     that are present in all the arguments.
     Note that keys are preserved.
    </para>
    <para>
     <example>
      <title><function>Array_intersect</function> example</title>
      <programlisting role="php">
$array1 = array ("a" =&gt; "green", "red", "blue");
$array2 = array ("b" =&gt; "green", "yellow", "red");
$result = array_intersect ($array1, $array2);
      </programlisting>
     </example>
    </para>     
    <para>
     This makes <varname>$result</varname> have <literal>array ("a"
     =&gt; "green", "red");</literal>
    </para>
    <para>
     See also <function>array_diff</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.array-keys">
   <refnamediv>
    <refname>array_keys</refname>
    <refpurpose>Return all the keys of an array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>array_keys</function></funcdef>
      <paramdef>array <parameter>input</parameter></paramdef>
      <paramdef>mixed
       <parameter>
        <optional>search_value</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Array_keys</function> returns the keys, numeric and
     string, from the <parameter>input</parameter> array.
    </para>
    <para>
     If the optional <parameter>search_value</parameter> is specified,
     then only the keys for that value are returned. Otherwise, all
     the keys from the <parameter>input</parameter> are returned.
    </para>
    <para>
     <example>
      <title><function>Array_keys</function> example</title>
      <programlisting role="php">
$array = array (0 =&gt; 100, "color" =&gt; "red");
array_keys ($array);       // returns array (0, "color")

$array = array ("blue", "red", "green", "blue", "blue");
array_keys ($array, "blue");  //  returns array (0, 3, 4) 
      </programlisting>
     </example>
    </para>
    <note>
     <para>
      This function was added to PHP 4, below is an implementation for
      those still using PHP 3.
      <example>
       <title>
    Implementation of <function>array_keys</function> for PHP 3
    users
       </title>
       <programlisting role="php">
function array_keys ($arr, $term="") {
    $t = array();
    while (list($k,$v) = each($arr)) {
        if ($term &amp;&amp; $v != $term)
            continue;
            $t[] = $k;
        }
        return $t;
}
       </programlisting>
      </example>
     </para>
    </note>
    <para>
     See also <function>array_values</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.array-merge">
   <refnamediv>
    <refname>array_merge</refname>
    <refpurpose>Merge two or more arrays</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>array_merge</function></funcdef>
      <paramdef>array <parameter>array1</parameter></paramdef>
      <paramdef>array <parameter>array2</parameter></paramdef>
      <paramdef>array
       <parameter><optional>...</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Array_merge</function> merges the elements of two or
     more arrays together so that the values of one are appended to
     the end of the previous one.  It returns the resulting array.
    </para>
    <para>
     If the input arrays have the same string keys, then the later
     value for that key will overwrite the previous one.  If, however, 
     the arrays have the same numeric key, the later value will not 
     overwrite the original value, but will be appended.
    </para>
    <para>
     <example>
      <title><function>array_merge</function> example</title>
      <programlisting role="php">
$array1 = array ("color" =&gt; "red", 2, 4);
$array2 = array ("a", "b", "color" =&gt; "green", "shape" =&gt; "trapezoid", 4);
array_merge ($array1, $array2);
      </programlisting>
     </example>
    </para>
    <para>
     Resulting array will be <literal>array("color" =&gt; "green", 2, 4,
     "a", "b", "shape" =&gt; "trapezoid", 4)</literal>.
    </para>
    <para>
     See also <function>array_merge_recursive</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.array-merge-recursive">
   <refnamediv>
    <refname>array_merge_recursive</refname>
    <refpurpose>Merge two or more arrays recursively</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>array_merge_recursive</function></funcdef>
      <paramdef>array <parameter>array1</parameter></paramdef>
      <paramdef>array <parameter>array2</parameter></paramdef>
      <paramdef>array
       <parameter><optional>...</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Array_merge_recursive</function> merges the elements of
     two or more arrays together so that the values of one are appended
     to the end of the previous one.  It returns the resulting array.
    </para>
    <para>
     If the input arrays have the same string keys, then the values for
     these keys are merged together into an array, and this is done
     recursively, so that if one of the values is an array itself, the
     function will merge it with a corresponding entry in another array
     too. If, however, the arrays have the same numeric key, the later
     value will not overwrite the original value, but will be appended.
    </para>
    <para>
     <example>
      <title><function>Array_merge_recursive</function> example</title>
      <programlisting role="php">
$ar1 = array ("color" =&gt; array ("favorite" =&gt; "red"), 5);
$ar2 = array (10, "color" =&gt; array ("favorite" =&gt; "green", "blue"));
$result = array_merge_recursive ($ar1, $ar2);
      </programlisting>
     </example>
    </para>
    <para>
     Resulting array will be <literal>array ("color" =&gt; array
     ("favorite" =&gt; array ("red", "green"), "blue"), 5, 10)</literal>.
    </para>
    <para>
     See also <function>array_merge</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.array-multisort">
   <refnamediv>
    <refname>array_multisort</refname>
    <refpurpose>Sort multiple or multi-dimensional arrays</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>array_multisort</function></funcdef>
      <paramdef>array <parameter>ar1</parameter></paramdef>
      <paramdef>mixed
       <parameter><optional>arg</optional></parameter>
      </paramdef>
      <paramdef>mixed
       <parameter><optional>...</optional></parameter>
      </paramdef>
      <paramdef>array
       <parameter><optional>...</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Array_multisort</function> can be used to sort several
     arrays at once or a multi-dimensional array according by one of
     more dimensions. It maintains key association when sorting.
    </para>
    <para>
     The input arrays are treated as columns of a table to be sorted
     by rows - this resembles the functionality of SQL ORDER BY
     clause. The first array is the primary one to sort by. The rows
     (values) in that array that compare the same are sorted by the
     next input array, and so on.
    </para>
    <para>
     The argument structure of this function is a bit unusual, but
     flexible. The very first argument has to be an
     array. Subsequently, each argument can be either an array or a
     sorting flag from the following lists.
    </para>
    <para>
     Sorting order flags:
     <itemizedlist>
      <listitem>
       <simpara>SORT_ASC - sort in ascending order</simpara>
      </listitem>
      <listitem>
       <simpara>SORT_DESC - sort in descending order</simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     Sorting type flags:
     <itemizedlist>
      <listitem>
       <simpara>SORT_REGULAR - compare items normally</simpara>
      </listitem>
      <listitem>
       <simpara>SORT_NUMERIC - compare items numerically</simpara>
      </listitem>
      <listitem>
       <simpara>SORT_STRING - compare items as strings</simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     No two sorting flags of the same type can be specified after each
     array. The sortings flags specified after an array argument apply
     only to that array - they are reset to default SORT_ASC and
     SORT_REGULAR after before each new array argument.
    </para>
    <para>
     Returns true on success, false on failure.
    </para>
    <para>
     <example>
      <title>Sorting multiple arrays</title>
      <programlisting role="php">
$ar1 = array ("10", 100, 100, "a");
$ar2 = array (1, 3, "2", 1);
array_multisort ($ar1, $ar2);
      </programlisting>
     </example>
    </para>
    <para>
     In this example, after sorting, the first array will contain 10,
     "a", 100, 100. The second array will contain 1, 1, 2, "3". The
     entries in the second array corresponding to the identical
     entries in the first array (100 and 100) were sorted as well.
    </para>
    <para>
     <example>
      <title>Sorting multi-dimensional array</title>
      <programlisting role="php">
$ar = array (array ("10", 100, 100, "a"), array (1, 3, "2", 1));
array_multisort ($ar[0], SORT_ASC, SORT_STRING, 
                 $ar[1], SORT_NUMERIC, SORT_DESC);
      </programlisting>
     </example>
    </para>
    <para>
     In this example, after sorting, the first array will contain 10,
     100, 100, "a" (it was sorted as strings in ascending order), and
     the second one will contain 1, 3, "2", 1 (sorted as numbers, in
     descending order).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.array-pad">
   <refnamediv>
    <refname>array_pad</refname>
    <refpurpose>
     Pad array to the specified length with a value
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>array_pad</function></funcdef>
      <paramdef>array <parameter>input</parameter></paramdef>
      <paramdef>int <parameter>pad_size</parameter></paramdef>
      <paramdef>mixed <parameter>pad_value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Array_pad</function> returns a copy of the
     <parameter>input</parameter> padded to size specified by
     <parameter>pad_size</parameter> with value
     <parameter>pad_value</parameter>. If
     <parameter>pad_size</parameter> is positive then the array is
     padded on the right, if it's negative then on the left. If the
     absolute value of <parameter>pad_size</parameter> is less than or
     equal to the length of the <parameter>input</parameter> then no
     padding takes place.
    </para>
    <para>
     <example>
      <title><function>Array_pad</function> example</title>
      <programlisting role="php">
$input = array (12, 10, 9);

$result = array_pad ($input, 5, 0);
// result is array (12, 10, 9, 0, 0)

$result = array_pad ($input, -7, -1);
// result is array (-1, -1, -1, -1, 12, 10, 9)

$result = array_pad ($input, 2, "noop");
// not padded
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.array-pop">
   <refnamediv>
    <refname>array_pop</refname>
    <refpurpose>Pop the element off the end of array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>array_pop</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Array_pop</function> pops and returns the last value of
     the <parameter>array</parameter>, shortening the
     <parameter>array</parameter> by one element.
    </para>
    <para>
     <example>
      <title><function>Array_pop</function> example</title>
      <programlisting role="php">
$stack = array ("orange", "apple", "raspberry");
$fruit = array_pop ($stack);
      </programlisting>
     </example>
    </para>
    <para>
     After this, <varname>$stack</varname> has only 2 elements:
     "orange" and "apple", and <varname>$fruit</varname> has
     "raspberry".
    </para>
    <para>
     See also <function>array_push</function>,
     <function>array_shift</function>, and
     <function>array_unshift</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.array-push">
   <refnamediv>
    <refname>array_push</refname>
    <refpurpose>
     Push one or more elements onto the end of array
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>array_push</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
      <paramdef>mixed
       <parameter><optional>...</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Array_push</function> treats
     <parameter>array</parameter> as a stack, and pushes the passed
     variables onto the end of <parameter>array</parameter>. The
     length of <parameter>array</parameter> increases by the number of
     variables pushed. Has the same effect as:
     <programlisting role="php">
$array[] = $var;
     </programlisting>
     repeated for each <parameter>var</parameter>.
    </para>
    <para>
     Returns the new number of elements in the array.
    </para>
    <para>
     <example>
      <title><function>Array_push</function> example</title>
      <programlisting role="php">
$stack = array (1, 2);
array_push ($stack, "+", 3);
      </programlisting>
     </example>
    </para>
    <para>
     This example would result in <varname>$stack</varname> having 4
     elements: 1, 2, "+", and 3.
    </para>
    <para>
     See also: <function>array_pop</function>,
     <function>array_shift</function>, and
     <function>array_unshift</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.array-rand">
   <refnamediv>
    <refname>array_rand</refname>
    <refpurpose>
     Pick one or more random entries out of an array
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>array_rand</function></funcdef>
      <paramdef>array <parameter>input</parameter></paramdef>
      <paramdef>int
       <parameter><optional>num_req</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Array_rand</function> is rather useful when you want to
     pick one or more random entries out of an array. It takes an
     <parameter>input</parameter> array and an optional argument
     <parameter>num_req</parameter> which specifies how many entries you
     want to pick - if not specified, it defaults to 1.
    </para>
    <para>
     If you are picking only one entry, <function>array_rand</function>
     returns the key for a random entry. Otherwise, it returns an array
     of keys for the random entries. This is done so that you can pick
     random keys as well as values out of the array.
    </para>
    <para>
     Don't forget to call <function>srand</function> to seed the random
     number generator.
    </para>
    <para>
     <example>
      <title><function>Array_rand</function> example</title>
      <programlisting role="php">
srand ((double) microtime() * 10000000);
$input = array ("Neo", "Morpheus", "Trinity", "Cypher", "Tank");
$rand_keys = array_rand ($input, 2);
print $input[$rand_keys[0]]."\n";
print $input[$rand_keys[1]]."\n";
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.array-reverse">
   <refnamediv>
    <refname>array_reverse</refname>
    <refpurpose>
     Return an array with elements in reverse order
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>array_reverse</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Array_reverse</function> takes input
     <parameter>array</parameter> and returns a new array with the
     order of the elements reversed.
    </para>
    <para>
     <example>
      <title><function>Array_reverse</function> example</title>
      <programlisting role="php">
$input = array ("php", 4.0, array ("green", "red"));
$result = array_reverse ($input);
      </programlisting>
     </example>
    </para>
    <para>
     This makes <varname>$result</varname> have <literal>array
     (array ("green", "red"), 4.0, "php")</literal>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.array-shift">
   <refnamediv>
    <refname>array_shift</refname>
    <refpurpose>
     Pop an element off the beginning of array
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>array_shift</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Array_shift</function> shifts the first value of the
     <parameter>array</parameter> off and returns it, shortening the
     <parameter>array</parameter> by one element and moving everything
     down.
    </para>
    <para>
     <example>
      <title><function>Array_shift</function> example</title>
      <programlisting role="php">
$args = array ("-v", "-f");
$opt = array_shift ($args);
      </programlisting>
     </example>
    </para>
    <para>
     This would result in <varname>$args</varname> having one element
     "-f" left, and <varname>$opt</varname> being "-v".
    </para>
    <para>
     See also <function>array_unshift</function>,
     <function>array_push</function>, and
     <function>array_pop</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.array-slice">
   <refnamediv>
    <refname>array_slice</refname>
    <refpurpose>Extract a slice of the array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>array_slice</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
      <paramdef>int <parameter>offset</parameter></paramdef>
      <paramdef>int
       <parameter>
        <optional>length</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Array_slice</function> returns a sequence of elements
     from the <parameter>array</parameter> specified by the
     <parameter>offset</parameter> and <parameter>length</parameter>
     parameters.
    </para>
    <para>
     If <parameter>offset</parameter> is positive, the sequence will
     start at that offset in the <parameter>array</parameter>.  If
     <parameter>offset</parameter> is negative, the sequence will
     start that far from the end of the <parameter>array</parameter>.
    </para>
    <para>
     If <parameter>length</parameter> is given and is positive, then
     the sequence will have that many elements in it. If
     <parameter>length</parameter> is given and is negative then the
     sequence will stop that many elements from the end of the
     array. If it is omitted, then the sequence will have everything
     from <parameter>offset</parameter> up until the end of the
     <parameter>array</parameter>.
    </para>
    <para>
     <example>
      <title><function>Array_slice</function> examples</title>
      <programlisting role="php">
$input = array ("a", "b", "c", "d", "e");

$output = array_slice ($input, 2);      // returns "c", "d", and "e"
$output = array_slice ($input, 2, -1);  // returns "c", "d"
$output = array_slice ($input, -2, 1);  // returns "d"
$output = array_slice ($input, 0, 3);   // returns "a", "b", and "c"
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>array_splice</function>.
    </para>     
   </refsect1>
  </refentry>

  <refentry id="function.array-splice">
   <refnamediv>
    <refname>array_splice</refname>
    <refpurpose>
     Remove a portion of the array and replace it with something
     else
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>array_splice</function></funcdef>
      <paramdef>array <parameter>input</parameter></paramdef>
      <paramdef>int <parameter>offset</parameter></paramdef>
      <paramdef>int
       <parameter><optional>length</optional></parameter>
      </paramdef>
      <paramdef>array
       <parameter>
        <optional>replacement</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Array_splice</function> removes the elements designated
     by <parameter>offset</parameter> and
     <parameter>length</parameter> from the
     <parameter>input</parameter> array, and replaces them with the
     elements of the <parameter>replacement</parameter> array, if
     supplied.
    </para>
    <para>
     If <parameter>offset</parameter> is positive then the start of
     removed portion is at that offset from the beginning of the
     <parameter>input</parameter> array.  If
     <parameter>offset</parameter> is negative then it starts that far
     from the end of the <parameter>input</parameter> array.
    </para>
    <para>
     If <parameter>length</parameter> is omitted, removes everything
     from <parameter>offset</parameter> to the end of the array.  If
     <parameter>length</parameter> is specified and is positive, then
     that many elements will be removed. If
     <parameter>length</parameter> is specified and is negative then
     the end of the removed portion will be that many elements from
     the end of the array.  Tip: to remove everything from
     <parameter>offset</parameter> to the end of the array when
     <parameter>replacement</parameter> is also specified, use
     <literal>count($input)</literal> for
     <parameter>length</parameter>.
    </para>
    <para>
     If <parameter>replacement</parameter> array is specified, then
     the removed elements are replaced with elements from this array.
     If <parameter>offset</parameter> and
     <parameter>length</parameter> are such that nothing is removed,
     then the elements from the <parameter>replacement</parameter>
     array are inserted in the place specified by the
     <parameter>offset</parameter>. Tip: if the replacement is just
     one element it is not necessary to put <literal>array()</literal>
     around it, unless the element is an array itself.
    </para>
    <para>
     The following equivalences hold:
     <programlisting>
array_push ($input, $x, $y)     array_splice ($input, count ($input), 0, 
                                             array ($x, $y))
array_pop ($input)              array_splice ($input, -1)
array_shift ($input)            array_splice ($input, 0, 1)
array_unshift ($input, $x, $y)  array_splice ($input, 0, 0, array ($x, $y))
$a[$x] = $y                     array_splice ($input, $x, 1, $y)
     </programlisting>
    </para>
    <para>
     Returns the array consisting of removed elements.
    </para>
    <para>
     <example>
      <title><function>Array_splice</function> examples</title>
      <programlisting role="php">
$input = array ("red", "green", "blue", "yellow");

array_splice ($input, 2);      // $input is now array ("red", "green")
array_splice ($input, 1, -1);  // $input is now array ("red", "yellow")
array_splice ($input, 1, count($input), "orange");  
                               // $input is now array ("red", "orange")
array_splice ($input, -1, 1, array("black", "maroon")); 
                               // $input is now array ("red", "green", 
                               //          "blue", "black", "maroon")
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>array_slice</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.array-unique">
   <refnamediv>
    <refname>array_unique</refname>
    <refpurpose>Removes duplicate values from an array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>array_unique</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Array_unique</function> takes input
     <parameter>array</parameter> and returns a new array
     without duplicate values.
     Note that keys are preserved.
    </para>
    <para>
     <example>
      <title><function>Array_unique</function> example</title>
      <programlisting role="php">
$input = array ("a" =&gt; "green", "red", "b" =&gt; "green", "blue", "red");
$result = array_unique ($input);
      </programlisting>
     </example>
    </para>
    <para>
     This makes <varname>$result</varname> have <literal>array ("a" =&gt;
     "green", "red", "blue");</literal>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.array-unshift">
   <refnamediv>
    <refname>array_unshift</refname>
    <refpurpose>
     Push one or more elements onto the beginning of array
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>array_unshift</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
      <paramdef>mixed
       <parameter>
        <optional>...</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Array_unshift</function> prepends passed elements to
     the front of the <parameter>array</parameter>. Note that the list
     of elements is prepended as a whole, so that the prepended
     elements stay in the same order.
    </para>
    <para>
     Returns the new number of elements in the
     <parameter>array</parameter>.
    </para>
    <para>
     <example>
      <title><function>Array_unshift</function> example</title>
      <programlisting role="php">
$queue = array ("p1", "p3");
array_unshift ($queue, "p4", "p5", "p6");
      </programlisting>
     </example>
    </para>
    <para>
     This would result in <varname>$queue</varname> having 5
     elements: "p4", "p5", "p6", "p1", and "p3".
    </para>
    <para>
     See also <function>array_shift</function>,
     <function>array_push</function>, and
     <function>array_pop</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.array-values">
   <refnamediv>
    <refname>array_values</refname>
    <refpurpose>Return all the values of an array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>array_values</function></funcdef>
      <paramdef>array <parameter>input</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Array_values</function> returns all the values from the
     <parameter>input</parameter> array.
    </para>
    <para>
     <example>
      <title><function>Array_values</function> example</title>
      <programlisting role="php">
$array = array ("size" =&gt; "XL", "color" =&gt; "gold");
array_values ($array);    // returns array ("XL", "gold")
      </programlisting>
     </example>
    </para>
    <note>
     <para>
      This function was added to PHP 4, below is an implementation for
      those still using PHP 3.
      <example>
       <title>
    Implementation of <function>array_values</function> for PHP 3
    users
       </title>
       <programlisting role="php">
function array_values ($arr) {
    $t = array();
    while (list($k, $v) = each ($arr)) {
        $t[] = $v;
        return $t;
    }
}
       </programlisting>
      </example>
     </para>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.array-walk">
   <refnamediv>
    <refname>array_walk</refname>
    <refpurpose>
     Apply a user function to every member of an array
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>array_walk</function></funcdef>
      <paramdef>array <parameter>arr</parameter></paramdef>
      <paramdef>string <parameter>func</parameter></paramdef>
      <paramdef>mixed <parameter>userdata</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Applies the function named by <parameter>func</parameter> to each
     element of <parameter>arr</parameter>.
     <parameter>func</parameter> will be passed array value as the
     first parameter and array key as the second parameter.  If
     <parameter>userdata</parameter> is supplied, it will be passed as
     the third parameter to the user function.
    </simpara>
    <simpara>
     If <parameter>func</parameter> requires more than two or three
     arguments, depending on <parameter>userdata</parameter>, a
     warning will be generated each time
     <function>array_walk</function> calls
     <parameter>func</parameter>. These warnings may be suppressed by
     prepending the '@' sign to the <function>array_walk</function>
     call, or by using <function>error_reporting</function>.
    </simpara>
    <note>
     <para>
      If <parameter>func</parameter> needs to be working with the
      actual values of the array, specify that the first parameter of
      <parameter>func</parameter> should be passed by reference. Then
      any changes made to those elements will be made in the array
      itself.
     </para>
    </note>
    <note>
     <para>
      Passing the key and userdata to <parameter>func</parameter> was
      added in 4.0.
     </para>
     <para>
      In PHP 4 <function>reset</function> needs to be called as
      necessary since <function>array_walk</function> does not reset
      the array by default.
     </para>
    </note>
    <para>
     <example>
      <title><function>Array_walk</function> example</title>
      <programlisting role="php">
$fruits = array ("d"=&gt;"lemon", "a"=&gt;"orange", "b"=&gt;"banana", "c"=&gt;"apple");

function test_alter (&amp;$item1, $key, $prefix) {
    $item1 = "$prefix: $item1";
}

function test_print ($item2, $key) {
    echo "$key. $item2&lt;br&gt;\n";
}

array_walk ($fruits, 'test_print');
reset ($fruits);
array_walk ($fruits, 'test_alter', 'fruit');
reset ($fruits);
array_walk ($fruits, 'test_print');
      </programlisting>
     </example>
    </para>
    <simpara>
     See also <function>each</function> and <function>list</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.arsort">
   <refnamediv>
    <refname>arsort</refname>
    <refpurpose>
     Sort an array in reverse order and maintain index association
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>arsort</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>sort_flags</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function sorts an array such that array indices maintain
     their correlation with the array elements they are associated
     with.  This is used mainly when sorting associative arrays where
     the actual element order is significant.
     <example>
      <title><function>Arsort</function> example</title>
      <programlisting role="php">
$fruits = array ("d"=&gt;"lemon", "a"=&gt;"orange", "b"=&gt;"banana", "c"=&gt;"apple");
arsort ($fruits);
reset ($fruits);
while (list ($key, $val) = each ($fruits)) {
    echo "$key = $val\n";
}
      </programlisting>
     </example>
    </para>
    <para>
     This example would display:
    </para>
    <para>
     <informalexample>
      <programlisting>
fruits[a] = orange
fruits[d] = lemon
fruits[b] = banana
fruits[c] = apple
      </programlisting>
     </informalexample>
    </para>
    <para>
     The fruits have been sorted in reverse alphabetical order, and
     the index associated with each element has been maintained.
    </para>
    <para>
     You may modify the behavior of the sort using the optional
     parameter <parameter>sort_flags</parameter>, for details 
     see <function>sort</function>.
    </para>
    <para>
     See also: <function>asort</function>, <function>rsort</function>,
     <function>ksort</function>, and <function>sort</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.asort">
   <refnamediv>
    <refname>asort</refname>
    <refpurpose>Sort an array and maintain index association</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>asort</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
      <paramdef>int <parameter><optional>sort_flags</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function sorts an array such that array indices maintain
     their correlation with the array elements they are associated
     with.  This is used mainly when sorting associative arrays where
     the actual element order is significant.
     <example>
      <title><function>Asort</function> example</title>
      <programlisting role="php">
$fruits = array ("d"=&gt;"lemon", "a"=&gt;"orange", "b"=&gt;"banana", "c"=&gt;"apple");
asort ($fruits);
reset ($fruits);
while (list ($key, $val) = each ($fruits)) {
    echo "$key = $val\n";
}
      </programlisting>
     </example>
    </para>
    <para>
     This example would display:
    </para>
    <para>
     <informalexample>
      <programlisting>
fruits[c] = apple
fruits[b] = banana
fruits[d] = lemon
fruits[a] = orange
      </programlisting>
     </informalexample>
    </para>
    <para>
     The fruits have been sorted in alphabetical order, and the index
     associated with each element has been maintained.
    </para>
    <para>
     You may modify the behavior of the sort using the optional
     parameter <parameter>sort_flags</parameter>, for details 
     see <function>sort</function>.
    </para>
    <para>
     See also <function>arsort</function>, <function>rsort</function>,
     <function>ksort</function>, and <function>sort</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.compact">
   <refnamediv>
    <refname>compact</refname>
    <refpurpose>
     Create array containing variables and their values
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>compact</function></funcdef>
      <paramdef>mixed <parameter>varname</parameter></paramdef>
      <paramdef>mixed
       <parameter><optional>...</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Compact</function> takes a variable number of
     parameters. Each parameter can be either a string containing the
     name of the variable, or an array of variable names.  The array
     can contain other arrays of variable names inside it;
     <function>compact</function> handles it recursively.
    </para>
    <para>
     For each of these, <function>compact</function> looks for a
     variable with that name in the current symbol table and adds it
     to the output array such that the variable name becomes the key
     and the contents of the variable become the value for that key.
     In short, it does the opposite of <function>extract</function>.
     It returns the output array with all the variables added to it.
    </para>
    <para>
     Any strings that are not set will simply be skipped.
    </para>
    <para>
     <example>
      <title><function>Compact</function> example</title>
      <programlisting role="php">
$city = "San Francisco";
$state = "CA";
$event = "SIGGRAPH";

$location_vars = array ("city", "state");

$result = compact ("event", "nothing_here", $location_vars);
      </programlisting>
      <para>
       After this, <varname>$result</varname> will be <literal>array ("event"
       =&gt; "SIGGRAPH", "city" =&gt; "San Francisco", "state" =&gt; "CA")</literal>.
      </para>
     </example>
    </para>
    <para>
     See also <function>extract</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.count">
   <refnamediv>
    <refname>count</refname>
    <refpurpose>Count elements in a variable</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>count</function></funcdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the number of elements in <parameter>var</parameter>,
     which is typically an array (since anything else will have one
     element).
    </para>
    <para>
     Returns 1 if the variable is not an array.
    </para>
    <para>
     Returns 0 if the variable is not set.
     <warning>
      <para>
       <function>Count</function> may return 0 for a variable that
       isn't set, but it may also return 0 for a variable that has
       been initialized with an empty array. Use
       <function>isset</function> to test if a variable is set.
      </para>
     </warning>
    </para>
    <para>
     <example>
      <title><function>Count</function> example</title>
      <programlisting role="php">
$a[0] = 1; 
$a[1] = 3; 
$a[2] = 5; 
$result = count ($a);
//$result == 3, not 2, as there are 3 assigned elements

$a[2] = 1; 
$a[4] = ""; 
$a[6] = 5;
$a[8] = 7;
$a[10] = 11;
$a[12] = "";
$result = count ($a);
// $result == 4, as there are 4 assigned elements
      </programlisting>
     </example>
    </para>
    <para>
     See also: <function>sizeof</function>,
     <function>isset</function>, and
     <function>is_array</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.current">
   <refnamediv>
    <refname>current</refname>
    <refpurpose>Return the current element in an array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>current</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Every array has an internal pointer to its "current" element,
     which is initialized to the first element inserted into the
     array.
    </para>
    <para>
     The <function>current</function> function simply returns the
     array element that's currently being pointed by the internal
     pointer.  It does not move the pointer in any way.  If the
     internal pointer points beyond the end of the elements list,
     <function>current</function> returns false.
     <warning>
      <para> 
       If the array contains empty elements (0 or "", the empty
       string) then this function will return false for these elements
       as well.  This makes it impossible to determine if you are
       really at the end of the list in such an array using
       <function>current</function>.  To properly traverse an array
       that may contain empty elements, use the
       <function>each</function> function.  
      </para>
     </warning>
    </para>
    <para>
     See also: <function>end</function>, <function>next</function>,
     <function>prev</function>, and <function>reset</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.each">
   <refnamediv>
    <refname>each</refname> 
    <refpurpose>
     Return the next key and value pair from an array
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>each</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the current key and value pair from the array
     <parameter>array</parameter> and advances the array cursor. This
     pair is returned in a four-element array, with the keys
     <emphasis>0</emphasis>, <emphasis>1</emphasis>,
     <emphasis>key</emphasis>, and
     <emphasis>value</emphasis>. Elements <emphasis>0</emphasis> and
     <emphasis>key</emphasis> contain the key name of the array
     element, and <emphasis>1</emphasis> and
     <emphasis>value</emphasis> contain the data.
    </para>
    <para>
     If the internal pointer for the array points past the end of the
     array contents, <function>each</function> returns false.
    </para>
    <para>
     <example>
      <title><function>Each</function> examples</title>
      <programlisting role="php">
$foo = array ("bob", "fred", "jussi", "jouni", "egon", "marliese");
$bar = each ($foo);
      </programlisting>
      <para>
       <varname>$bar</varname> now contains the following key/value
       pairs:
       <itemizedlist spacing="compact">
        <listitem><simpara>0 =&gt; 0</simpara></listitem>
        <listitem><simpara>1 =&gt; 'bob'</simpara></listitem>
        <listitem><simpara>key =&gt; 0</simpara></listitem>
        <listitem><simpara>value =&gt; 'bob'</simpara></listitem>
       </itemizedlist>
       <programlisting role="php">
$foo = array ("Robert" =&gt; "Bob", "Seppo" =&gt; "Sepi");
$bar = each ($foo);
       </programlisting>
      </para>
      <para>
       <varname>$bar</varname> now contains the following key/value
       pairs:
       <itemizedlist spacing="compact">
        <listitem><simpara>0 =&gt; 'Robert'</simpara></listitem>
        <listitem><simpara>1 =&gt; 'Bob'</simpara></listitem>
        <listitem><simpara>key =&gt; 'Robert'</simpara></listitem>
        <listitem><simpara>value =&gt; 'Bob'</simpara></listitem>
       </itemizedlist>
      </para>
     </example>
    </para>
    <para>
     <function>Each</function> is typically used in conjunction with
     <function>list</function> to traverse an array; for instance,
     <varname>$HTTP_POST_VARS</varname>: 
     <example>
      <title>
       Traversing <varname>$HTTP_POST_VARS</varname> with
       <function>each</function>
      </title>
      <programlisting role="php">
echo "Values submitted via POST method:&lt;br&gt;";
reset ($HTTP_POST_VARS);
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
    echo "$key =&gt; $val&lt;br&gt;";
}
      </programlisting>
     </example>
    </para>
    <para>
     After <function>each</function> has executed, the array cursor
     will be left on the next element of the array, or on the last
     element if it hits the end of the array.
    </para>
    <para>
     See also <function>key</function>, <function>list</function>,
     <function>current</function>, <function>reset</function>,
     <function>next</function>, and <function>prev</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.end">
   <refnamediv>
    <refname>end</refname>
    <refpurpose>
     Set the internal pointer of an array to its last element
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>end</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>End</function> advances <parameter>array</parameter>'s
     internal pointer to the last element, and returns that element.
    </para>
    <para>
     See also: <function>current</function>,
     <function>each</function>, <function>end</function>,
     <function>next</function>, and <function>reset</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.extract">
   <refnamediv>
    <refname>extract</refname>
    <refpurpose>
     Import variables into the symbol table from an array
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>extract</function></funcdef>
      <paramdef>array <parameter>var_array</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>extract_type</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>prefix</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function is used to import variables from an array into the
     current symbol table.  It takes associative array
     <parameter>var_array</parameter> and treats keys as variable
     names and values as variable values.  For each key/value pair it
     will create a variable in the current symbol table, subject to
     <parameter>extract_type</parameter> and
     <parameter>prefix</parameter> parameters.
    </para>
    <note>
     <para>
      Since version 4.0.5 this function returns the number of
      variables extracted.
     </para>
    </note>
    <para>
     <function>Extract</function> checks for colissions with existing
     variables.  The way collisions are treated is determined by
     <parameter>extract_type</parameter>. It can be one of the
     following values:
     <variablelist>
      <varlistentry>
       <term>EXTR_OVERWRITE</term>
       <listitem>
        <simpara>
         If there is a collision, overwrite the existing variable.
        </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term>EXTR_SKIP</term>
       <listitem>
        <simpara>
         If there is a collision, don't overwrite the existing
         variable.
        </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term>EXTR_PREFIX_SAME</term>
       <listitem>
        <simpara>
         If there is a collision, prefix the new variable with
         <parameter>prefix</parameter>.
        </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term>EXTR_PREFIX_ALL</term>
       <listitem>
        <simpara>
         Prefix all variables with <parameter>prefix</parameter>.
        </simpara>
       </listitem>
      </varlistentry>
     </variablelist>
    </para>
    <para>
     If <parameter>extract_type</parameter> is not specified, it is
     assumed to be EXTR_OVERWRITE.
    </para>
    <para>
     Note that <parameter>prefix</parameter> is only required if
     <parameter>extract_type</parameter> is EXTR_PREFIX_SAME or
     EXTR_PREFIX_ALL.
    </para>
    <para>
     <function>Extract</function> checks each key to see if it
     constitues a valid variable name, and if it does only then does
     it proceed to import it.
    </para>
    <para>
     A possible use for extract is to import into symbol table
     variables contained in an associative array returned by
     <function>wddx_deserialize</function>.
    </para>
    <para>
     <example>
      <title><function>Extract</function> example</title>
      <programlisting role="php">
&lt;?php

/* Suppose that $var_array is an array returned from
   wddx_deserialize */

$size = "large";
$var_array = array ("color" =&gt; "blue",
                    "size"  =&gt; "medium",
                    "shape" =&gt; "sphere");
extract ($var_array, EXTR_PREFIX_SAME, "wddx");

print "$color, $size, $shape, $wddx_size\n";

?>
      </programlisting>
     </example>
    </para>
    <para>
     The above example will produce:
     <programlisting>
blue, large, sphere, medium
     </programlisting>
    </para>
    <para>
     The <varname>$size</varname> wasn't overwritten, becaus we
     specified EXTR_PREFIX_SAME, which resulted in
     <varname>$wddx_size</varname> being created.  If EXTR_SKIP was
     specified, then $wddx_size wouldn't even have been created.
     EXTR_OVERWRITE would have cause <varname>$size</varname> to have
     value "medium", and EXTR_PREFIX_ALL would result in new variables
     being named <varname>$wddx_color</varname>,
     <varname>$wddx_size</varname>, and
     <varname>$wddx_shape</varname>.
    </para>
    <para>
     You must use an associative array, a numerically indexed array
     will not produce results.
    </para>
    <para>
     See also: <function>compact</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.in-array">
   <refnamediv>
    <refname>in_array</refname>
    <refpurpose>Return true if a value exists in an array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool in_array</funcdef>
      <paramdef>mixed <parameter>needle</parameter></paramdef>
      <paramdef>array <parameter>haystack</parameter></paramdef>
      <paramdef>bool <parameter>strict</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Searches <parameter>haystack</parameter> for
     <parameter>needle</parameter> and returns true if it is found in
     the array, false otherwise.
    </para>
    <para>
     If the third parameter <parameter>strict</parameter> is set to
     <literal>TRUE</literal> then the <function>in_array</function>
     will also check the types of the <parameter>needle</parameter>
     in the <parameter>haystack</parameter>.
    </para>
    <para>
     <example>
      <title><function>In_array</function> example</title>
      <programlisting role="php">
$os = array ("Mac", "NT", "Irix", "Linux");
if (in_array ("Irix", $os)){
    print "Got Irix";
    }
      </programlisting>
     </example>
    </para>
    <para>
     <example>
      <title><function>In_array</function> with strict example</title>
      <programlisting role="php">
<?php
$a = array('1.10', 12.4, 1.13);

if (in_array('12.4', $a, true))
    echo &quot;'12.4' found with strict check\n&quot;;
if (in_array(1.13, $a, true))
    echo &quot;1.13 found with strict check\n&quot;;
?>

// This will output:

1.13 found with strict check
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.key">
   <refnamediv>
    <refname>key</refname>
    <refpurpose>Fetch a key from an associative array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>key</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Key</function> returns the index element of the
     current array position.
    </para>
    <para>
     See also <function>current</function> and <function>next</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.krsort">
   <refnamediv>
    <refname>krsort</refname>
    <refpurpose>Sort an array by key in reverse order</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>krsort</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>sort_flags</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sorts an array by key in reverse order, maintaining key to data
     correlations. This is useful mainly for associative arrays.
     <example>
      <title><function>Krsort</function> example</title>
      <programlisting role="php">
$fruits = array ("d"=&gt;"lemon", "a"=&gt;"orange", "b"=&gt;"banana", "c"=&gt;"apple");
krsort ($fruits);
reset ($fruits);
while (list ($key, $val) = each ($fruits)) {
    echo "$key -&gt; $val\n";
}
      </programlisting>
     </example>
    </para>
    <para>
     This example would display:
    </para>
    <para>
     <informalexample>
      <programlisting>
fruits[d] = lemon
fruits[c] = apple
fruits[b] = banana
fruits[a] = orange
      </programlisting>
     </informalexample>
    </para>
    <para>
     You may modify the behavior of the sort using the optional
     parameter <parameter>sort_flags</parameter>, for details 
     see <function>sort</function>.
    </para>
    <simpara>
     See also <function>asort</function>, <function>arsort</function>,
     <function>ksort</function> <function>sort</function>, 
     <function>natsort</function>and <function>rsort</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ksort">
   <refnamediv>
    <refname>ksort</refname>
    <refpurpose>Sort an array by key</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ksort</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>sort_flags</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sorts an array by key, maintaining key to data correlations. This
     is useful mainly for associative arrays.
     <example>
      <title><function>Ksort</function> example</title>
      <programlisting role="php">
$fruits = array ("d"=&gt;"lemon", "a"=&gt;"orange", "b"=&gt;"banana", "c"=&gt;"apple");
ksort ($fruits);
reset ($fruits);
while (list ($key, $val) = each ($fruits)) {
    echo "$key -&gt; $val\n";
}
      </programlisting>
     </example>
    </para>
    <para>
     This example would display:
    </para>
    <para>
     <informalexample>
      <programlisting>
fruits[a] = orange
fruits[b] = banana
fruits[c] = apple
fruits[d] = lemon
      </programlisting>
     </informalexample>     
    </para>
    <para>
     You may modify the behavior of the sort using the optional
     parameter <parameter>sort_flags</parameter>, for details 
     see <function>sort</function>.
    </para>
    <simpara>
     See also <function>asort</function>, <function>arsort</function>, 
     <function>sort</function>, <function>natsort</function>, and 
     <function>rsort</function>.
    </simpara>
    <note>
     <para>
      The second parameter was added in PHP 4.
     </para>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.list">
   <refnamediv>
    <refname>list</refname>
    <refpurpose>
     Assign variables as if they were an array
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>list</function></funcdef>
      <varargs/>
     </funcprototype>
    </funcsynopsis>
    <para>
     Like <function>array</function>, this is not really a function,
     but a language construct.  <function>list</function> is used to
     assign a list of variables in one operation.
     <example>
      <title><function>List</function> example</title>
      <programlisting role="php">
&lt;table>
 &lt;tr>
  &lt;th>Employee name&lt;/th>
  &lt;th>Salary&lt;/th>
 &lt;/tr>

&lt;?php

$result = mysql ($conn, "SELECT id, name, salary FROM employees");
while (list ($id, $name, $salary) = mysql_fetch_row ($result)) {
    print (" &lt;tr>\n".
           "  &lt;td>&lt;a href=\"info.php3?id=$id\">$name&lt;/a>&lt;/td>\n".
           "  &lt;td>$salary&lt;/td>\n".
           " &lt;/tr>\n");
}

?>

&lt;/table>
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>each</function> and <function>array</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.natsort">
   <refnamediv>
    <refname>natsort</refname>
    <refpurpose>
     Sort an array using a "natural order" algorithm
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>natsort</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function implements a sort algorithm that orders
     alphanumeric strings in the way a human being would.  This is
     described as a "natural ordering". An example of the difference
     between this algorithm and the regular computer string sorting
     algorithms (used in <function>sort</function>) can be seen below:
    </para>
    <para>
     <example>
      <title><function>natsort</function> example</title>
      <programlisting role="php">
$array1 = $array2 = array ("img12.png","img10.png","img2.png","img1.png");          

sort($array1);
echo "Standard sorting\n";
print_r($array1);

natsort($array2);
echo "\nNatural order sorting\n";
print_r($array2);
      </programlisting>
     </example>
    </para>
    <para>
     The code above will generate the following output:
    </para>
    <para>
     <informalexample>
      <programlisting>
Standard sorting
Array
(
    [0] =&gt; img1.png
    [1] =&gt; img10.png
    [2] =&gt; img12.png
    [3] =&gt; img2.png
)

Natural order sorting
Array
(
    [3] =&gt; img1.png
    [2] =&gt; img2.png
    [1] =&gt; img10.png
    [0] =&gt; img12.png
)
      </programlisting>
     </informalexample>
     For more infomation see: Martin Pool's <ulink
     url="&url.strnatcmp;">Natural Order String Comparison</ulink>
     page.
    </para>
    <para>
     See also <function>natcasesort</function>,
     <function>strnatcmp</function> and
     <function>strnatcasecmp</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.natcasesort">
   <refnamediv>
    <refname>natcasesort</refname>
    <refpurpose>
     Sort an array using a case insensitive "natural order" algorithm
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>natcasesort</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function implements a sort algorithm that orders
     alphanumeric strings in the way a human being would.  This is
     described as a "natural ordering".
    </para>
    <para>
     <function>natcasesort</function> is a case insensitive version of
     <function>natsort</function>.  See <function>natsort</function>
     for an example of the difference between this algorithm and the
     regular computer string sorting algorithms.
    </para>
    <para>
     For more infomation see: Martin Pool's <ulink
     url="&url.strnatcmp;">Natural Order String Comparison</ulink>
     page.
    </para>
    <para>
     See also <function>sort</function>,
     <function>natsort</function>,
     <function>strnatcmp</function> and
     <function>strnatcasecmp</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.next">
   <refnamediv>
    <refname>next</refname>
    <refpurpose>
     Advance the internal array pointer of an array
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>next</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the array element in the next place that's pointed by the
     internal array pointer, or false if there are no more elements.
    </para>
    <para>
     <function>Next</function> behaves like
     <function>current</function>, with one difference.  It advances
     the internal array pointer one place forward before returning the
     element.  That means it returns the next array element and
     advances the internal array pointer by one.  If advancing the
     internal array pointer results in going beyond the end of the
     element list, <function>next</function> returns false.
     <warning>
      <para>
       If the array contains empty elements, or elements that have a key
       value of 0 then this function will return false for these elements 
       as well.  To properly traverse an array which may contain empty 
       elements or elements with key values of 0 see the
       <function>each</function> function.
      </para>
     </warning>
    </para>
    <para>
     See also:
     <function>current</function>, <function>end</function>,
     <function>prev</function>, and <function>reset</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pos">
   <refnamediv>
    <refname>pos</refname>
    <refpurpose>Get the current element from an array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>pos</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     This is an alias for <function>current</function>.
    </simpara>
    <para>
     See also:
     <function>end</function>, <function>next</function>,
     <function>prev</function> and <function>reset</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.prev">
   <refnamediv>
    <refname>prev</refname>
    <refpurpose>Rewind the internal array pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>prev</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the array element in the previous place that's pointed by
     the internal array pointer, or false if there are no more
     elements.
     <warning>
      <para>
       If the array contains empty elements then this function will
       return false for these elements as well.  To properly traverse
       an array which may contain empty elements see the
       <function>each</function> function.
      </para>
     </warning>
    </para>
    <para>  
     <function>Prev</function> behaves just like
     <function>next</function>, except it rewinds the internal array
     pointer one place instead of advancing it.
    </para>
    <para>
     See also: <function>current</function>, <function>end</function>,
     <function>next</function>, and <function>reset</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.range">
   <refnamediv>
    <refname>range</refname>
    <refpurpose>
     Create an array containing a range of integers
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>range</function></funcdef>
      <paramdef>int <parameter>low</parameter></paramdef>
      <paramdef>int <parameter>high</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Range</function> returns an array of integers from
     <parameter>low</parameter> to <parameter>high</parameter>,
     inclusive.
    </para>
    <para>
     See <function>shuffle</function> for an example of its use.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.reset">
   <refnamediv>
    <refname>reset</refname>
    <refpurpose>
     Set the internal pointer of an array to its first element
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>reset</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Reset</function> rewinds <parameter>array</parameter>'s
     internal pointer to the first element.
    </para>
    <para>
     <function>Reset</function> returns the value of the first array
     element.
    </para>
    <para>
     See also: <function>current</function>,
     <function>each</function>, <function>next</function>,
     and <function>prev</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.rsort">
   <refnamediv>
    <refname>rsort</refname>
    <refpurpose>Sort an array in reverse order</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>rsort</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>sort_flags</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function sorts an array in reverse order (highest to lowest).
     <example>
      <title><function>Rsort</function> example</title>
      <programlisting role="php">
$fruits = array ("lemon", "orange", "banana", "apple");
rsort ($fruits);
reset ($fruits);
while (list ($key, $val) = each ($fruits)) {
    echo "$key -&gt; $val\n";
}
      </programlisting>
     </example>
    </para>
    <para>
     This example would display:
    </para>
    <para>
     <informalexample>
      <programlisting>
fruits[0] = orange
fruits[1] = lemon
fruits[2] = banana
fruits[3] = apple
      </programlisting>
     </informalexample>
    </para>
    <para>
     The fruits have been sorted in reverse alphabetical order.
    </para>
    <para>
     You may modify the behavior of the sort using the optional
     parameter <parameter>sort_flags</parameter>, for details 
     see <function>sort</function>.
    </para>
    <para>
     See also: <function>arsort</function>,
     <function>asort</function>, <function>ksort</function>,
     <function>sort</function>, and <function>usort</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.shuffle">
   <refnamediv>
    <refname>shuffle</refname>
    <refpurpose>Shuffle an array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>shuffle</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function shuffles (randomizes the order of the elements in)
     an array. You must use <function>srand</function> to seed this
     function.
     <example>
      <title><function>Shuffle</function> example</title>
      <programlisting role="php">
$numbers = range (1,20);
srand ((double)microtime()*1000000);
shuffle ($numbers);
while (list (, $number) = each ($numbers)) {
    echo "$number ";
}
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>arsort</function>, <function>asort</function>,
     <function>ksort</function>, <function>rsort</function>,
     <function>sort</function> and <function>usort</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sizeof">
   <refnamediv>
    <refname>sizeof</refname>
    <refpurpose>Get the number of elements in an array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>sizeof</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the number of elements in the array.
    </para>
    <para>
     See also <function>count</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sort">
   <refnamediv>
    <refname>sort</refname>
    <refpurpose>Sort an array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>sort</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
      <paramdef>int <parameter><optional>sort_flags</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function sorts an array.  Elements will be arranged from
     lowest to highest when this function has completed.
     <example>
      <title><function>Sort</function> example</title>
    <programlisting role="php">
&lt;?php

$fruits = array ("lemon", "orange", "banana", "apple");
sort ($fruits);
reset ($fruits);
while (list ($key, $val) = each ($fruits)) {
    echo "fruits[".$key."] = ".$val; 
}
 
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     This example would display:
    </para>
    <para>
     <informalexample>
      <programlisting>
fruits[0] = apple
fruits[1] = banana
fruits[2] = lemon
fruits[3] = orange
      </programlisting>
     </informalexample>
    </para>
    <para>
     The fruits have been sorted in alphabetical order.
    </para>
    <para>
     The optional second parameter <parameter>sort_flags</parameter>
     may be used to modify the sorting behavior using theese valies:
    </para>
    <para>
     Sorting type flags:
     <itemizedlist>
      <listitem>
       <simpara>SORT_REGULAR - compare items normally</simpara>
      </listitem>
      <listitem>
       <simpara>SORT_NUMERIC - compare items numerically</simpara>
      </listitem>
      <listitem>
       <simpara>SORT_STRING - compare items as strings</simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     See also: <function>arsort</function>,
     <function>asort</function>, <function>ksort</function>,
     <function>natsort</function>, <function>natcasesort</function>,
     <function>rsort</function>, <function>usort</function>,
     <function>array_multisort</function>, and <function>uksort</function>.
    </para>
    <note>
     <para>
      The second parameter was added in PHP 4.
     </para>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.uasort">
   <refnamediv>
    <refname>uasort</refname>
    <refpurpose>
     Sort an array with a user-defined comparison function and
     maintain index association
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>uasort</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
      <paramdef>function <parameter>cmp_function</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function sorts an array such that array indices maintain
     their correlation with the array elements they are associated
     with.  This is used mainly when sorting associative arrays where
     the actual element order is significant.  The comparison function
     is user-defined.
    </para>
    <note>
     <para>
      Please see <function>usort</function> and
      <function>uksort</function> for examples of user-defined
      comparison functions.
     </para>
    </note>
    <para>
     See also: <function>usort</function>, <function>uksort</function>, 
     <function>sort</function>, <function>asort</function>, 
     <function>arsort</function>, <function>ksort</function> 
     and <function>rsort</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.uksort">
   <refnamediv>
    <refname>uksort</refname>
    <refpurpose>
     Sort an array by keys using a user-defined comparison function
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>uksort</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
      <paramdef>function <parameter>cmp_function</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function will sort the keys of an array using a
     user-supplied comparison function.  If the array you wish to sort
     needs to be sorted by some non-trivial criteria, you should use
     this function.
    </para>
    <para>
     <example>
      <title><function>Uksort</function> example</title>
      <programlisting role="php">
function cmp ($a, $b) {   
    if ($a == $b) return 0;
    return ($a > $b) ? -1 : 1;
}

$a = array (4 =&gt; "four", 3 =&gt; "three", 20 =&gt; "twenty", 10 =&gt; "ten");

uksort ($a, "cmp");

while (list ($key, $value) = each ($a)) {
    echo "$key: $value\n";
}
      </programlisting>
     </example>
    </para>
    <para>
     This example would display:
    </para>
    <para>
     <informalexample>
      <programlisting>
20: twenty
10: ten
4: four
3: three
      </programlisting>
     </informalexample>
    </para>
    <para>
     See also: <function>usort</function>, <function>uasort</function>, 
     <function>sort</function>, <function>asort</function>, 
     <function>arsort</function>, <function>ksort</function>,
     <function>natsort</function> and <function>rsort</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.usort">
   <refnamediv>
    <refname>usort</refname>
    <refpurpose>
     Sort an array by values using a user-defined comparison function
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>usort</function></funcdef>
      <paramdef>array <parameter>array</parameter></paramdef>
      <paramdef>string <parameter>cmp_function</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function will sort an array by its values using a
     user-supplied comparison function.  If the array you wish to sort
     needs to be sorted by some non-trivial criteria, you should use
     this function.
    </para>
    <para>
     The comparison function must return an integer less than, equal
     to, or greater than zero if the first argument is considered to
     be respectively less than, equal to, or greater than the
     second. If two members compare as equal, their order in the
     sorted array is undefined.
    </para>
    <para>
     <example>
      <title><function>Usort</function> example</title>
      <programlisting role="php">
function cmp ($a, $b) {   
    if ($a == $b) return 0;
    return ($a > $b) ? -1 : 1;
}

$a = array (3, 2, 5, 6, 1);

usort ($a, "cmp");

while (list ($key, $value) = each ($a)) {
    echo "$key: $value\n";
}
      </programlisting>
     </example>
    </para>
    <para>
     This example would display:
    </para>
    <para>
     <informalexample>
      <programlisting>
0: 6
1: 5
2: 3
3: 2
4: 1
      </programlisting>
     </informalexample>
    </para>
    <note>
     <para>
      Obviously in this trivial case the <function>rsort</function>
      function would be more appropriate.
     </para>
    </note>
    <para>
     <example>
      <title>
       <function>Usort</function> example using multi-dimensional array
      </title>
      <programlisting role="php">
function cmp ($a, $b) {
    return strcmp($a["fruit"],$b["fruit"]);
} 

$fruits[0]["fruit"] = "lemons";
$fruits[1]["fruit"] = "apples";
$fruits[2]["fruit"] = "grapes";

usort($fruits, "cmp"); 

while (list ($key, $value) = each ($fruits)) {
    echo "\$fruits[$key]: " . $value["fruit"] . "\n";
}
      </programlisting>
     </example>
    </para>
    <para>
     When sorting a multi-dimensional array, $a and $b contain
     references to the first index of the array.
    </para>
    <para>
     This example would display:
    </para>
    <para>
     <informalexample>
      <programlisting>
$fruits[0]: apples
$fruits[1]: grapes
$fruits[2]: lemons
      </programlisting>
     </informalexample>
    </para>
    <para>
     <warning>
      <para>
       The underlying quicksort function in some C libraries (such as
       on Solaris systems) may cause PHP to crash if the comparison
       function does not return consistent values.
      </para>
     </warning>
    </para>
    <para>
     See also: <function>uasort</function>, <function>uksort</function>, 
     <function>sort</function>, <function>asort</function>,
     <function>arsort</function>,<function>ksort</function>,
     <function>natsort</function>, and <function>rsort</function>.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/aspell.xml
+++ phpdoc/kr/functions/aspell.xml
 <reference id="ref.aspell">
  <title>Aspell functions</title>
  <titleabbrev>Aspell</titleabbrev>

  <partintro>
   <simpara>
    The <function>aspell</function> functions allows you to check the
    spelling on a word and offer suggestions.
   </simpara>
   <note>
    <simpara>
     aspell works only with very old (up to .27.* or so) versions of
     aspell library. Neither this module, nor those versions of aspell
     library are supported any longer. If you want to use
     spell-checking capabilities in php, use <link
     linkend="ref.pspell">pspell</link> instead. It uses pspell
     library and works with newer versions of aspell.
     </simpara>
   </note>
   <simpara>
    You need the aspell library, available from: <ulink
    url="&url.aspell;">&url.aspell;</ulink>.
   </simpara>
  </partintro>

  <refentry id="function.aspell-new">
   <refnamediv>
    <refname>aspell_new</refname>
    <refpurpose>Load a new dictionary</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>aspell_new</function></funcdef>
      <paramdef>string <parameter>master</parameter></paramdef>
      <paramdef>string <parameter>personal</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Aspell_new</function> opens up a new dictionary and
     returns the dictionary link identifier for use in other aspell
     functions.</simpara>
    <para>
     <example>
      <title><function>Aspell_new</function></title>
      <programlisting role="php">
$aspell_link=aspell_new ("english");
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.aspell-check">
   <refnamediv>
    <refname>aspell_check</refname>
    <refpurpose>Check a word</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>aspell_check</function></funcdef>
      <paramdef>int <parameter>dictionary_link</parameter></paramdef>
      <paramdef>string <parameter>word</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Aspell_check</function> checks the spelling of a word
     and returns true if the spelling is correct, false if not.
    </simpara>
    <para>
     <example>
      <title><function>Aspell_check</function></title>
      <programlisting>
$aspell_link=aspell_new ("english");
if (aspell_check ($aspell_link, "testt")) {
    echo "This is a valid spelling";
} else {
    echo "Sorry, wrong spelling";
}
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.aspell-check-raw">
   <refnamediv>
    <refname>aspell_check_raw</refname> 
    <refpurpose>
     Check a word without changing its case or trying to trim it
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>aspell_check_raw</function></funcdef>
      <paramdef>int <parameter>dictionary_link</parameter></paramdef>
      <paramdef>string <parameter>word</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Aspell_check_raw</function> checks the spelling of a
     word, without changing its case or trying to trim it in any way
     and returns true if the spelling is correct, false if not.
    </simpara>
    <para>
     <example>
      <title><function>Aspell_check_raw</function></title>
      <programlisting role="php">
$aspell_link=aspell_new ("english");
if (aspell_check_raw ($aspell_link, "test")) {
    echo "This is a valid spelling";
} else {
    echo "Sorry, wrong spelling";
}
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.aspell-suggest">
   <refnamediv>
    <refname>aspell_suggest</refname>
    <refpurpose>Suggest spellings of a word</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>aspell_suggest</function></funcdef>
      <paramdef>int <parameter>dictionary_link</parameter></paramdef>
      <paramdef>string <parameter>word</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Aspell_suggest</function> returns an array of possible
     spellings for the given word.
    </simpara>
    <para>
     <example>
      <title><function>Aspell_suggest</function></title>
      <programlisting role="php">
$aspell_link=aspell_new ("english");

if (!aspell_check ($aspell_link, "test")) {
    $suggestions=aspell_suggest ($aspell_link, "test");

    for ($i=0; $i &lt; count ($suggestions); $i++) {
        echo "Possible spelling: " . $suggestions[$i] . "&lt;br>"; 
    }
}
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/bc.xml
+++ phpdoc/kr/functions/bc.xml
 <reference id="ref.bc">
  <title>BCMath Arbitrary Precision Mathematics Functions</title>
  <titleabbrev>BC math</titleabbrev>

  <partintro>
   <para>
    These functions are only available if PHP was configured with
    <option role="configure">--enable-bcmath</option>.
   </para>
   <note>
    <para>
     Due to changes in the licensing, the BCMATH library is distributed
     separate from the standard PHP source distribution. 
     You can download the tar-gzipped archive at the url:
     <ulink url="&url.bcmath;">&url.bcmath;</ulink>.  Read the
     file <filename>README.BCMATH</filename> in the PHP distribution
     for more information.
    </para>
   </note>
  </partintro>

  <refentry id="function.bcadd">
   <refnamediv>
    <refname>bcadd</refname>
    <refpurpose>Add two arbitrary precision numbers</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>bcadd</function></funcdef>
      <paramdef>string <parameter>left operand</parameter></paramdef>
      <paramdef>string <parameter>right operand</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>scale</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Adds the <parameter>left operand</parameter> to the
     <parameter>right operand</parameter> and returns the sum in a
     string.  The optional <parameter>scale</parameter> parameter is
     used to set the number of digits after the decimal place in the
     result.
    </para>
    <para>
     See also <function>bcsub</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.bccomp">
   <refnamediv>
    <refname>bccomp</refname>
    <refpurpose>Compare two arbitrary precision numbers</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>bccomp</function></funcdef>
      <paramdef>string <parameter>left operand</parameter></paramdef>
      <paramdef>string <parameter>right operand</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>scale</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Compares the <parameter>left operand</parameter> to the
     <parameter>right operand</parameter> and returns the result as an
     integer.  The optional <parameter>scale</parameter> parameter is
     used to set the number of digits after the decimal place which
     will be used in the comparion.  The return value is 0 if the two
     operands are equal.  If the <parameter>left operand</parameter>
     is larger than the <parameter>right operand</parameter> the
     return value is +1 and if the <parameter>left operand</parameter>
     is less than the <parameter>right operand</parameter> the return
     value is -1.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.bcdiv">
   <refnamediv>
    <refname>bcdiv</refname>
    <refpurpose>Divide two arbitrary precision numbers</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>bcdiv</function></funcdef>
      <paramdef>string <parameter>left operand</parameter></paramdef>
      <paramdef>string <parameter>right operand</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>scale</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Divides the <parameter>left operand</parameter> by the
     <parameter>right operand</parameter> and returns the result.  The
     optional <parameter>scale</parameter> sets the number of digits
     after the decimal place in the result.
    </para>
    <para>
     See also <function>bcmul</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.bcmod">
   <refnamediv>
    <refname>bcmod</refname>
    <refpurpose>
     Get modulus of an arbitrary precision number
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>bcmod</function></funcdef>
      <paramdef>string <parameter>left operand</parameter></paramdef>
      <paramdef>string <parameter>modulus</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Get the modulus of the <parameter>left operand</parameter> using
     <parameter>modulus</parameter>.
    </para>
    <para>
     See also <function>bcdiv</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.bcmul">
   <refnamediv>
    <refname>bcmul</refname>
    <refpurpose>Multiply two arbitrary precision number</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>bcmul</function></funcdef>
      <paramdef>string <parameter>left operand</parameter></paramdef>
      <paramdef>string <parameter>right operand</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>scale</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Multiply the <parameter>left operand</parameter> by the
     <parameter>right operand</parameter> and returns the result.  The
     optional <parameter>scale</parameter> sets the number of digits
     after the decimal place in the result.
    </para>
    <para>
     See also <function>bcdiv</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.bcpow">
   <refnamediv>
    <refname>bcpow</refname>
    <refpurpose>
     Raise an arbitrary precision number to another
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>bcpow</function></funcdef>
      <paramdef>string <parameter>x</parameter></paramdef>
      <paramdef>string <parameter>y</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>scale</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Raise <parameter>x</parameter> to the power
     <parameter>y</parameter>.  The optional
     <parameter>scale</parameter> can be used to set the number of
     digits after the decimal place in the result.
    </para>
    <para>
     See also <function>bcsqrt</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.bcscale">
   <refnamediv>
    <refname>bcscale</refname>
    <refpurpose>
     Set default scale parameter for all bc math functions
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>bcscale</function></funcdef>
      <paramdef>int <parameter>scale</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function sets the default scale parameter for all subsequent
     bc math functions that do not explicitly specify a scale
     parameter.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.bcsqrt">
   <refnamediv>
    <refname>bcsqrt</refname>
    <refpurpose>
     Get the square root of an arbitray precision number
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>bcsqrt</function></funcdef>
      <paramdef>string <parameter>operand</parameter></paramdef>
      <paramdef>int
       <parameter><optional>scale</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Return the square root of the <parameter>operand</parameter>.
     The optional <parameter>scale</parameter> parameter sets the
     number of digits after the decimal place in the result.
    </para>
    <para>
     See also <function>bcpow</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.bcsub">
   <refnamediv>
    <refname>bcsub</refname>
    <refpurpose>
     Subtract one arbitrary precision number from another
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>bcsub</function></funcdef>
      <paramdef>string <parameter>left operand</parameter></paramdef>
      <paramdef>string <parameter>right operand</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>scale</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Subtracts the <parameter>right operand</parameter> from the
     <parameter>left operand</parameter> and returns the result in a
     string.  The optional <parameter>scale</parameter> parameter is
     used to set the number of digits after the decimal place in the
     result.
    </para>
    <para>
     See also <function>bcadd</function>.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/calendar.xml
+++ phpdoc/kr/functions/calendar.xml
 <reference id="ref.calendar">
  <title>Calendar functions</title>
  <titleabbrev>Calendar</titleabbrev>

  <partintro>
   <para>
    The calendar functions are only available if you have compiled
    the calendar extension, found in either the "dl" or "ext"
    subdirectories of your PHP source code.
    Please see the README file before using it.
   </para>
   <para>
    The calendar extension presents a series of functions to simplify
    converting between different calendar formats.  The intermediary
    or standard it is based on is the Julian Day Count.  The Julian
    Day Count is a count of days starting way earlier than any date
    most people would need to track (somewhere around 4000bc).  To
    convert between calendar systems, you must first convert to Julian
    Day Count, then to the calendar system of your choice.  Julian Day
    Count is very different from the Julian Calendar!  For more
    information on calendar systems visit <ulink
    url="&url.calendar;">&url.calendar;</ulink>.  Excerpts from this
    page are included in these instructions, and are in quotes.
   </para>
  </partintro>

  <refentry id="function.jdtogregorian">
   <refnamediv>
    <refname>JDToGregorian</refname>
    <refpurpose>Converts Julian Day Count to Gregorian date</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>jdtogregorian</function></funcdef>
      <paramdef>int <parameter>julianday</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Converts Julian Day Count to a string containing the Gregorian
     date in the format of "month/day/year".
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gregoriantojd">
   <refnamediv>
    <refname>GregorianToJD</refname> 
    <refpurpose>
     Converts a Gregorian date to Julian Day Count
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gregoriantojd</function></funcdef>
      <paramdef>int <parameter>month</parameter></paramdef>
      <paramdef>int <parameter>day</parameter></paramdef>
      <paramdef>int <parameter>year</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Valid Range for Gregorian Calendar 4714 B.C. to 9999 A.D.</para>
    <para>
     Although this software can handle dates all the way back to 4714
     B.C., such use may not be meaningful. The Gregorian calendar was
     not instituted until October 15, 1582 (or October 5, 1582 in the
     Julian calendar). Some countries did not accept it until much
     later. For example, Britain converted in 1752, The USSR in 1918
     and Greece in 1923. Most European countries used the Julian
     calendar prior to the Gregorian.
     <example>
      <title>Calendar functions</title>
      <programlisting role="php">
&lt;?php
$jd = GregorianToJD (10,11,1970);
echo "$jd\n";
$gregorian = JDToGregorian ($jd);
echo "$gregorian\n";
?>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.jdtojulian">
   <refnamediv>
    <refname>JDToJulian</refname> 
    <refpurpose>
     Converts a Julian Day Count to a Julian Calendar Date
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>jdtojulian</function></funcdef>
      <paramdef>int <parameter>julianday</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Converts Julian Day Count to a string containing the Julian
     Calendar Date in the format of "month/day/year".
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.juliantojd">
   <refnamediv>
    <refname>JulianToJD</refname> 
    <refpurpose>
     Converts a Julian Calendar date to Julian Day Count
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>juliantojd</function></funcdef>
      <paramdef>int <parameter>month</parameter></paramdef>
      <paramdef>int <parameter>day</parameter></paramdef>
      <paramdef>int <parameter>year</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Valid Range for Julian Calendar 4713 B.C. to 9999 A.D.
    </para>
    <para>
     Although this software can handle dates all the way back to 4713
     B.C., such use may not be meaningful. The calendar was created in
     46 B.C., but the details did not stabilize until at least 8 A.D.,
     and perhaps as late at the 4th century. Also, the beginning of a
     year varied from one culture to another - not all accepted
     January as the first month.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.jdtojewish">
   <refnamediv>
    <refname>JDToJewish</refname>
    <refpurpose>
     Converts a Julian Day Count to the Jewish Calendar
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>jdtojewish</function></funcdef>
      <paramdef>int <parameter>julianday</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Converts a Julian Day Count the the Jewish Calendar.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.jewishtojd">
   <refnamediv>
    <refname>JewishToJD</refname> 
    <refpurpose>
     Converts a date in the Jewish Calendar to Julian Day Count
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>jewishtojd</function></funcdef>
      <paramdef>int <parameter>month</parameter></paramdef>
      <paramdef>int <parameter>day</parameter></paramdef>
      <paramdef>int <parameter>year</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Valid Range Although this software can handle dates all the way
     back to the year 1 (3761 B.C.), such use may not be meaningful.
    </para>
    <para>
     The Jewish calendar has been in use for several thousand years,
     but in the early days there was no formula to determine the start
     of a month. A new month was started when the new moon was first
     observed.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.jdtofrench">
   <refnamediv>
    <refname>JDToFrench</refname>
    <refpurpose>
     Converts a Julian Day Count to the French Republican Calendar
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>jdtofrench</function></funcdef>
      <paramdef>int <parameter>juliandaycount</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Converts a Julian Day Count to the French Republican Calendar.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.frenchtojd">
   <refnamediv>
    <refname>FrenchToJD</refname>
    <refpurpose>
     Converts a date from the French Republican Calendar to a Julian
     Day Count
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>frenchtojd</function></funcdef>
      <paramdef>int <parameter>month</parameter></paramdef>
      <paramdef>int <parameter>day</parameter></paramdef>
      <paramdef>int <parameter>year</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Converts a date from the French Republican Calendar to a Julian
     Day Count.
    </para>
    <para>
     These routines only convert dates in years 1 through 14
     (Gregorian dates 22 September 1792 through 22 September
     1806). This more than covers the period when the calendar was in
     use.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.jdmonthname">
   <refnamediv>
    <refname>JDMonthName</refname>
    <refpurpose>Returns a month name</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>jdmonthname</function></funcdef>
      <paramdef>int <parameter>julianday</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string containing a month name.
     <parameter>mode</parameter> tells this function which calendar to
     convert the Julian Day Count to, and what type of month names are
     to be returned.
     <table>
      <title>Calendar modes</title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>Mode</entry>
         <entry>Meaning</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>0</entry>
         <entry>Gregorian - abbreviated</entry>
        </row>
        <row>
         <entry>1</entry>
         <entry>Gregorian</entry>
        </row>
        <row>
         <entry>2</entry>
         <entry>Julian - abbreviated</entry>
        </row>
        <row>
         <entry>3</entry>
         <entry>Julian</entry>
        </row>
        <row>
         <entry>4</entry>
         <entry>Jewish</entry>
        </row>
        <row>
         <entry>5</entry>
         <entry>French Republican</entry>
        </row>
       </tbody>
      </tgroup>
     </table>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.jddayofweek">
   <refnamediv>
    <refname>JDDayOfWeek</refname>
    <refpurpose>Returns the day of the week</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>jddayofweek</function></funcdef>
      <paramdef>int <parameter>julianday</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the day of the week.  Can return a string or an int
     depending on the mode.
     <table>
      <title>Calendar week modes</title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>Mode</entry>
         <entry>Meaning</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>0</entry> 
         <entry>
          Returns the day number as an int (0=sunday, 1=monday, etc)
         </entry>
        </row>
        <row>
         <entry>1</entry> 
         <entry>
          Returns string containing the day of week
          (english-gregorian)
         </entry>
        </row>
        <row>
         <entry>2</entry> 
         <entry>
          Returns a string containing the abbreviated day of week
          (english-gregorian)
         </entry>
        </row>
       </tbody>
      </tgroup>
     </table>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.easter-date">
   <refnamediv>
    <refname>easter_date</refname>
    <refpurpose>
     Get UNIX timestamp for midnight on Easter of a given year
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>easter_date</function></funcdef>
      <paramdef>int <parameter>year</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the UNIX timestamp corresponding to midnight on Easter of
     the given year.  If no year is specified, the current year is
     assumed.
    </para>
    <para>
     <emphasis>Warning:</emphasis> This function will generate
     a warning if the year is outside of the range for UNIX
     timestamps (i.e. before 1970 or after 2037).
     <example>
      <title><function>easter_date</function> example</title>
      <programlisting role="php">
echo date ("M-d-Y", easter_date(1999));        /* "Apr-04-1999" */
echo date ("M-d-Y", easter_date(2000));        /* "Apr-23-2000" */
echo date ("M-d-Y", easter_date(2001));        /* "Apr-15-2001" */
      </programlisting>
     </example>
    </para>
    <para>
     The date of Easter Day was defined by the Council of Nicaea in
     AD325 as the Sunday after the first full moon which falls on or
     after the Spring Equinox.  The Equinox is assumed to always fall
     on 21st March, so the calculation reduces to determining the date
     of the full moon and the date of the following Sunday.  The
     algorithm used here was introduced around the year 532 by
     Dionysius Exiguus.  Under the Julian Calendar (for years before
     1753) a simple 19-year cycle is used to track the phases of the
     Moon.  Under the Gregorian Calendar (for years after 1753 -
     devised by Clavius and Lilius, and introduced by Pope Gregory
     XIII in October 1582, and into Britain and its then colonies in
     September 1752) two correction factors are added to make the
     cycle more accurate.
    </para>
    <para>
     (The code is based on a C program by Simon Kershaw,
     &lt;[EMAIL PROTECTED]&gt;)
    </para>
    <para>
     See <function>easter_days</function> for calculating Easter
     before 1970 or after 2037.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.easter-days">
   <refnamediv>
    <refname>easter_days</refname>
    <refpurpose>
     Get number of days after March 21 on which Easter falls for a
     given year
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>easter_days</function></funcdef>
      <paramdef>int <parameter>year</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the number of days after March 21 on which Easter falls
     for a given year.  If no year is specified, the current year is
     assumed.
    </para>
    <para>
     This function can be used instead of
     <function>easter_date</function> to calculate Easter for years
     which fall outside the range of UNIX timestamps (i.e. before 1970
     or after 2037).
     <example>
      <title><function>Easter_date</function> example</title>
      <programlisting role="php">
echo easter_days (1999);        /* 14, i.e. April 4   */
echo easter_days (1492);        /* 32, i.e. April 22  */
echo easter_days (1913);        /*  2, i.e. March 23  */
      </programlisting>
     </example>
    </para>
    <para>
     The date of Easter Day was defined by the Council of Nicaea in
     AD325 as the Sunday after the first full moon which falls on or
     after the Spring Equinox.  The Equinox is assumed to always fall
     on 21st March, so the calculation reduces to determining the date
     of the full moon and the date of the following Sunday.  The
     algorithm used here was introduced around the year 532 by
     Dionysius Exiguus.  Under the Julian Calendar (for years before
     1753) a simple 19-year cycle is used to track the phases of the
     Moon.  Under the Gregorian Calendar (for years after 1753 -
     devised by Clavius and Lilius, and introduced by Pope Gregory
     XIII in October 1582, and into Britain and its then colonies in
     September 1752) two correction factors are added to make the
     cycle more accurate.
    </para>
    <para>
     (The code is based on a C program by Simon Kershaw,
     &lt;[EMAIL PROTECTED]&gt;)
    </para>
    <para>
     See also <function>easter_date</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.unixtojd">
   <refnamediv>
    <refname>unixtojd</refname>
    <refpurpose>Convert UNIX timestamp to Julian Day</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>unixtojd</function></funcdef>
      <paramdef>int 
       <parameter><optional>timestamp</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Return the Julian Day for a UNIX <parameter>timestamp</parameter>
     (seconds since 1.1.1970), or for the current day if no
     <parameter>timestamp</parameter> is given.
    </para>
    <para>
     See also <function>jdtounix</function>.
    </para>
    <note>
     <para>
      This function is only available in PHP versions after PHP4RC1.
     </para>
    </note>
   </refsect1>
  </refentry>
  
  <refentry id="function.jdtounix"> 
   <refnamediv>
    <refname>jdtounix</refname>
    <refpurpose>Convert Julian Day to UNIX timestamp</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>jdtounix</function></funcdef>
      <paramdef>int <parameter>jday</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function will return a UNIX timestamp corresponding to the
     Julian Day given in <parameter>jday</parameter> or false if
     <parameter>jday</parameter> is not inside the UNIX epoch
     (Gregorian years between 1970 and 2037 or 2440588 &lt;=
     <parameter>jday</parameter> &lt;= 2465342 )
    </para>
    <para>
     See also <function>jdtounix</function>.
    </para>
    <note>
     <para>
      This function is only available in PHP versions after PHP4RC1.
     </para>
    </note>
   </refsect1>
  </refentry>
  
 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/ccvs.xml
+++ phpdoc/kr/functions/ccvs.xml
<!-- 
CCVS Documentation by Brendan W. McAdams <[EMAIL PROTECTED]>
Copyright (c) 2000 by the PHP Group

-Special Thanks to RedHat, Inc. for the contribution of their original
documentation for the php3 version of this module, which helped us
start this document.  
-->
 
 <reference id="ref.ccvs">
  <title>CCVS API Functions</title>
  <titleabbrev>CCVS</titleabbrev>

  <partintro>
   <simpara>
    These functions interface the CCVS API, allowing you to directly
    work with CCVS from your PHP scripts.  CCVS is <ulink
    url="&url.redhat;">RedHat's</ulink> solution to the "middle-man"
    in credit card processing.  It lets you directly address the
    credit card clearing houses via your *nix box and a modem.  Using
    the CCVS module for PHP, you can process credit cards directly
    through CCVS via your PHP Scripts.  The following references will
    outline the process.
   </simpara>
   <simpara>
    To enable CCVS Support in PHP, first verify your CCVS installation
    directory.  You will then need to configure PHP with the <option
    role="configure">--with-ccvs</option> option. If you use this
    option without specifying the path to your CCVS installation, PHP
    Will attempt to look in the default CCVS Install location
    (/usr/local/ccvs). If CCVS is in a non-standard location, run
    configure with: <option
    role="configure">--with-ccvs=$ccvs_path</option>, where $ccvs_path
    is the path to your CCVS installation.  Please note that CCVS
    support requires that $ccvs_path/lib and $ccvs_path/include exist,
    and include cv_api.h under the include directory and libccvs.a
    under the lib directory.
   </simpara>
   <simpara>
    Additionally, a ccvsd process will need to be running for the
    configurations you intend to use in your PHP scripts. You will
    also need to make sure the PHP Processes are running under the
    same user as your CCVS was installed as (e.g. if you installed
    CCVS as user 'ccvs', your PHP processes must run as 'ccvs' as
    well.)
   </simpara>
   <simpara>
    Additional information about CCVS can be found at <ulink
    url="&url.redhat.ccvs;">&url.redhat.ccvs;</ulink>.
   </simpara>
   <simpara>
    This documentation section is being worked on.  Until then, RedHat
    maintains slightly outdated but still useful documentation at
    <ulink url="&url.redhat.support;">&url.redhat.support;</ulink>.
   </simpara>
  </partintro>

  <refentry>
   <refnamediv>
    <refname></refname>
    <refpurpose></refpurpose>
   </refnamediv>
   <refsect1>
    <title></title>
    <funcsynopsis>
     <funcprototype>
      <funcdef> <function></function></funcdef>
      <paramdef> <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/classobj.xml
+++ phpdoc/kr/functions/classobj.xml
 <reference id="ref.classobj">
  <title>Class/Object Functions</title>
  <titleabbrev>Classes/Objects</titleabbrev>

  <partintro>
   <sect1 id="classobj.partintro">
    <title>Introduction</title>
    <sect2 id="classobj.intro">
     <title>About</title>
     <para>
      These functions allow you to obtain information about classes
      and instance objects. You can obtain the name of the class to
      which a object belongs, as well as its member properties and 
      methods. Using these functions, you can find out not only the
      class membership of an object, but also its parentage (i.e.
      what class is the object class extending).
     </para>
    </sect2>
    <sect2 id="classobj.example">
     <title>An example of use</title>
     <para>
      In this example, we first define a base class and an extension
      of the class. The base class describes a general vegetable,
      whether it is edible or not and what is its color. The subclass
      <varname>Spinach</varname> adds a method to cook it and another to
      find out if it is cooked.
     </para>
     <para>
      <example>
       <title>classes.inc</title>
       <programlisting role="php">
&lt;?php

// base class with member properties and methods
class Vegetable {

    var $edible;
    var $color;

    function Vegetable( $edible, $color=&quot;green&quot; ) {
        $this-&gt;edible = $edible;
        $this-&gt;color = $color;
    }

    function is_edible() {
        return $this-&gt;edible;
    }

    function what_color() {
        return $this-&gt;color;
    }
    
} // end of class Vegetable


// extends the base class
class Spinach extends Vegetable {

    var $cooked = false;

    function Spinach() {
        $this-&gt;Vegetable( true, &quot;green&quot; );
    }

    function cook_it() {
        $this-&gt;cooked = true;
    }

    function is_cooked() {
        return $this-&gt;cooked;
    }
    
} // end of class Spinach

?&gt;
       </programlisting>
      </example>
     </para>
     <para>
     We then instantiate 2 objects from these classes and print out
     information about them, including their class parentage.
     We also define some utility functions, mainly to have a nice printout
     of the variables.
     </para>
     <para>
      <example>
       <title>test_script.php</title>
       <programlisting role="php">
&lt;pre&gt;
&lt;?php

include &quot;classes.inc&quot;;

// utility functions

function print_vars($obj) {
    $arr = get_object_vars($obj);
    while (list($prop, $val) = each($arr))
        echo &quot;\t$prop = $val\n&quot;;
}

function print_methods($obj) {
    $arr = get_class_methods(get_class($obj));
    foreach ($arr as $method)
        echo &quot;\tfunction $method()\n&quot;;
}

function class_parentage($obj, $class) {
    global $$obj;
    if (is_subclass_of($$obj, $class)) {
        echo &quot;Object $obj belongs to class &quot;.get_class($$obj);
        echo &quot; a subclass of $class\n&quot;;
    } else {
        echo &quot;Object $obj does not belong to a subclass of $class\n&quot;;
    }
}

// instantiate 2 objects

$veggie = new Vegetable(true,&quot;blue&quot;);
$leafy = new Spinach();

// print out information about objects
echo &quot;veggie: CLASS &quot;.get_class($veggie).&quot;\n&quot;;
echo &quot;leafy: CLASS &quot;.get_class($leafy);
echo &quot;, PARENT &quot;.get_parent_class($leafy).&quot;\n&quot;;

// show veggie properties
echo &quot;\nveggie: Properties\n&quot;;
print_vars($veggie);

// and leafy methods
echo &quot;\nleafy: Methods\n&quot;;
print_methods($leafy);

echo &quot;\nParentage:\n&quot;;
class_parentage(&quot;leafy&quot;, &quot;Spinach&quot;);
class_parentage(&quot;leafy&quot;, &quot;Vegetable&quot;);
?&gt;
&lt;/pre&gt;
       </programlisting>
      </example>
     </para>
     <para>
      One important thing to note in the example above is that
      the object <varname>$leafy</varname> is an instance of the class
      <classname>Spinach</classname> which is a subclass of 
      <classname>Vegetable</classname>,
      therefore the last part of the script above will output:
     </para>
     <para>
      <informalexample>
       <programlisting>
       [...]
Parentage:
Object leafy does not belong to a subclass of Spinach
Object leafy belongs to class spinach a subclass of Vegetable
       </programlisting>
      </informalexample>
     </para>
    </sect2>
   </sect1>
  </partintro>

  <refentry id="function.call-user-method">
   <refnamediv>
    <refname>call_user_method</refname>
    <refpurpose>
     Call a user method on an specific object
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed 
       <function>call_user_method</function>
      </funcdef>
      <paramdef>string 
       <parameter>method_name</parameter>
      </paramdef>
      <paramdef>object 
       <parameter>obj</parameter>
      </paramdef>
      <paramdef>mixed 
       <parameter><optional>parameter</optional></parameter>
      </paramdef>
      <paramdef>mixed 
       <parameter><optional>...</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Calls a the method referred by <parameter>method_name</parameter> from
     the user defined <parameter>obj</parameter> object. An example of usage
     is below, where we define a class, instantiate an object and use
     <function>call_user_method</function> to call indirectly its
     <varname>print_info</varname> method.
     <informalexample>
      <programlisting role="php">
&lt;?php
class Country {
    var $NAME;
    var $TLD;
    
    function Country($name, $tld) {
        $this-&gt;NAME = $name;
        $this-&gt;TLD = $tld;
    }

    function print_info($prestr=&quot;&quot;) {
        echo $prestr.&quot;Country: &quot;.$this-&gt;NAME.&quot;\n&quot;;
        echo $prestr.&quot;Top Level Domain: &quot;.$this-&gt;TLD.&quot;\n&quot;;
    }
}

$cntry = new Country(&quot;Peru&quot;,&quot;pe&quot;);

echo &quot;* Calling the object method directly\n&quot;;
$cntry-&gt;print_info();

echo &quot;\n* Calling the same method indirectly\n&quot;;
call_user_method (&quot;print_info&quot;, $cntry, &quot;\t&quot;);
?&gt;
      </programlisting>
     </informalexample>
    </para>
    <simpara>
     See also <function>call_user_func</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.class-exists">
   <refnamediv>
    <refname>class_exists</refname>
    <refpurpose>Checks if the class has been defined</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>class_exists</function></funcdef>
      <paramdef>string <parameter>class_name</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns true if the class given by
     <parameter>class_name</parameter> has been defined,
     false otherwise.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.get-class">
   <refnamediv>
    <refname>get_class</refname>
    <refpurpose>Returns the name of the class of an object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>get_class</function></funcdef>
      <paramdef>object <parameter>obj</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns the name of the class of which the
     object <parameter>obj</parameter> is an instance.
    </para>
    <simpara>
     See also <function>get_parent_class</function>,
     <function>is_subclass_of</function>
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.get-class-methods">
   <refnamediv>
    <refname>get_class_methods</refname>
    <refpurpose>Returns an array of class methods' names</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>get_class_methods</function></funcdef>
      <paramdef>string <parameter>class_name</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns an array of method names defined for the
     class specified by <parameter>class_name</parameter>.
    </para>
    <simpara>
     See also <function>get_class_vars</function>,
     <function>get_object_vars</function>
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.get-class-vars">
   <refnamediv>
    <refname>get_class_vars</refname>
    <refpurpose>
     Returns an array of default properties of the class
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>get_class_vars</function></funcdef>
      <paramdef>string <parameter>class_name</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function will return an array of default properties of the
     class.
    </para>
    <simpara>
     See also <function>get_class_methods</function>,
     <function>get_object_vars</function>
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.get-declared-classes">
   <refnamediv>
    <refname>get_declared_classes</refname>
    <refpurpose>Returns an array with the name of the defined classes</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>get_declared_classes</function></funcdef>
      <paramdef>void</paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns an array of the names of the declared classes
     in the current script.
    </para>
    <note>
     <para>
      In PHP 4.0.1pl2, three extra classes are returned at the beginning of
      the array: <classname>stdClass</classname> (defined in 
      <filename>Zend/zend.c</filename>),
      <classname>OverloadedTestClass</classname> (defined in
      <filename>ext/standard/basic_functions.c</filename>) 
      and <classname>Directory</classname>
      (defined in <filename>ext/standard/dir.c</filename>).
     </para>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.get-object-vars">
   <refnamediv>
    <refname>get_object_vars</refname>
    <refpurpose>Returns an associative array of object properties</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>get_object_vars</function></funcdef>
      <paramdef>object <parameter>obj</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns an associative array of defined object properties 
     for the specified object <parameter>obj</parameter>. If variables
     declared in the class of which the <parameter>obj</parameter> is an
     instance, have not been assigned a value, those will not be returned 
     in the array.
     <example>
      <title>Use of <function>get_object_vars</function></title>
      <programlisting role="php">
&lt;?php
class Point2D {
    var $x, $y;
    var $label;

    function Point2D($x, $y) {
        $this-&gt;x = $x;
        $this-&gt;y = $y;
    }

    function setLabel($label) {
        $this-&gt;label = $label;
    }

    function getPoint() {
        return array("x" =&gt; $this-&gt;x,
                     "y" =&gt; $this-&gt;y,
                     "label" =&gt; $this-&gt;label);
    }
}

$p1 = new Point2D(1.233, 3.445);
print_r(get_object_vars($p1));
// "$label" is declared but not defined
// Array
// (
//     [x] =&gt; 1.233
//     [y] =&gt; 3.445
// )

$p1-&gt;setLabel("point #1");
print_r(get_object_vars($p1));
// Array
// (
//     [x] =&gt; 1.233
//     [y] =&gt; 3.445
//     [label] =&gt; point #1
// )

?&gt;
      </programlisting>
     </example>
    </para>
    <simpara>
     See also <function>get_class_methods</function>,
     <function>get_class_vars</function>
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.get-parent-class">
   <refnamediv>
    <refname>get_parent_class</refname>
    <refpurpose>Returns the name of the parent class of an object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>get_parent_class</function></funcdef>
      <paramdef>object <parameter>obj</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns the name of the parent class to
     the class of which the object <parameter>obj</parameter> 
     is an instance.
    </para>
    <simpara>
     See also <function>get_class</function>,
     <function>is_subclass_of</function>
    </simpara>
   </refsect1>
  </refentry>

 <refentry id="function.is-subclass-of">
   <refnamediv>
    <refname>is_subclass_of</refname>
    <refpurpose>
     Determines if an object belongs to a subclass
     of the specified class
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>is_subclass_of</function></funcdef>
      <paramdef>object <parameter>obj</parameter></paramdef>
      <paramdef>string <parameter>superclass</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns true if the object <parameter>obj</parameter>,
     belongs to a class which is a subclass of
     <parameter>superclass</parameter>, false otherwise.
    </para>
    <simpara>
     See also <function>get_class</function>,
     <function>get_parent_class</function>
    </simpara>
   </refsect1>
  </refentry>
  <refentry id="function.method-exists">
   <refnamediv>
    <refname>method_exists</refname>
    <refpurpose>Checks if the class method exists</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>method_exists</function></funcdef>
      <paramdef>object <parameter>object</parameter></paramdef>
      <paramdef>string <parameter>method_name</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns true if the method given by
     <parameter>method_name</parameter> has been defined for the given
     <parameter>object</parameter>, false otherwise.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/com.xml
+++ phpdoc/kr/functions/com.xml
 <reference id="ref.com">
  <title>COM support functions for Windows</title>
  <titleabbrev>COM</titleabbrev>

  <partintro>
   <simpara>
    These functions are only available on the Windows version of
    PHP. These functions have been added in PHP 4.
   </simpara>
  </partintro>

  <refentry id="function.com-load">
   <refnamediv>
    <refname>com_load</refname>
    <refpurpose>
     Creates a new reference to a COM component
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>com_load</function></funcdef>
      <paramdef>string <parameter>module name</parameter></paramdef>
      <paramdef>string 
       <parameter>
        <optional>server name</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>com_load</function> creates a new COM component and
     returns a reference to it. Returns <literal>false</literal> on
     failiure.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.com-invoke">
   <refnamediv>
    <refname>com_invoke</refname>
    <refpurpose>
     Calls a COM component's method.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>com_invoke</function></funcdef>
      <paramdef>resource <parameter>com_object</parameter></paramdef>
      <paramdef>string <parameter>function_name</parameter></paramdef>
      <paramdef>mixed 
       <parameter>
        <optional>function parameters, ...</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Com_invoke</function> invokes a method of the COM
     component referenced by
     <parameter>com_object</parameter>. Returns
     <literal>false</literal> on error, returns the
     <parameter>function_name</parameter>'s return value on success.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.com-propget">
   <refnamediv>
    <refname>com_propget</refname>
    <refpurpose>
     Gets the value of a COM Component's property
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>com_propget</function></funcdef>
      <paramdef>resource <parameter>com_object</parameter></paramdef>
      <paramdef>string <parameter>property</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function is an alias for <function>com_get</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.com-get">
   <refnamediv>
    <refname>com_get</refname>
    <refpurpose>
     Gets the value of a COM Component's property
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>com_get</function></funcdef>
      <paramdef>resource <parameter>com_object</parameter></paramdef>
      <paramdef>string <parameter>property</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the value of the <parameter>property</parameter> of the
     COM component referenced by <parameter>com_object</parameter>.
     Returns <literal>false</literal> on error.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.com-propput">
   <refnamediv>
    <refname>com_propput</refname>
    <refpurpose>
     Assigns a value to a COM component's property
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>com_propput</function></funcdef>
      <paramdef>resource <parameter>com_object</parameter></paramdef>
      <paramdef>string <parameter>property</parameter></paramdef>
      <paramdef>mixed <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function is an alias for <function>com_set</function>.         
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.com-propset">
   <refnamediv>
    <refname>com_propset</refname>
    <refpurpose>
     Assigns a value to a COM component's property
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>com_propset</function></funcdef>
      <paramdef>resource <parameter>com_object</parameter></paramdef>
      <paramdef>string <parameter>property</parameter></paramdef>
      <paramdef>mixed <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function is an alias for <function>com_set</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.com-set">
   <refnamediv>
    <refname>com_set</refname>
    <refpurpose>
     Assigns a value to a COM component's property
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>com_set</function></funcdef>
      <paramdef>resource <parameter>com_object</parameter></paramdef>
      <paramdef>string <parameter>property</parameter></paramdef>
      <paramdef>mixed <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets the value of the <parameter>property</parameter> of the COM
     component referenced by <parameter>com_object</parameter>.
     Returns <literal>true</literal> if
     <parameter>property</parameter> is set. Returns
     <literal>false</literal> on error.
    </para>
   </refsect1>
  </refentry>
 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/cpdf.xml
+++ phpdoc/kr/functions/cpdf.xml
 <reference id="ref.cpdf">
  <title>ClibPDF functions</title>
  <titleabbrev>ClibPDF</titleabbrev>

  <partintro>
   <simpara>
    ClibPDF lets you create PDF documents with PHP. It is available at
    <ulink url="&url.fastio;">FastIO</ulink> but it isn't free
    software. You should definitely read the licence before you start
    playing with ClibPDF. If you cannot fullfil the licence agreement
    consider using pdflib by Thomas Merz, which is also very powerful.
    ClibPDF functionality and API is similar to Thomas Merz's pdflib but,
    according to FastIO, ClibPDF is faster and creates smaller documents.
    This may have changed with the new version 2.0 of pdflib.  A simple
    benchmark (the pdfclock.c example from pdflib 2.0 turned into a php
    script) actually shows no difference in speed at all. The file size
    is also similar if compression is turned off.  So, try them both
    and see which one does the job for you.
   </simpara>
   <simpara>
    This documentation should be read alongside the ClibPDF manual since it
    explains the library in much greater detail. 
   </simpara>

   <simpara>
    Many functions in the native ClibPDF and the PHP module, as
    well as in pdflib, have the same name.  All functions except for
    <function>cpdf_open</function> take the handle for the document as
    their first parameter.
   </simpara>
   <simpara>
    Currently this handle is not used internally since ClibPDF does
    not support the creation of several PDF documents at the same time.
    Actually, you should not even try it, the results are unpredictable. I
    can't oversee what the consequences in a multi threaded environment
    are.  According to the author of ClibPDF this will change in one of
    the next releases (current version when this was written is 1.10).
    If you need this functionality use the pdflib module.
   </simpara>
   <note>
    <simpara>
     The function <function>cpdf_set_font</function> has changed since PHP 3
     to support asian fonts. The encoding parameter is no longer an integer
     but a string.
    </simpara>
   </note>
   <simpara>
    One big advantage of ClibPDF over pdflib used to be the possibility
    to create
    the pdf document completely in memory without using temporary files.
    It also provides the ability to pass coordinates in a predefined
    unit length. This is a handy feature but can be simulated with
    <function>pdf_translate</function>.
   </simpara>
   <simpara>
    Another nice feature of ClibPDF is the fact that any page can be modified
    at any time even if a new page has been already opened. The function
    <function>cpdf_set_current_page</function> allows to leave the current
    page and presume modifying an other page.
   </simpara>
   <simpara>
    Most of the functions are fairly easy to use. The most difficult part
    is probably creating a very simple PDF document at all. The following
    example should help you to get started. It creates a document
    with one page. The page contains the text "Times-Roman" in an
    outlined 30pt font. The text is underlined.
   </simpara>
   <example>
    <title>Simple ClibPDF Example</title>
    <programlisting>
&lt;?php
$cpdf = cpdf_open(0);
cpdf_page_init($cpdf, 1, 0, 595, 842);
cpdf_add_outline($cpdf, 0, 0, 0, 1, "Page 1");
cpdf_begin_text($cpdf);
cpdf_set_font($cpdf, "Times-Roman", 30, "WinAnsiEncoding");
cpdf_set_text_rendering($cpdf, 1);
cpdf_text($cpdf, "Times Roman outlined", 50, 750);
cpdf_end_text($cpdf);   
cpdf_moveto($cpdf, 50, 740);
cpdf_lineto($cpdf, 330, 740);
cpdf_stroke($cpdf);
cpdf_finalize($cpdf);
Header("Content-type: application/pdf");
cpdf_output_buffer($cpdf);
cpdf_close($cpdf);
?&gt;
    </programlisting>
   </example>
   <simpara>
    The pdflib distribution contains a more complex example which creates a
    series of pages with an analog clock. Here is that example converted
    into PHP using the ClibPDF extension:
   </simpara>
   <example>
    <title>pdfclock example from pdflib 2.0 distribution</title>
    <programlisting>
&lt;?php
$radius = 200;
$margin = 20;
$pagecount = 40;

$pdf = cpdf_open(0);
cpdf_set_creator($pdf, "pdf_clock.php3");
cpdf_set_title($pdf, "Analog Clock");
  
while($pagecount-- > 0) {
  cpdf_page_init($pdf, $pagecount+1, 0, 2 * ($radius + $margin), 2 * ($radius + 
$margin), 1.0);
  
  cpdf_set_page_animation($pdf, 4, 0.5, 0, 0, 0);  /* wipe */
  
  cpdf_translate($pdf, $radius + $margin, $radius + $margin);
  cpdf_save($pdf);
  cpdf_setrgbcolor($pdf, 0.0, 0.0, 1.0);
  
  /* minute strokes */
  cpdf_setlinewidth($pdf, 2.0);
  for ($alpha = 0; $alpha &lt; 360; $alpha += 6)
    {
    cpdf_rotate($pdf, 6.0);
    cpdf_moveto($pdf, $radius, 0.0);
    cpdf_lineto($pdf, $radius-$margin/3, 0.0);
    cpdf_stroke($pdf);
    }
  
  cpdf_restore($pdf);
  cpdf_save($pdf);
 
  /* 5 minute strokes */
  cpdf_setlinewidth($pdf, 3.0);
  for ($alpha = 0; $alpha &lt; 360; $alpha += 30)
  {
    cpdf_rotate($pdf, 30.0);
    cpdf_moveto($pdf, $radius, 0.0);
    cpdf_lineto($pdf, $radius-$margin, 0.0);
    cpdf_stroke($pdf);
  }

  $ltime = getdate();

  /* draw hour hand */
  cpdf_save($pdf);
  cpdf_rotate($pdf, -(($ltime['minutes']/60.0) + $ltime['hours'] - 3.0) * 30.0);
  cpdf_moveto($pdf, -$radius/10, -$radius/20);
  cpdf_lineto($pdf, $radius/2, 0.0);
  cpdf_lineto($pdf, -$radius/10, $radius/20);
  cpdf_closepath($pdf);
  cpdf_fill($pdf);
  cpdf_restore($pdf);

  /* draw minute hand */
  cpdf_save($pdf);
  cpdf_rotate($pdf, -(($ltime['seconds']/60.0) + $ltime['minutes'] - 15.0) * 6.0);
  cpdf_moveto($pdf, -$radius/10, -$radius/20);
  cpdf_lineto($pdf, $radius * 0.8, 0.0);
  cpdf_lineto($pdf, -$radius/10, $radius/20);
  cpdf_closepath($pdf);
  cpdf_fill($pdf);
  cpdf_restore($pdf);

  /* draw second hand */
  cpdf_setrgbcolor($pdf, 1.0, 0.0, 0.0);
  cpdf_setlinewidth($pdf, 2);
  cpdf_save($pdf);
  cpdf_rotate($pdf, -(($ltime['seconds'] - 15.0) * 6.0));
  cpdf_moveto($pdf, -$radius/5, 0.0);
  cpdf_lineto($pdf, $radius, 0.0);
  cpdf_stroke($pdf);
  cpdf_restore($pdf);

  /* draw little circle at center */
  cpdf_circle($pdf, 0, 0, $radius/30);
  cpdf_fill($pdf);

  cpdf_restore($pdf);

  cpdf_finalize_page($pdf, $pagecount+1);
}

cpdf_finalize($pdf);
Header("Content-type: application/pdf");
cpdf_output_buffer($pdf);
cpdf_close($pdf);
?&gt;
    </programlisting>
   </example>
  </partintro>

  <refentry id="function.cpdf-global-set-document-limits">
   <refnamediv>
    <refname>cpdf_global_set_document_limits</refname>
    <refpurpose>Sets document limits for any pdf document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>
       void <function>cpdf_global_set_document_limits</function>
      </funcdef>
      <paramdef>int <parameter>maxpages</parameter></paramdef>
      <paramdef>int <parameter>maxfonts</parameter></paramdef>
      <paramdef>int <parameter>maximages</parameter></paramdef>
      <paramdef>int <parameter>maxannotations</parameter></paramdef>
      <paramdef>int <parameter>maxobjects</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_global_set_document_limits</function> function sets
     several document limits. This function has to be called before
     <function>cpdf_open</function> to take effect. It sets the limits
     for any document open afterwards.
    </para>
    <para>
     See also <function>cpdf_open</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-set-creator">
   <refnamediv>
    <refname>cpdf_set_creator</refname>
    <refpurpose>Sets the creator field in the pdf document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_set_creator</function></funcdef>
      <paramdef>string <parameter>creator</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_set_creator</function> function sets the
     creator of a pdf document.
    </para>
    <para>
     See also <function>cpdf_set_subject</function>,
              <function>cpdf_set_title</function>,
              <function>cpdf_set_keywords</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-set-title">
   <refnamediv>
    <refname>cpdf_set_title</refname>
    <refpurpose>Sets the title field of the pdf document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_set_title</function></funcdef>
      <paramdef>string <parameter>title</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_set_title</function> function sets the
     title of a pdf document.
    </para>
    <para>
     See also <function>cpdf_set_subject</function>,
              <function>cpdf_set_creator</function>,
              <function>cpdf_set_keywords</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-set-subject">
   <refnamediv>
    <refname>cpdf_set_subject</refname>
    <refpurpose>Sets the subject field of the pdf document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_set_subject</function></funcdef>
      <paramdef>string <parameter>subject</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_set_subject</function> function sets the
     subject of a pdf document.
    </para>
    <para>
     See also <function>cpdf_set_title</function>,
              <function>cpdf_set_creator</function>,
              <function>cpdf_set_keywords</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-set-keywords">
   <refnamediv>
    <refname>cpdf_set_keywords</refname>
    <refpurpose>Sets the keywords field of the pdf document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_set_keywords</function></funcdef>
      <paramdef>string <parameter>keywords</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_set_keywords</function> function sets the
     keywords of a pdf document.
    </para>
    <para>
     See also <function>cpdf_set_title</function>,
              <function>cpdf_set_creator</function>,
              <function>cpdf_set_subject</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-open">
   <refnamediv>
    <refname>cpdf_open</refname>
    <refpurpose>Opens a new pdf document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>cpdf_open</function></funcdef>
      <paramdef>int <parameter>compression</parameter></paramdef>
      <paramdef>
       string <parameter><optional>filename</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_open</function> function opens
     a new pdf document. The first parameter turns document compression
     on if it is unequal to 0. The second optional parameter sets the
     file in which the document is written. If it is omitted the document
     is created in memory and can either be written into a file with
     the <function>cpdf_save_to_file</function> or written to standard
     output with <function>cpdf_output_buffer</function>.
     <note>
      <simpara>
       The return value will be needed in further versions of ClibPDF
       as the first parameter in all other functions which are writing
       to the pdf document.
      </simpara>
      <simpara>
       The ClibPDF library takes the filename "-" as a synonym for
       stdout. If PHP is compiled as an apache module this will not
       work because the way ClibPDF outputs to stdout does not work
       with apache. You can solve this problem by skipping the
       filename and using <function>cpdf_output_buffer</function> to
       output the pdf document.
      </simpara>
     </note>
    </para>
    <para>
     See also <function>cpdf_close</function>,
              <function>cpdf_output_buffer</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-close">
   <refnamediv>
    <refname>cpdf_close</refname>
    <refpurpose>Closes the pdf document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_close</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_close</function> function closes the pdf document.
     This should be the last function even after
     <function>cpdf_finalize</function>, <function>cpdf_output_buffer</function>
     and <function>cpdf_save_to_file</function>.
    </para>
    <para>
     See also <function>cpdf_open</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-page-init">
   <refnamediv>
    <refname>cpdf_page_init</refname>
    <refpurpose>Starts new page</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_page_init</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>int <parameter>page number</parameter></paramdef>
      <paramdef>int <parameter>orientation</parameter></paramdef>
      <paramdef>double <parameter>height</parameter></paramdef>
      <paramdef>double <parameter>width</parameter></paramdef>
      <paramdef>
       double <parameter><optional>unit</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_page_init</function> function starts a new
     page with height <parameter>height</parameter> and width
     <parameter>width</parameter>. The page has number
     <parameter>page number</parameter> and orientation
     <parameter>orientation</parameter>. <parameter>orientation</parameter>
     can be 0 for portrait and 1 for landscape. The last optional parameter
     <parameter>unit</parameter> sets the unit for the coordinate system.
     The value should be the number of postscript points per unit. Since
     one inch is equal to 72 points, a value of 72 would set the unit
     to one inch. The default is also 72.
    </para>
    <para>
     See also <function>cpdf_set_current_page</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-finalize-page">
   <refnamediv>
    <refname>cpdf_finalize_page</refname>
    <refpurpose>Ends page</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_finalize_page</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>int <parameter>page number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_finalize_page</function> function ends the page
     with page number <parameter>page number</parameter>.
    </para>
    <para>
     This function is only for saving memory. A finalized page takes
     less memory but cannot be modified anymore.
    </para>
    <para>
     See also <function>cpdf_page_init</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-finalize">
   <refnamediv>
    <refname>cpdf_finalize</refname>
    <refpurpose>Ends document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_finalize</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_finalize</function> function ends the document.
     You still have to call <function>cpdf_close</function>
    </para>
    <para>
     See also <function>cpdf_close</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-output-buffer">
   <refnamediv>
    <refname>cpdf_output_buffer</refname>
    <refpurpose>Outputs the pdf document in memory buffer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_output_buffer</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_output_buffer</function> function outputs
     the pdf document to stdout. The document has to be created in memory which
     is the case if <function>cpdf_open</function> has been called with
     no filename parameter.
    </para>
    <para>
     See also <function>cpdf_open</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-save-to-file">
   <refnamediv>
    <refname>cpdf_save_to_file</refname>
    <refpurpose>Writes the pdf document into a file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_save_to_file</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_save_to_file</function> function outputs
     the pdf document into a file if it has been created in memory.
    </para>
    <para>
     This function is not needed if the pdf document has been open
     by specifying a filename as a parameter of <function>cpdf_open</function>.
    </para>
    <para>
     See also <function>cpdf_output_buffer</function>,
              <function>cpdf_open</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-set-current-page">
   <refnamediv>
    <refname>cpdf_set_current_page</refname>
    <refpurpose>Sets current page</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_set_current_page</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>int <parameter>page number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_set_current_page</function> function set the page
     on which all operations are performed. One can switch between pages
     until a page is finished with <function>cpdf_finalize_page</function>.
    </para>
    <para>
     See also <function>cpdf_finalize_page</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-begin-text">
   <refnamediv>
    <refname>cpdf_begin_text</refname>
    <refpurpose>Starts text section</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_begin_text</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_begin_text</function> function starts a text
     section. It must be ended with <function>cpdf_end_text</function>.
     <example>
      <title>Text output</title>
      <programlisting>
&lt;?php
cpdf_begin_text($pdf);
cpdf_set_font($pdf, 16, "Helvetica", "WinAnsiEncoding");
cpdf_text($pdf, 100, 100, "Some text");
cpdf_end_text($pdf)
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>cpdf_end_text</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-end-text">
   <refnamediv>
    <refname>cpdf_end_text</refname>
    <refpurpose>Ends text section</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_end_text</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_end_text</function> function ends a text
     section which was started with <function>cpdf_begin_text</function>.
     <example>
      <title>Text output</title>
      <programlisting>
&lt;?php
cpdf_begin_text($pdf);
cpdf_set_font($pdf, 16, "Helvetica", "WinAnsiEncoding");
cpdf_text($pdf, 100, 100, "Some text");
cpdf_end_text($pdf)
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>cpdf_begin_text</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-show">
   <refnamediv>
    <refname>cpdf_show</refname>
    <refpurpose>Output text at current position</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_show</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>text</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_show</function> function outputs the
     string in <parameter>text</parameter> at the current position.
    </para>
    <para>
     See also <function>cpdf_text</function>,
              <function>cpdf_begin_text</function>,
              <function>cpdf_end_text</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-show-xy">
   <refnamediv>
    <refname>cpdf_show_xy</refname>
    <refpurpose>Output text at position</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_show_xy</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>text</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
      <paramdef>int <parameter><optional>mode</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_show_xy</function> function outputs the
     string <parameter>text</parameter> at position with coordinates
     (<parameter>x-coor</parameter>, <parameter>y-coor</parameter>).
    </para>
    <para>
     The optional parameter <parameter>mode</parameter> determines the unit
     length. If it's 0 or omitted the default unit as specified for the page is
     used. Otherwise the coordinates are measured in postscript points
     disregarding the current unit.
     <note>
      <simpara>
       The function <function>cpdf_show_xy</function> is identical to
       <function>cpdf_text</function> without the optional parameters.
      </simpara>
     </note>
    </para>
    <para>
     See also <function>cpdf_text</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-text">
   <refnamediv>
    <refname>cpdf_text</refname>
    <refpurpose>Output text with parameters</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_text</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>text</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
      <paramdef>int <parameter><optional>mode</optional></parameter></paramdef>
      <paramdef>
       double <parameter><optional>orientation</optional></parameter>
      </paramdef>
      <paramdef>
       int <parameter><optional>alignmode</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_text</function> function outputs the string
     <parameter>text</parameter> at position with coordinates
     (<parameter>x-coor</parameter>, <parameter>y-coor</parameter>).
    </para>
    <para>
     The optional parameter <parameter>mode</parameter> determines the
     unit length. If it's 0 or omitted the default unit as specified
     for the page is used. Otherwise the coordinates are measured in
     postscript points disregarding the current unit. The optional
     parameter <parameter>orientation</parameter> is the rotation of
     the text in degree. The optional parameter
     <parameter>alignmode</parameter> determines how the text is
     aligned.
    </para>
    <para>
     See the ClibPDF documentation for possible values.
    </para>
    <para>
     See also <function>cpdf_show_xy</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-set-font">
   <refnamediv>
    <refname>cpdf_set_font</refname>
    <refpurpose>Select the current font face and size</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_set_font</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>font name</parameter></paramdef>
      <paramdef>double <parameter>size</parameter></paramdef>
      <paramdef>string <parameter>encoding</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_set_font</function> function sets the
     current font face, font size and encoding. Currently only
     the standard postscript fonts are supported.
    </para>
    <para>
     The last parameter <parameter>encoding</parameter> can take the
     following values: "MacRomanEncoding", "MacExpertEncoding",
     "WinAnsiEncoding", and "NULL". "NULL" stands for the font's
     built-in encoding.
    </para>
    <para>
     See the ClibPDF Manual for more information, especially how to support
     asian fonts.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-set-leading">
   <refnamediv>
    <refname>cpdf_set_leading</refname>
    <refpurpose>Sets distance between text lines</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_set leading</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>distance</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_set_leading</function> function sets the distance
     between text lines. This will be used if text is output by
     <function>cpdf_continue_text</function>.
    </para>
    <para>
     See also <function>cpdf_continue_text</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-set-text-rendering">
   <refnamediv>
    <refname>cpdf_set_text_rendering</refname>
    <refpurpose>Determines how text is rendered</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_set_text_rendering</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_set_text_rendering</function> function
     determines how text is rendered.
    </para>
    <para>
     The possible values for <parameter>mode</parameter> are 0=fill
     text, 1=stroke text, 2=fill and stroke text, 3=invisible, 4=fill
     text and add it to clipping path, 5=stroke text and add it to
     clipping path, 6=fill and stroke text and add it to clipping
     path, 7=add it to clipping path.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-set-horiz-scaling">
   <refnamediv>
    <refname>cpdf_set_horiz_scaling</refname>
    <refpurpose>Sets horizontal scaling of text</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_set_horiz_scaling</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>scale</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_set_horiz_scaling</function> function sets the
     horizontal scaling to <parameter>scale</parameter> percent.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-set-text-rise">
   <refnamediv>
    <refname>cpdf_set_text_rise</refname>
    <refpurpose>Sets the text rise</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_set_text_rise</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_set_text_rise</function> function sets the
     text rising to <parameter>value</parameter> units.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-set-text-matrix">
   <refnamediv>
    <refname>cpdf_set_text_matrix</refname>
    <refpurpose>Sets the text matrix</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_set_text_matrix</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>array <parameter>matrix</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_set_text_matrix</function> function sets
     a matrix which describes a transformation applied on the current
     text font.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-set-text-pos">
   <refnamediv>
    <refname>cpdf_set_text_pos</refname>
    <refpurpose>Sets text position</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_set_text_pos</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
      <paramdef>int <parameter><optional>mode</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_set_text_pos</function> function sets the
     position of text for the next <function>cpdf_show</function> 
     function call.
    </para>
    <para>
     The optional parameter <parameter>mode</parameter> determines the unit
     length. If it's 0 or omitted the default unit as specified for the page is
     used. Otherwise the coordinates are measured in postscript points
     disregarding the current unit.
    </para>
    <para>
     See also <function>cpdf_show</function>,
              <function>cpdf_text</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-set-char-spacing">
   <refnamediv>
    <refname>cpdf_set_char_spacing</refname>
    <refpurpose>Sets character spacing</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_set_char_spacing</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>space</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_set_char_spacing</function> function sets the
     spacing between characters.
    </para>
    <para>
     See also <function>cpdf_set_word_spacing</function>,
              <function>cpdf_set_leading</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-set-word-spacing">
   <refnamediv>
    <refname>cpdf_set_word_spacing</refname>
    <refpurpose>Sets spacing between words</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_set_word_spacing</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>space</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_set_word_spacing</function> function sets the
     spacing between words.
    </para>
    <para>
     See also <function>cpdf_set_char_spacing</function>,
              <function>cpdf_set_leading</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-continue-text">
   <refnamediv>
    <refname>cpdf_continue_text</refname>
    <refpurpose>Output text in next line</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_continue_text</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>text</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_continue_text</function> function outputs the
     string in <parameter>text</parameter> in the next line.
    </para>
    <para>
     See also <function>cpdf_show_xy</function>,
              <function>cpdf_text</function>,
              <function>cpdf_set_leading</function>,
              <function>cpdf_set_text_pos</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-stringwidth">
   <refnamediv>
    <refname>cpdf_stringwidth</refname>
    <refpurpose>Returns width of text in current font</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>double <function>cpdf_stringwidth</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>text</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_stringwidth</function> function returns the
     width of the string in <parameter>text</parameter>. It requires
     a font to be set before.
    </para>
    <para>
     See also <function>cpdf_set_font</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-save">
   <refnamediv>
    <refname>cpdf_save</refname>
    <refpurpose>Saves current enviroment</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_save</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_save</function> function saves the current
     enviroment. It works like the postscript command gsave. Very
     useful if you want to translate or rotate an object without effecting
     other objects.
    </para>
    <para>
     See also <function>cpdf_restore</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-restore">
   <refnamediv>
    <refname>cpdf_restore</refname>
    <refpurpose>Restores formerly saved enviroment</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_restore</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_restore</function> function restores the
     enviroment saved with <function>cpdf_save</function>. It works
     like the postscript command grestore. Very useful if you want
     to translate or rotate an object without effecting other objects.
     <example>
      <title>Save/Restore</title>
      <programlisting>
&lt;?php
cpdf_save($pdf);
// do all kinds of rotations, transformations, ...
cpdf_restore($pdf)
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>cpdf_save</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-translate">
   <refnamediv>
    <refname>cpdf_translate</refname>
    <refpurpose>Sets origin of coordinate system</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_translate</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
      <paramdef>int <parameter><optional>mode</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_translate</function> function set the origin of
     coordinate system to the point (<parameter>x-coor</parameter>,
     <parameter>y-coor</parameter>).
    </para>
    <para>
     The optional parameter <parameter>mode</parameter> determines the unit
     length. If it's 0 or omitted the default unit as specified for the page
     is used. Otherwise the coordinates are measured in postscript points
     disregarding the current unit.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-scale">
   <refnamediv>
    <refname>cpdf_scale</refname>
    <refpurpose>Sets scaling</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_scale</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>x-scale</parameter></paramdef>
      <paramdef>double <parameter>y-scale</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_scale</function> function set the scaling factor
     in both directions.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-rotate">
   <refnamediv>
    <refname>cpdf_rotate</refname>
    <refpurpose>Sets rotation</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_rotate</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>angle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_rotate</function> function set the rotation in
     degress to <parameter>angle</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-setflat">
   <refnamediv>
    <refname>cpdf_setflat</refname>
    <refpurpose>Sets flatness</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_setflat</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_setflat</function> function set the flatness to
     a value between 0 and 100.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-setlinejoin">
   <refnamediv>
    <refname>cpdf_setlinejoin</refname>
    <refpurpose>Sets linejoin parameter</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_setlinejoin</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>long <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_setlinejoin</function> function set the
     linejoin parameter between a value of 0 and 2. 0 = miter, 1 =
     round, 2 = bevel.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-setlinecap">
   <refnamediv>
    <refname>cpdf_setlinecap</refname>
    <refpurpose>Sets linecap parameter</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_setlinecap</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>int <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_setlinecap</function> function set the linecap
     parameter between a value of 0 and 2. 0 = butt end, 1 = round,
     2 = projecting square.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-setmiterlimit">
   <refnamediv>
    <refname>cpdf_setmiterlimit</refname>
    <refpurpose>Sets miter limit</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_setmiterlimit</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_setmiterlimit</function> function set the
     miter limit to a value greater or equal than 1.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-setlinewidth">
   <refnamediv>
    <refname>cpdf_setlinewidth</refname>
    <refpurpose>Sets line width</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_setlinewidth</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>width</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_setlinewidth</function> function set the line
     width to <parameter>width</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-setdash">
   <refnamediv>
    <refname>cpdf_setdash</refname>
    <refpurpose>Sets dash pattern</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_setdash</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>white</parameter></paramdef>
      <paramdef>double <parameter>black</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_setdash</function> function set the dash
     pattern <parameter>white</parameter> white units and
     <parameter>black</parameter> black units. If both are 0 a solid
     line is set.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.cpdf-newpath">
   <refnamediv>
    <refname>cpdf_newpath</refname>
    <refpurpose>Starts a new path</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>cpdf_newpath</function>
      </funcdef>
      <paramdef>int 
       <parameter>pdf_document</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_newpath</function> starts a new path on the
     document given by the <parameter>pdf_document</parameter>
     parameter.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.cpdf-moveto">
   <refnamediv>
    <refname>cpdf_moveto</refname>
    <refpurpose>Sets current point</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_moveto</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
      <paramdef>int
       <parameter><optional>mode</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_moveto</function> function set the current
     point to the coordinates <parameter>x-coor</parameter> and
     <parameter>y-coor</parameter>.
    </para>
    <para>
     The optional parameter <parameter>mode</parameter> determines the
     unit length. If it's 0 or omitted the default unit as specified
     for the page is used. Otherwise the coordinates are measured in
     postscript points disregarding the current unit.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-rmoveto">
   <refnamediv>
    <refname>cpdf_rmoveto</refname>
    <refpurpose>Sets current point</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_rmoveto</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
      <paramdef>int <parameter><optional>mode</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_rmoveto</function> function set the current point
     relative to the coordinates <parameter>x-coor</parameter> and
     <parameter>y-coor</parameter>.
    </para>
    <para>
     The optional parameter <parameter>mode</parameter> determines the unit
     length. If it's 0 or omitted the default unit as specified for the page is
     used. Otherwise the coordinates are measured in postscript points
     disregarding the current unit.
    </para>
    <para>
     See also <function>cpdf_moveto</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-curveto">
   <refnamediv>
    <refname>cpdf_curveto</refname>
    <refpurpose>Draws a curve</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_curveto</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>x1</parameter></paramdef>
      <paramdef>double <parameter>y1</parameter></paramdef>
      <paramdef>double <parameter>x2</parameter></paramdef>
      <paramdef>double <parameter>y2</parameter></paramdef>
      <paramdef>double <parameter>x3</parameter></paramdef>
      <paramdef>double <parameter>y3</parameter></paramdef>
      <paramdef>int <parameter><optional>mode</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_curveto</function> function draws a Bezier curve
     from the current point to the point
     (<parameter>x3</parameter>, <parameter>y3</parameter>) using
     (<parameter>x1</parameter>, <parameter>y1</parameter>) and
     (<parameter>x2</parameter>, <parameter>y2</parameter>) as control
     points.
    </para>
    <para>
     The optional parameter <parameter>mode</parameter> determines the unit
     length. If it's 0 or omitted the default unit as specified for the page is
     used. Otherwise the coordinates are measured in postscript points
     disregarding the current unit.
    </para>
    <para>
     See also <function>cpdf_moveto</function>,
              <function>cpdf_rmoveto</function>,
              <function>cpdf_rlineto</function>,
              <function>cpdf_lineto</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-lineto">
   <refnamediv>
    <refname>cpdf_lineto</refname>
    <refpurpose>Draws a line</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_lineto</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
      <paramdef>int <parameter><optional>mode</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_lineto</function> function draws a line from
     the current point to the point with coordinates
     (<parameter>x-coor</parameter>, <parameter>y-coor</parameter>).
    </para>
    <para>
     The optional parameter <parameter>mode</parameter> determines the unit
     length. If it's 0 or omitted the default unit as specified for the page
     is used. Otherwise the coordinates are measured in postscript points
     disregarding the current unit.
    </para>
    <para>
     See also <function>cpdf_moveto</function>,
              <function>cpdf_rmoveto</function>,
              <function>cpdf_curveto</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-rlineto">
   <refnamediv>
    <refname>cpdf_rlineto</refname>
    <refpurpose>Draws a line</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_rlineto</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
      <paramdef>int <parameter><optional>mode</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_rlineto</function> function draws a line from
     the current point to the relative point with coordinates
     (<parameter>x-coor</parameter>, <parameter>y-coor</parameter>).
    </para>
    <para>
     The optional parameter <parameter>mode</parameter> determines the unit
     length. If it's 0 or omitted the default unit as specified for the page
     is used. Otherwise the coordinates are measured in postscript points
     disregarding the current unit.
    </para>
    <para>
     See also <function>cpdf_moveto</function>,
              <function>cpdf_rmoveto</function>,
              <function>cpdf_curveto</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-circle">
   <refnamediv>
    <refname>cpdf_circle</refname>
    <refpurpose>Draw a circle</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_circle</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
      <paramdef>double <parameter>radius</parameter></paramdef>
      <paramdef>int <parameter><optional>mode</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_circle</function> function draws a circle with
     center at point 
     (<parameter>x-coor</parameter>, <parameter>y-coor</parameter>)
     and radius <parameter>radius</parameter>.
    </para>
    <para>
     The optional parameter <parameter>mode</parameter> determines the unit
     length. If it's 0 or omitted the default unit as specified for the page
     is used. Otherwise the coordinates are measured in postscript points
     disregarding the current unit.
    </para>
    <para>
     See also <function>cpdf_arc</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-arc">
   <refnamediv>
    <refname>cpdf_arc</refname>
    <refpurpose>Draws an arc</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_arc</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
      <paramdef>double <parameter>radius</parameter></paramdef>
      <paramdef>double <parameter>start</parameter></paramdef>
      <paramdef>double <parameter>end</parameter></paramdef>
      <paramdef>int <parameter><optional>mode</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_arc</function> function draws an arc with
     center at point 
     (<parameter>x-coor</parameter>, <parameter>y-coor</parameter>)
     and radius <parameter>radius</parameter>, starting at angle
     <parameter>start</parameter> and ending at angle
     <parameter>end</parameter>.
    </para>
    <para>
     The optional parameter <parameter>mode</parameter> determines the unit
     length. If it's 0 or omitted the default unit as specified for the page
     is used. Otherwise the coordinates are measured in postscript points
     disregarding the current unit.
    </para>
    <para>
     See also <function>cpdf_circle</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-rect">
   <refnamediv>
    <refname>cpdf_rect</refname>
    <refpurpose>Draw a rectangle</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_rect</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
      <paramdef>double <parameter>width</parameter></paramdef>
      <paramdef>double <parameter>height</parameter></paramdef>
      <paramdef>int <parameter><optional>mode</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_rect</function> function draws a rectangle with
     its lower left corner at point 
     (<parameter>x-coor</parameter>, <parameter>y-coor</parameter>).
     This width is set to <parameter>widgth</parameter>.
     This height is set to <parameter>height</parameter>.
    </para>
    <para>
     The optional parameter <parameter>mode</parameter> determines the unit
     length. If it's 0 or omitted the default unit as specified for the page
     is used. Otherwise the coordinates are measured in postscript points
     disregarding the current unit.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-closepath">
   <refnamediv>
    <refname>cpdf_closepath</refname>
    <refpurpose>Close path</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_closepath</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_closepath</function> function closes the
     current path.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-stroke">
   <refnamediv>
    <refname>cpdf_stroke</refname>
    <refpurpose>Draw line along path</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_stroke</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_stroke</function> function draws a line along
     current path.
    </para>
    <para>
     See also <function>cpdf_closepath</function>,
              <function>cpdf_closepath_stroke</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-closepath-stroke">
   <refnamediv>
    <refname>cpdf_closepath_stroke</refname>
    <refpurpose>Close path and draw line along path</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_closepath_stroke</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_closepath_stroke</function> function is a
     combination of <function>cpdf_closepath</function> and
     <function>cpdf_stroke</function>. Than clears the path.
    </para>
    <para>
     See also <function>cpdf_closepath</function>,
              <function>cpdf_stroke</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-fill">
   <refnamediv>
    <refname>cpdf_fill</refname>
    <refpurpose>Fill current path</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_fill</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_fill</function> function fills the interior of
     the current path with the current fill color.
    </para>
    <para>
     See also <function>cpdf_closepath</function>,
              <function>cpdf_stroke</function>,
              <function>cpdf_setgray_fill</function>,
              <function>cpdf_setgray</function>,
              <function>cpdf_setrgbcolor_fill</function>,
              <function>cpdf_setrgbcolor</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-fill-stroke">
   <refnamediv>
    <refname>cpdf_fill_stroke</refname>
    <refpurpose>Fill and stroke current path</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_fill_stroke</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_fill_stroke</function> function fills the interior of
     the current path with the current fill color and draws current path.
    </para>
    <para>
     See also <function>cpdf_closepath</function>,
              <function>cpdf_stroke</function>,
              <function>cpdf_fill</function>,
              <function>cpdf_setgray_fill</function>,
              <function>cpdf_setgray</function>,
              <function>cpdf_setrgbcolor_fill</function>,
              <function>cpdf_setrgbcolor</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-closepath-fill-stroke">
   <refnamediv>
    <refname>cpdf_closepath_fill_stroke</refname>
    <refpurpose>Close, fill and stroke current path</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_closepath_fill_stroke</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_closepath_fill_stroke</function> function closes,
     fills the interior of the current path with the current fill color and
     draws current path.
    </para>
    <para>
     See also <function>cpdf_closepath</function>,
              <function>cpdf_stroke</function>,
              <function>cpdf_fill</function>,
              <function>cpdf_setgray_fill</function>,
              <function>cpdf_setgray</function>,
              <function>cpdf_setrgbcolor_fill</function>,
              <function>cpdf_setrgbcolor</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-clip">
   <refnamediv>
    <refname>cpdf_clip</refname>
    <refpurpose>Clips to current path</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_clip</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_clip</function> function clips all drawing
     to the current path.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.cpdf-setgray-fill">
   <refnamediv>
    <refname>cpdf_setgray_fill</refname>
    <refpurpose>Sets filling color to gray value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_setgray_fill</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_setgray_fill</function> function sets the current
     gray value to fill a path.
    </para>
    <para>
     See also <function>cpdf_setrgbcolor_fill</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.cpdf-setgray-stroke">
   <refnamediv>
    <refname>cpdf_setgray_stroke</refname>
    <refpurpose>Sets drawing color to gray value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_setgray_stroke</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>gray value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_setgray_stroke</function> function sets the current
     drawing color to the given gray value.
    </para>
    <para>
     See also <function>cpdf_setrgbcolor_stroke</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.cpdf-setgray">
   <refnamediv>
    <refname>cpdf_setgray</refname>
    <refpurpose>Sets drawing and filling color to gray value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_setgray</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>gray value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_setgray_stroke</function> function sets the current
     drawing and filling color to the given gray value.
    </para>
    <para>
     See also <function>cpdf_setrgbcolor_stroke</function>,
              <function>cpdf_setrgbcolor_fill</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.cpdf-setrgbcolor-fill">
   <refnamediv>
    <refname>cpdf_setrgbcolor_fill</refname>
    <refpurpose>Sets filling color to rgb color value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_setrgbcolor_fill</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>red value</parameter></paramdef>
      <paramdef>double <parameter>green value</parameter></paramdef>
      <paramdef>double <parameter>blue value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_setrgbcolor_fill</function> function sets the current
     rgb color value to fill a path.
    </para>
    <para>
     See also <function>cpdf_setrgbcolor_stroke</function>,
              <function>cpdf_setrgbcolor</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.cpdf-setrgbcolor-stroke">
   <refnamediv>
    <refname>cpdf_setrgbcolor_stroke</refname>
    <refpurpose>Sets drawing color to rgb color value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_setrgbcolor_stroke</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>red value</parameter></paramdef>
      <paramdef>double <parameter>green value</parameter></paramdef>
      <paramdef>double <parameter>blue value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_setrgbcolor_stroke</function> function sets the current
     drawing color to the given rgb color value.
    </para>
    <para>
     See also <function>cpdf_setrgbcolor_fill</function>,
              <function>cpdf_setrgbcolor</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.cpdf-setrgbcolor">
   <refnamediv>
    <refname>cpdf_setrgbcolor</refname>
    <refpurpose>Sets drawing and filling color to rgb color value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_setrgbcolor</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>red value</parameter></paramdef>
      <paramdef>double <parameter>green value</parameter></paramdef>
      <paramdef>double <parameter>blue value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_setrgbcolor_stroke</function> function sets the current
     drawing and filling color to the given rgb color value.
    </para>
    <para>
     See also <function>cpdf_setrgbcolor_stroke</function>,
              <function>cpdf_setrgbcolor_fill</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.cpdf-add-outline">
   <refnamediv>
    <refname>cpdf_add_outline</refname>
    <refpurpose>Adds bookmark for current page</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_add_outline</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>text</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_add_outline</function> function adds a bookmark
     with text <parameter>text</parameter> that points to the current page.
     <example>
      <title>Adding a page outline</title>
      <programlisting>
&lt;?php
$cpdf = cpdf_open(0);
cpdf_page_init($cpdf, 1, 0, 595, 842);
cpdf_add_outline($cpdf, 0, 0, 0, 1, "Page 1");
// ...
// some drawing
// ...
cpdf_finalize($cpdf);
Header("Content-type: application/pdf");
cpdf_output_buffer($cpdf);
cpdf_close($cpdf);
?&gt;
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-set-page-animation">
   <refnamediv>
    <refname>cpdf_set_page_animation</refname>
    <refpurpose>Sets duration between pages</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_set_page_animation</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>int <parameter>transition</parameter></paramdef>
      <paramdef>double <parameter>duration</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_set_page_animation</function> function set the
     transition between following pages.
    </para>
    <para>
     The value of <parameter>transition</parameter>
     can be
     <simplelist>
      <member>0 for none,</member>
      <member>
       1 for two lines sweeping across the screen reveal the page,
      </member>
      <member>
       2 for multiple lines sweeping across the screen reveal the page,
      </member>
      <member>3 for a box reveals the page,</member>
      <member>
       4 for a single line sweeping across the screen reveals the page,
      </member>
      <member>5 for the old page dissolves to reveal the page,</member>
      <member>
       6 for the dissolve effect moves from one screen edge to another,
      </member>
      <member>
       7 for the old page is simply replaced by the new page (default)
      </member>
     </simplelist>
    </para>
    <para>
     The value of <parameter>duration</parameter> is the number of seconds
     between page flipping.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-import-jpeg">
   <refnamediv>
    <refname>cpdf_import_jpeg</refname>
    <refpurpose>Opens a JPEG image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>cpdf_import_jpeg</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>file name</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
      <paramdef>double <parameter>angle</parameter></paramdef>
      <paramdef>double <parameter>width</parameter></paramdef>
      <paramdef>double <parameter>height</parameter></paramdef>
      <paramdef>double <parameter>x-scale</parameter></paramdef>
      <paramdef>double <parameter>y-scale</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>mode</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_import_jpeg</function> function opens an image
     stored in the file with the name <parameter>file
     name</parameter>.  The format of the image has to be jpeg. The
     image is placed on the current page at position
     (<parameter>x-coor</parameter>, <parameter>y-coor</parameter>).
     The image is rotated by <parameter>angle</parameter> degres.
    </para>
    <para>
     The optional parameter <parameter>mode</parameter> determines the
     unit length. If it's 0 or omitted the default unit as specified
     for the page is used. Otherwise the coordinates are measured in
     postscript points disregarding the current unit.
    </para>
    <para>
     See also <function>cpdf_place_inline_image</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-place-inline-image">
   <refnamediv>
    <refname>cpdf_place_inline_image</refname>
    <refpurpose>Places an image on the page</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_place_inline_image</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>int <parameter>image</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
      <paramdef>double <parameter>angle</parameter></paramdef>
      <paramdef>double <parameter>width</parameter></paramdef>
      <paramdef>double <parameter>height</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>mode</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_place_inline_image</function> function places
     an image created with the php image functions on the page at
     postion (<parameter>x-coor</parameter>,
     <parameter>y-coor</parameter>). The image can be scaled at the
     same time.
    </para>
    <para>
     The optional parameter <parameter>mode</parameter> determines the
     unit length. If it's 0 or omitted the default unit as specified
     for the page is used. Otherwise the coordinates are measured in
     postscript points disregarding the current unit.
    </para>
    <para>
     See also <function>cpdf_import_jpeg</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cpdf-add-annotation">
   <refnamediv>
    <refname>cpdf_add_annotation</refname>
    <refpurpose>Adds annotation</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>cpdf_add_annotation</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>llx</parameter></paramdef>
      <paramdef>double <parameter>lly</parameter></paramdef>
      <paramdef>double <parameter>urx</parameter></paramdef>
      <paramdef>double <parameter>ury</parameter></paramdef>
      <paramdef>string <parameter>title</parameter></paramdef>
      <paramdef>string <parameter>content</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>mode</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>cpdf_add_annotation</function> adds a note with the
     lower left corner at (<parameter>llx</parameter>,
     <parameter>lly</parameter>) and the upper right corner at
     (<parameter>urx</parameter>, <parameter>ury</parameter>).
    </para>
    <para>
     The optional parameter <parameter>mode</parameter> determines the
     unit length. If it's 0 or omitted the default unit as specified
     for the page is used. Otherwise the coordinates are measured in
     postscript points disregarding the current unit.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/curl.xml
+++ phpdoc/kr/functions/curl.xml
 <reference id="ref.curl">
  <title>CURL, Client URL Library Functions</title>
  <titleabbrev>CURL</titleabbrev>

  <partintro id="curl.partintro">
   <para>
    PHP supports libcurl, a library, created by Daniel Stenberg, that
    allows you to connect and communicate to many different types of
    servers with many different types of protocols.  libcurl currently
    supports the http, https, ftp, gopher, telnet, dict, file, and
    ldap protocols.  libcurl also supports HTTPS certificates, HTTP
    POST, HTTP PUT, FTP uploading (this can also be done with PHP's
    ftp extension), HTTP form based upload, proxies, cookies and
    user+password authentication.
   </para>
   <para>
    In order to use the CURL functions you need to install the <ulink
    url="&url.curl;">CURL</ulink> package. PHP requires that you use
    CURL 7.0.2-beta or higher. PHP will not work with any version of
    CURL below version 7.0.2-beta.
   </para>
   <para>
    To use PHP's CURL support you must also compile PHP <option
    role="configure">--with-curl[=DIR]</option> where DIR is the
    location of the directory containing the lib and include
    directories.  In the "include" directory there should be a folder
    named "curl" which should contain the easy.h and curl.h files.
    There should be a file named "libcurl.a" located in the "lib"
    directory.
   </para>
   <para>
    These functions have been added in PHP 4.0.2. 
   </para>
   <para>
    Once you've compiled PHP with CURL support, you can begin using
    the curl functions.  The basic idea behind the CURL functions is
    that you initialize a CURL session using the
    <function>curl_init</function>, then you can set all your
    options for the transfer via the <function>curl_exec</function>
    and then you finish off your session using the
    <function>curl_close</function>.  Here is an example that uses
    the CURL functions to fetch the PHP homepage into a file:
    <example>
     <title>Using PHP's CURL module to fetch the PHP homepage</title>
     <programlisting role="php">
&lt;?php

$ch = curl_init ("http://www.php.net/");
$fp = fopen ("php_homepage.txt", "w");

curl_setopt ($ch, CURLOPT_FILE, $fp);
curl_setopt ($ch, CURLOPT_HEADER, 0);

curl_exec ($ch);
curl_close ($ch);
fclose ($fp);
?>
     </programlisting>
    </example>
   </para>
  </partintro>

  <refentry id="function.curl-init">
   <refnamediv>
    <refname>curl_init</refname>
    <refpurpose>Initialize a CURL session</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>curl_init</function>
      </funcdef>
      <paramdef>string 
       <parameter>
        <optional>url</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>curl_init</function> will initialize a new session
     and return a CURL handle for use with the
     <function>curl_setopt</function>, <function>curl_exec</function>,
     and <function>curl_close</function> functions.  If the optional
     <parameter>url</parameter> parameter is supplied then the
     CURLOPT_URL option will be set to the value of the parameter.
     You can manually set this using the
     <function>curl_setopt</function> function.
     <example>
      <title>
       Initializing a new CURL session and fetching a webpage
      </title>
      <programlisting role="php">
&lt;?php
$ch = curl_init();

curl_setopt ($ch, CURLOPT_URL, "http://www.zend.com/");
curl_setopt ($ch, CURLOPT_HEADER, 0);

curl_exec ($ch);

curl_close ($ch);
?>
      </programlisting>
     </example>
    </para>
    <para>
     See also: <function>curl_close</function>,
     <function>curl_setopt</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.curl-setopt">
   <refnamediv>
    <refname>curl_setopt</refname>
    <refpurpose>Set an option for a CURL transfer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool 
       <function>curl_setopt</function>
      </funcdef>
      <paramdef>int 
       <parameter>ch</parameter>
      </paramdef>
      <paramdef>string 
       <parameter>option</parameter>
      </paramdef>
      <paramdef>mixed 
       <parameter>value</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>curl_setopt</function> function will set options
     for a CURL session identified by the <parameter>ch</parameter>
     parameter.  The <parameter>option</parameter> parameter is the
     option you want to set, and the <parameter>value</parameter> is
     the value of the option given by the
     <parameter>option</parameter>.
    </para>
    <para>
     The <parameter>value</parameter> should be a long for the
     following options (specified in the <parameter>option</parameter>
     parameter):
     <itemizedlist>
      <listitem>
       <simpara>
        <parameter>CURLOPT_INFILESIZE</parameter>: When you are
        uploading a file to a remote site, this option should be used
        to tell PHP what the expected size of the infile will be.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_VERBOSE</parameter>: Set this option to a
        non-zero value if you want CURL to report everything that is
        happening.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_HEADER</parameter>: Set this option to a
        non-zero value if you want the header to be included in the
        output.
       </simpara>
      </listitem>
      <listitem>
       <para>
        <parameter>CURLOPT_NOPROGRESS</parameter>: Set this option to
        a non-zero value if you don't want PHP to display a progress
        meter for CURL transfers
        <note>
         <simpara>
          PHP automatically sets this option to a non-zero parameter,
          this should only be changed for debugging purposes.
         </simpara>
        </note>
       </para>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_NOBODY</parameter>: Set this option to a
        non-zero value if you don't want the body included with the
        output.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_FAILONERROR</parameter>: Set this option to
        a non-zero value if you want PHP to fail silently if the HTTP
        code returned is greater than 300.  The default behaviour is
        to return the page normally, ignoring the code.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_UPLOAD</parameter>: Set this option to a
        non-zero value if you want PHP to prepare for an upload.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_POST</parameter>: Set this option to a
        non-zero value if you want PHP to do a regular HTTP POST.
        This POST is a normal application/x-www-from-urlencoded kind,
        most commonly used by HTML forms.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_FTPLISTONLY</parameter>: Set this option to
        a non-zero value and PHP will just list the names of an FTP
        directory.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_FTPAPPEND</parameter>: Set this option to a
        non-zero value and PHP will append to the remote file instead
        of overwriting it.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_NETRC</parameter>: Set this option to a
        non-zero value and PHP will scan your ~./netrc file to find
        your username and password for the remote site that you're
        establishing a connection with.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_FOLLOWLOCATION</parameter>: Set this option
        to a non-zero value to follow any "Location: " header that the
        server sends as a part of the HTTP header (note this is
        recursive, PHP will follow as many "Location: " headers that
        it is sent.)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_PUT</parameter>: Set this option a non-zero
        value to HTTP PUT a file.  The file to PUT must be set with
        the CURLOPT_INFILE and CURLOPT_INFILESIZE.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_MUTE</parameter>: Set this option to a
        non-zero value and PHP will be completely silent with regards
        to the CURL functions.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_TIMEOUT</parameter>: Pass a long as a
        parameter that contains the maximum time, in seconds, that
        you'll allow the curl functions to take.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_LOW_SPEED_LIMIT</parameter>: Pass a long as
        a parameter that contains the transfer speed in bytes per
        second that the transfer should be below during
        CURLOPT_LOW_SPEED_TIME seconds for PHP to consider it too slow
        and abort.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_LOW_SPEED_TIME</parameter>: Pass a long as
        a parameter that contains the time in seconds that the
        transfer should be below the CURLOPT_LOW_SPEED_LIMIT for PHP
        to consider it too slow and abort.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_RESUME_FROM</parameter>: Pass a long as a
        parameter that contains the offset, in bytes, that you want
        the transfer to start from.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_SSLVERSION</parameter>: Pass a long as a
        parameter that contains the SSL version (2 or 3) to use.  By
        default PHP will try and determine this by itself, although,
        in some cases you must set this manually.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_TIMECONDITION</parameter>: Pass a long as a
        parameter that defines how the CURLOPT_TIMEVALUE is treated.
        You can set this parameter to TIMECOND_IFMODSINCE or
        TIMECOND_ISUNMODSINCE.  This is a HTTP-only feature.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_TIMEVALUE</parameter>: Pass a long as a
        parameter that is the time in seconds since January 1st, 1970.
        The time will be used as specified by the CURLOPT_TIMEVALUE
        option, or by default the TIMECOND_IFMODSINCE will be used.
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     The <parameter>value</parameter> parameter should be a string for
     the following values of the <parameter>option</parameter>
     parameter:
     <itemizedlist>
      <listitem>
       <simpara>
        <parameter>CURLOPT_URL</parameter>: This is the URL that you
        want PHP to fetch.  You can also set this option when
        initializing a session with the <function>curl_init</function>
        function.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_USERPWD</parameter>: Pass a string
        formatted in the [username]:[password] manner, for PHP to use
        for the connection.  connection.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_PROXYUSERPWD</parameter>: Pass a string
        formatted in the [username]:[password] format for connection
        to the HTTP proxy.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_RANGE</parameter>: Pass the specified range
        you want.  It should be in the "X-Y" format, where X or Y may
        be left out.  The HTTP transfers also support several
        intervals, seperated with commas as in X-Y,N-M.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_POSTFIELDS</parameter>: Pass a string
        containing the full data to post in an HTTP "POST" operation.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_REFERER</parameter>: Pass a string
        containing the "referer" header to be used in an HTTP request.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_USERAGENT</parameter>: Pass a string
        containing the "user-agent" header to be used in an HTTP
        request.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_FTPPORT</parameter>: Pass a string
        containing the which will be used to get the IP address to use
        for the ftp "POST" instruction.  The POST instruction tells
        the remote server to connect to our specified IP address.  The
        string may be a plain IP address, a hostname, a network
        interface name (under UNIX), or just a plain '-' to use the
        systems default IP address.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_COOKIE</parameter>: Pass a string
        containing the content of the cookie to be set in the HTTP
        header.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_SSLCERT</parameter>: Pass a string
        containing the filename of PEM formatted certificate.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_SSLCERTPASSWD</parameter>: Pass a string
        containing the password required to use the CURLOPT_SSLCERT
        certificate.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_COOKIEFILE</parameter>: Pass a string
        containing the name of the file containing the cookiee data.
        The cookie file can be in Netscape format, or just plain
        HTTP-style headers dumped into a file.
       </simpara>
      </listitem>
      <listitem>
       <para>
        <parameter>CURLOPT_CUSTOMREQUEST</parameter>: Pass a string to
        be used instead of GET or HEAD when doing an HTTP request.
        This is useful for doing DELETE or another, more obscure, HTTP
        request.
        <note>
         <simpara>
          Don't do this without making sure your server supports the
          command first.
         </simpara>
        </note>
       </para>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     The following options expect a file descriptor that is obtained
     by using the <function>fopen</function> function:
     <itemizedlist>
      <listitem>
       <simpara>
        <parameter>CURLOPT_FILE</parameter>: The file where the output
        of your transfer should be placed, the default is STDOUT.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_INFILE</parameter>: The file where the
        input of your transfer comes from.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_WRITEHEADER</parameter>: The file to write
        the header part of the output into.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>CURLOPT_STDERR</parameter>: The file to write
        errors to instead of stderr.
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.curl-exec">
   <refnamediv>
    <refname>curl_exec</refname>
    <refpurpose>Perform a CURL session</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool 
       <function>curl_exec</function>
      </funcdef>
      <paramdef>int 
       <parameter>ch</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function is should be called after you initialize a CURL
     session and all the options for the session are set.  Its purpose
     is simply to execute the predefined CURL session (given by the
     <parameter>ch</parameter>).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.curl-close">
   <refnamediv>
    <refname>curl_close</refname>
    <refpurpose>Close a CURL session</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>curl_close</function>
      </funcdef>
      <paramdef>int 
       <parameter>ch</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This functions closes a CURL session and frees all ressources.
     The CURL handle, <parameter>ch</parameter>, is also deleted.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.curl-version">
   <refnamediv>
    <refname>curl_version</refname>
    <refpurpose>Return the current CURL version</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string 
       <function>curl_version</function>
      </funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>curl_version</function> function returns a string
     containing the current CURL version.
    </para>
   </refsect1>
  </refentry>
 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/cybercash.xml
+++ phpdoc/kr/functions/cybercash.xml
 <reference id="ref.cybercash">
  <title>Cybercash payment functions</title>
  <titleabbrev>Cybercash</titleabbrev>

  <partintro>
   <simpara>
    These functions are only available if the interpreter has been
    compiled with the <option
    role="configure">--with-cybercash=[DIR]</option>. These functions
    have been added in PHP 4.
   </simpara>
  </partintro>

  <refentry id="function.cybercash-encr">
   <refnamediv>
    <refname>cybercash_encr</refname>
    <refpurpose>???</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>cybercash_encr</function></funcdef>
      <paramdef>string <parameter>wmk</parameter></paramdef>
      <paramdef>string <parameter>sk</parameter></paramdef>
      <paramdef>string <parameter>inbuff</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The function returns an associative array with the elements
     "errcode" and, if "errcode" is false, "outbuff" (string),
     "outLth" (long) and "macbuff" (string).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cybercash-decr">
   <refnamediv>
    <refname>cybercash_decr</refname>
    <refpurpose>???</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>cybercash_decr</function></funcdef>
      <paramdef>string <parameter>wmk</parameter></paramdef>
      <paramdef>string <parameter>sk</parameter></paramdef>
      <paramdef>string <parameter>inbuff</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The function returns an associative array with the elements
     "errcode" and, if "errcode" is false, "outbuff" (string),
     "outLth" (long) and "macbuff" (string).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cybercash-base64-encode">
   <refnamediv>
    <refname>cybercash_base64_encode</refname>
    <refpurpose>???</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string 
       <function>cybercash_base64_encode</function>
      </funcdef>
      <paramdef>string <parameter>inbuff</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.cybercash-base64-decode">
   <refnamediv>
    <refname>cybercash_base64_decode</refname>
    <refpurpose></refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string 
       <function>cybercash_base64_decode</function>
      </funcdef>
      <paramdef>string <parameter>inbuff</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/datetime.xml
+++ phpdoc/kr/functions/datetime.xml
 <reference id="ref.datetime">
  <title>Date and Time functions</title>
  <titleabbrev>Date/time</titleabbrev>

  <refentry id="function.checkdate">
   <refnamediv>
    <refname>checkdate</refname>
    <refpurpose>Validate a gregorian date/time</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>checkdate</function></funcdef>
      <paramdef>int <parameter>month</parameter></paramdef>
      <paramdef>int <parameter>day</parameter></paramdef>
      <paramdef>int <parameter>year</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true if the date given is valid; otherwise returns false.
     Checks the validity of the date formed by the arguments. A date
     is considered valid if:
     <itemizedlist>
      <listitem>
       <simpara>
        year is between 1 and 32767 inclusive
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        month is between 1 and 12 inclusive
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>Day</parameter> is within the allowed number of
        days for the given <parameter>month</parameter>.  Leap
        <parameter>year</parameter>s are taken into consideration.
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.date">
   <refnamediv>
    <refname>date</refname>
    <refpurpose>Format a local time/date</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>date</function></funcdef>
      <paramdef>string <parameter>format</parameter></paramdef>
      <paramdef>int 
       <parameter>
        <optional>timestamp</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string formatted according to the given format string
     using the given <parameter>timestamp</parameter> or the current
     local time if no timestamp is given.
    </para>
    <para>
     The following characters are recognized in the format string:
     <itemizedlist>
      <listitem>
       <simpara>
        a - "am" or "pm"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        A - "AM" or "PM"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        B - Swatch Internet time
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        d - day of the month, 2 digits with leading zeros; i.e. "01"
        to "31"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        D - day of the week, textual, 3 letters; i.e. "Fri"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        F - month, textual, long; i.e. "January"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        g - hour, 12-hour format without leading zeros; i.e. "1" to
        "12"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        G - hour, 24-hour format without leading zeros; i.e. "0" to
        "23"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        h - hour, 12-hour format; i.e. "01" to "12"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        H - hour, 24-hour format; i.e. "00" to "23"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        i - minutes; i.e. "00" to "59"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        I (capital i) - "1" if Daylight Savings Time, "0" otherwise.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        j - day of the month without leading zeros; i.e. "1" to "31"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        l (lowercase 'L') - day of the week, textual, long;
        i.e. "Friday"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        L - boolean for whether it is a leap year; i.e. "0" or "1"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        m - month; i.e. "01" to "12"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        M - month, textual, 3 letters; i.e. "Jan"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        n - month without leading zeros; i.e. "1" to "12"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        r - RFC 822 formatted date; i.e. "Thu, 21 Dec 2000 16:01:07 +0200"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        s - seconds; i.e. "00" to "59"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        S - English ordinal suffix, textual, 2 characters; i.e. "th",
        "nd"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        t - number of days in the given month; i.e. "28" to "31"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        T - Timezone setting of this machine; i.e. "MDT"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        U - seconds since the epoch
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        w - day of the week, numeric, i.e. "0" (Sunday) to "6"
        (Saturday)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        Y - year, 4 digits; i.e. "1999"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        y - year, 2 digits; i.e. "99"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        z - day of the year; i.e. "0" to "365"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        Z - timezone offset in seconds (i.e. "-43200" to "43200")
       </simpara>
      </listitem>
     </itemizedlist>
     Unrecognized characters in the format string will be printed
     as-is.  The "Z" format will always return "0" when using
     <function>gmdate</function>.
     <example>
      <title><function>Date</function> example</title>
      <programlisting role="php">
print (date ("l dS of F Y h:i:s A"));
print ("July 1, 2000 is on a " . date ("l", mktime(0,0,0,7,1,2000)));
      </programlisting>
     </example>
    </para>
    <para>
     It is possible to use <function>date</function> and
     <function>mktime</function> together to find dates in the future
     or the past.
     <example>
      <title>
       <function>Date</function> and <function>mktime</function>
       example
      </title>
      <programlisting>
$tomorrow  = mktime (0,0,0,date("m")  ,date("d")+1,date("Y"));
$lastmonth = mktime (0,0,0,date("m")-1,date("d"),  date("Y"));
$nextyear  = mktime (0,0,0,date("m"),  date("d"),  date("Y")+1);
      </programlisting>
     </example>
    </para>
    <para>
     To format dates in other languages, you should use the
     <function>setlocale</function> and <function>strftime</function>
     functions.
    </para>
    <para>
     See also <function>gmdate</function> and
     <function>mktime</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.getdate">
   <refnamediv>
    <refname>getdate</refname>
    <refpurpose>Get date/time information</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>getdate</function></funcdef>
      <paramdef>int
       <parameter><optional>timestamp</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an associative array containing the date information of
     the <parameter>timestamp</parameter>, or the current local time if
     no timestamp is given, as the following array
     elements:
     <itemizedlist>
      <listitem>
       <simpara>
        "seconds" - seconds
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "minutes" - minutes
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "hours" - hours
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "mday" - day of the month
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "wday" - day of the week, numeric
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "mon" - month, numeric
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "year" - year, numeric
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "yday" - day of the year, numeric; i.e. "299"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "weekday" - day of the week, textual, full; i.e. "Friday"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "month" - month, textual, full; i.e. "January"
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gettimeofday">
   <refnamediv>
    <refname>gettimeofday</refname>
    <refpurpose>Get current time</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>gettimeofday</function></funcdef>
      <paramdef>void</paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This is an interface to gettimeofday(2). It returns an
     associative array containing the data returned from the system
     call.
     <itemizedlist>
      <listitem>
       <simpara>
        "sec" - seconds
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "usec" - microseconds
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "minuteswest" - minutes west of Greenwich
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "dsttime" - type of dst correction
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmdate">
   <refnamediv>
    <refname>gmdate</refname>
    <refpurpose>Format a GMT/CUT date/time</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>gmdate</function></funcdef>
      <paramdef>string <parameter>format</parameter></paramdef>
      <paramdef>int
       <parameter><optional>timestamp</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Identical to the <function>date</function> function except that
     the time returned is Greenwich Mean Time (GMT). For example, when
     run in Finland (GMT +0200), the first line below prints "Jan 01
     1998 00:00:00", while the second prints "Dec 31 1997 22:00:00".
     <example>
      <title><function>Gmdate</function> example</title>
      <programlisting role="php">
echo date ("M d Y H:i:s", mktime (0,0,0,1,1,1998));
echo gmdate ("M d Y H:i:s", mktime (0,0,0,1,1,1998));
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>date</function>, <function>mktime</function>,
     and <function>gmmktime</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmmktime">
   <refnamediv>
    <refname>gmmktime</refname>
    <refpurpose>Get UNIX timestamp for a GMT date</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gmmktime</function></funcdef>
      <paramdef>int <parameter>hour</parameter></paramdef>
      <paramdef>int <parameter>minute</parameter></paramdef>
      <paramdef>int <parameter>second</parameter></paramdef>
      <paramdef>int <parameter>month</parameter></paramdef>
      <paramdef>int <parameter>day</parameter></paramdef>
      <paramdef>int <parameter>year</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>is_dst</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Identical to <function>mktime</function> except the passed
     parameters represents a GMT date.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmstrftime">
   <refnamediv>
    <refname>gmstrftime</refname>
    <refpurpose>
     Format a GMT/CUT time/date according to locale settings
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>gmstrftime</function></funcdef>
      <paramdef>string <parameter>format</parameter></paramdef>
      <paramdef>int
       <parameter><optional>timestamp</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Behaves the same as <function>strftime</function> except that the
     time returned is Greenwich Mean Time (GMT). For example, when run
     in Eastern Standard Time (GMT -0500), the first line below prints
     "Dec 31 1998 20:00:00", while the second prints "Jan 01 1999
     01:00:00".
     <example>
      <title><function>Gmstrftime</function> example</title>
      <programlisting role="php">
setlocale ('LC_TIME', 'en_US');
echo strftime ("%b %d %Y %H:%M:%S", mktime (20,0,0,12,31,98))."\n";
echo gmstrftime ("%b %d %Y %H:%M:%S", mktime (20,0,0,12,31,98))."\n";
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>strftime</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.localtime">
   <refnamediv>
    <refname>localtime</refname>
    <refpurpose>Get the local time</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>localtime</function></funcdef>
      <paramdef>int
       <parameter>
        <optional>timestamp</optional>
       </parameter>
      </paramdef>
      <paramdef>bool 
       <parameter>
        <optional>is_associative</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>localtime</function> function returns an array
     identical to that of the structure returned by the C function
     call.  The first argument to <function>localtime</function> is
     the timestamp, if this is not given the current time is used.
     The second argument to the <function>localtime</function> is the
     <parameter>is_associative</parameter>, if this is set to 0 or not
     supplied than the array is returned as a regular, numerically
     indexed array.  If the argument is set to 1 then
     <function>localtime</function> is an associative array containing
     all the different elements of the structure returned by the C
     function call to localtime.  The names of the different keys of
     the associative array are as follows:
     <itemizedlist>
      <listitem>
       <simpara>
        "tm_sec" - seconds
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "tm_min" - minutes
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "tm_hour" - hour
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "tm_mday" - day of the month
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "tm_mon" - month of the year
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "tm_year" - Year, not y2k compliant
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "tm_wday" - Day of the week
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "tm_yday" - Day of the year
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "tm_isdst" - Is daylight savings time in effect
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.microtime">
   <refnamediv>
    <refname>microtime</refname>
    <refpurpose>
     Return current UNIX timestamp with microseconds</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>microtime</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the string "msec sec" where sec is the current time
     measured in the number of seconds since the Unix Epoch (0:00:00
     January 1, 1970 GMT), and msec is the microseconds part. This
     function is only available on operating systems that support the
     gettimeofday() system call.
    </para>
    <para>
     See also <function>time</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mktime">
   <refnamediv>
    <refname>mktime</refname>
    <refpurpose>Get UNIX timestamp for a date</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mktime</function></funcdef>
      <paramdef>int <parameter>hour</parameter></paramdef>
      <paramdef>int <parameter>minute</parameter></paramdef>
      <paramdef>int <parameter>second</parameter></paramdef>
      <paramdef>int <parameter>month</parameter></paramdef>
      <paramdef>int <parameter>day</parameter></paramdef>
      <paramdef>int <parameter>year</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>is_dst</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <emphasis>Warning:</emphasis> Note the strange order of
     arguments, which differs from the order of arguments in a regular
     UNIX mktime() call and which does not lend itself well to leaving
     out parameters from right to left (see below). It is a common
     error to mix these values up in a script.
    </para>
    <para>
     Returns the Unix timestamp corresponding to the arguments
     given. This timestamp is a long integer containing the number of
     seconds between the Unix Epoch (January 1 1970) and the time
     specified.
    </para>
    <para>
     Arguments may be left out in order from right to left; any
     arguments thus omitted will be set to the current value according
     to the local date and time.
    </para>
    <para>
     <parameter>Is_dst</parameter> can be set to 1 if the time is
     during daylight savings time, 0 if it is not, or -1 (the default)
     if it is unknown whether the time is within daylight savings time
     or not.
    </para>
    <note>
     <para>
      <parameter>Is_dst</parameter> was added in 3.0.10.
     </para>
    </note>
    <para>
     <function>Mktime</function> is useful for doing date arithmetic
     and validation, as it will automatically calculate the correct
     value for out-of-range input. For example, each of the following
     lines produces the string "Jan-01-1998".
     <example>
      <title><function>Mktime</function> example</title>
      <programlisting>
echo date ("M-d-Y", mktime (0,0,0,12,32,1997));
echo date ("M-d-Y", mktime (0,0,0,13,1,1997));
echo date ("M-d-Y", mktime (0,0,0,1,1,1998));
echo date ("M-d-Y", mktime (0,0,0,1,1,98));
      </programlisting>
     </example>
     <parameter>Year</parameter> may be a two or four digit value,
     with values between 0-69 mapping to 2000-2069 and 70-99 to
     1970-1999 (on systems where time_t is a 32bit signed integer, as
     most common today, the valid range for
     <parameter>year</parameter> is somewhere between 1902 and 2037).
    </para>
    <para>
     The last day of any given month can be expressed as the "0" day
     of the next month, not the -1 day. Both of the following examples
     will produce the string "The last day in Feb 2000 is: 29".
     <example>
      <title>Last day of next month</title>
      <programlisting role="php">
$lastday = mktime (0,0,0,3,0,2000);
echo strftime ("Last day in Feb 2000 is: %d", $lastday);
     
$lastday = mktime (0,0,0,4,-31,2000);
echo strftime ("Last day in Feb 2000 is: %d", $lastday);
      </programlisting>
     </example>
    </para>
    <simpara>
    Date with year, month and day equal to zero is considered illegal 
    (otherwise it what be regarded as 30.11.1999, which would be strange
     behaviour).
    </simpara>
    <para>
     See also <function>date</function> and <function>time</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.strftime">
   <refnamediv>
    <refname>strftime</refname>
    <refpurpose>
     Format a local time/date according to locale settings
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>strftime</function></funcdef>
      <paramdef>string <parameter>format</parameter></paramdef>
      <paramdef>int 
       <parameter>
        <optional>timestamp</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string formatted according to the given format string
     using the given <parameter>timestamp</parameter> or the current
     local time if no timestamp is given.  Month and weekday names and
     other language dependent strings respect the current locale set
     with <function>setlocale</function>.
    </para>
    <para>
     The following conversion specifiers are recognized in the format
     string:
     <itemizedlist>
      <listitem>
       <simpara>
        %a - abbreviated weekday name according to the current locale
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %A - full weekday name according to the current locale
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %b - abbreviated month name according to the current locale
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %B - full month name according to the current locale
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %c - preferred date and time representation for the current
        locale
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %C - century number (the year divided by 100 and truncated to
        an integer, range 00 to 99)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %d - day of the month as a decimal number (range 00 to 31)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %D - same as %m/%d/%y
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %e - day of the month as a decimal number, a single digit is
        preceded by a space (range ' 1' to '31')
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %h - same as %b
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %H - hour as a decimal number using a 24-hour clock (range 00
        to 23)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %I - hour as a decimal number using a 12-hour clock (range 01
        to 12)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %j - day of the year as a decimal number (range 001 to 366)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %m - month as a decimal number (range 01 to 12)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %M - minute as a decimal number
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %n - newline character
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %p - either `am' or `pm' according to the given time value, or
        the corresponding strings for the current locale
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %r - time in a.m. and p.m. notation
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %R - time in 24 hour notation
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %S - second as a decimal number
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %t - tab character
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %T - current time, equal to %H:%M:%S
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %u - weekday as a decimal number [1,7], with 1 representing
        Monday
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %U - week number of the current year as a decimal number,
        starting with the first Sunday as the first day of the first
        week
       </simpara>
      </listitem>
      <listitem>
       <simpara> 
        %V - The  ISO 8601:1988 week number of the current year as a
        decimal number, range 01 to 53, where week 1 is the first
        week that has at least 4 days in the current year, and with
        Monday as the first day of the week.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %W - week number of the current year as a decimal number,
        starting with the first Monday as the first day of the first
        week
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %w - day of the week as a decimal, Sunday being 0
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %x - preferred date representation for the current locale
        without the time
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %X - preferred time representation for the current locale
        without the date
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %y - year as a decimal number without a century (range 00 to
        99)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %Y - year as a decimal number including the century
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %Z - time zone or name or abbreviation
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        %% - a literal `%' character
       </simpara>
      </listitem>
     </itemizedlist>
     <example>
      <title><function>Strftime</function> example</title>
      <programlisting role="php">
setlocale ("LC_TIME", "C");
print (strftime ("%A in Finnish is "));
setlocale ("LC_TIME", "fi_FI");
print (strftime ("%A, in French "));
setlocale ("LC_TIME", "fr_CA");
print (strftime ("%A and in German "));
setlocale ("LC_TIME", "de_DE");
print (strftime ("%A.\n"));
      </programlisting>
     </example>
     This example works if you have the respective locales installed
     in your system.
    </para>
    <para>
     See also <function>setlocale</function> and
     <function>mktime</function> and the <ulink url="&spec.strftime;">
     Open Group specification of
     <function>strftime</function></ulink>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.time">
   <refnamediv>
    <refname>time</refname>
    <refpurpose>Return current UNIX timestamp</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>time</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the current time measured in the number of seconds since
     the Unix Epoch (January 1 1970 00:00:00 GMT).
    </para>
    <para>
     See also <function>date</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.strtotime">
   <refnamediv>
    <refname>strtotime</refname>
    <refpurpose>
     Parse about any english textual datetime description into a UNIX
     timestamp
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>strtotime</function></funcdef>
      <paramdef>string <parameter>time</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>now</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The function expects to be given a string containing an english
     date format and will try to parse that format into a UNIX
     timestamp.
     <example>
      <title><function>Strtotime</function> examples</title>
      <programlisting role="php">
echo strtotime ("now") . "\n";
echo strtotime ("10 September 2000") . "\n";
echo strtotime ("+1 day") . "\n";
echo strtotime ("+1 week") . "\n";
echo strtotime ("+1 week 2 days 4 hours 2 seconds") . "\n";
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/dba.xml
+++ phpdoc/kr/functions/dba.xml
 <reference id="ref.dba">
  <title>Database (dbm-style) abstraction layer functions</title>
  <titleabbrev>dba</titleabbrev>

  <partintro>
   <para>
    These functions build the foundation for accessing Berkeley DB
    style databases.
   </para>
   <para>
    This is a general abstraction layer for several file-based databases. As
    such, functionality is limited to a subset of features modern databases
    such as <ulink url="&url.sleepycat;">Sleepycat Software's DB2</ulink>
    support. (This is not to be confused with IBM's DB2 software, which is
    supported through the <link linkend="ref.odbc">ODBC functions</link>.)
   </para>
   <para>
    The behaviour of various aspects depend on the implementation of the
    underlying database. Functions such as <function>dba_optimize</function>
    and <function>dba_sync</function> will do what they promise for one
    database and will do nothing for others.
   </para>
   <para>
    To add support for any of the following handlers, add the
    specified --with configure switch to your PHP configure line:
    <itemizedlist>
     <listitem>
      <simpara>
       Dbm is the oldest (original) type of Berkeley DB style
       databases. You should avoid it, if possible. We do not support
       the compatibility functions built into DB2 and gdbm, because
       they are only compatible on the source code level, but cannot
       handle the original dbm format.  (--with-dbm)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       Ndbm is a newer type and more flexible than dbm. It still has
       most of the arbitrary limits of dbm (therefore it is
       deprecated).  (--with-ndbm)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       Gdbm is the <ulink url="&url.gdbm;">GNU database
       manager</ulink>.  (--with-gdbm)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       DB2 is <ulink url="&url.sleepycat;">Sleepycat Software's
       DB2</ulink>. It is described as "a programmatic toolkit that
       provides high-performance built-in database support for both
       standalone and client/server applications."  (--with-db2)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       DB3 is <ulink url="&url.sleepycat;">Sleepycat Software's
       DB3</ulink>.  (--with-db3)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       Cdb is "a fast, reliable, lightweight package for creating and
       reading constant databases." It is from the author of qmail and
       can be found <ulink url="&url.cdb;">here</ulink>. Since it is
       constant, we support only reading operations.  (--with-cdb)
      </simpara>
     </listitem>
    </itemizedlist>
   </para>
   <para>
    <example>
     <title>DBA example</title>
     <programlisting role="php">
&lt;?php

$id = dba_open ("/tmp/test.db", "n", "db2");

if (!$id) {
    echo "dba_open failed\n";
    exit;
}

dba_replace ("key", "This is an example!", $id);

if (dba_exists ("key", $id)) {
    echo dba_fetch ("key", $id);
    dba_delete ("key", $id);
}

dba_close ($id);
?&gt;
     </programlisting>
    </example>
   </para>
   <para>
    DBA is binary safe and does not have any arbitrary limits. It inherits all
    limits set by the underlying database implementation.
   </para>
   <para>
    All file-based databases must provide a way of setting the file
    mode of a new created database, if that is possible at all. The
    file mode is commonly passed as the fourth argument to
    <function>dba_open</function> or <function>dba_popen</function>.
   </para>
   <para>
    You can access all entries of a database in a linear way by using the
    <function>dba_firstkey</function> and <function>dba_nextkey</function>
    functions. You may not change the database while traversing it.
   </para> 
   <para>
    <example>
     <title>Traversing a database</title>
     <programlisting role="php">
&lt;?php

# ...open database...

$key = dba_firstkey ($id);

while ($key != false) {
    if (...) { # remember the key to perform some action later
        $handle_later[] = $key;
    }
    $key = dba_nextkey ($id);
}

for ($i = 0; $i &lt; count($handle_later); $i++)
    dba_delete ($handle_later[$i], $id);

?&gt;
     </programlisting>
    </example>
   </para>
  </partintro>

  <refentry id="function.dba-close">
   <refnamediv>
    <refname>dba_close</refname>
    <refpurpose>Close database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>dba_close</function></funcdef>
      <paramdef>int <parameter>handle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Dba_close</function> closes the established database
     and frees all resources specified by
     <parameter>handle</parameter>.
    </para>
    <para>
     <parameter>handle</parameter> is a database handle returned by
     <function>dba_open</function>.
    </para>
    <para>
     <function>Dba_close</function> does not return any value.
    </para>
    <para>
     See also: <function>dba_open</function> and
     <function>dba_popen</function>
    </para>     
   </refsect1>
  </refentry>

  <refentry id="function.dba-delete">
   <refnamediv>
    <refname>dba_delete</refname>
    <refpurpose>Delete entry specified by key</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>dba_delete</function></funcdef>
      <paramdef>string <parameter>key</parameter></paramdef>
      <paramdef>int <parameter>handle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>dba_delete</function> deletes the entry specified by
     <parameter>key</parameter> from the database specified with
     <parameter>handle</parameter>.
    </para>
    <para>
     <parameter>key</parameter> is the key of the entry which is
     deleted.
    </para>
    <para>
     <parameter>handle</parameter> is a database handle returned by
     <function>dba_open</function>.
    </para>
    <para>
     <function>dba_delete</function> returns true or false, if the entry is
     deleted or not deleted, respectively.
    </para>
    <para>
     See also: <function>dba_exists</function>,
     <function>dba_fetch</function>, <function>dba_insert</function>,
     and <function>dba_replace</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dba-exists">
   <refnamediv>
    <refname>dba_exists</refname>
    <refpurpose>Check whether key exists</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>dba_exists</function></funcdef>
      <paramdef>string <parameter>key</parameter></paramdef>
      <paramdef>int <parameter>handle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Dba_exists</function> checks whether the specified
     <parameter>key</parameter> exists in the database specified by
     <parameter>handle</parameter>.
    </para>
    <para>
     <parameter>Key</parameter> is the key the check is performed for.
    </para>
    <para>
     <parameter>Handle</parameter> is a database handle returned by
     <function>dba_open</function>.
    </para>
    <para>
     <function>Dba_exists</function> returns true or false, if the key is found
     or not found, respectively.
    </para>
    <para>
     See also: <function>dba_fetch</function>,
     <function>dba_delete</function>, <function>dba_insert</function>,
     and <function>dba_replace</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dba-fetch">
   <refnamediv>
    <refname>dba_fetch</refname>
    <refpurpose>Fetch data specified by key</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>dba_fetch</function></funcdef>
      <paramdef>string <parameter>key</parameter></paramdef>
      <paramdef>int <parameter>handle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Dba_fetch</function> fetches the data specified by
     <parameter>key</parameter> from the database specified with
     <parameter>handle</parameter>.
    </para>
    <para>
     <parameter>Key</parameter> is the key the data is specified by.
    </para>
    <para>
     <parameter>Handle</parameter> is a database handle returned by
     <function>dba_open</function>.
    </para>

    <para>
     <function>Dba_fetch</function> returns the associated string or false, if
     the key/data pair is found or not found, respectively.
    </para>
    <para>
     See also: <function>dba_exists</function>,
     <function>dba_delete</function>, <function>dba_insert</function>,
     and <function>dba_replace</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dba-firstkey">
   <refnamediv>
    <refname>dba_firstkey</refname>
    <refpurpose>Fetch first key</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>dba_firstkey</function></funcdef>
      <paramdef>int <parameter>handle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Dba_firstkey</function> returns the first key of the
     database specified by <parameter>handle</parameter> and resets
     the internal key pointer. This permits a linear search through
     the whole database.
    </para>
    <para>
     <parameter>Handle</parameter> is a database handle returned by
     <function>dba_open</function>.
    </para>
    <para>
     <function>Dba_firstkey</function> returns the key or false
     depending on whether it succeeds or fails, respectively.
    </para>
    <para>
     See also:
     <function>Dba_nextkey</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dba-insert">
   <refnamediv>
    <refname>dba_insert</refname>
    <refpurpose>Insert entry</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>dba_insert</function></funcdef>
      <paramdef>string <parameter>key</parameter></paramdef>
      <paramdef>string <parameter>value</parameter></paramdef>
      <paramdef>int <parameter>handle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>dba_insert</function> inserts the entry described with
     <parameter>key</parameter> and <parameter>value</parameter> into the
     database specified by <parameter>handle</parameter>. It fails, if an entry
     with the same <parameter>key</parameter> already exists.
    </para>
    <para>
     <parameter>key</parameter> is the key of the entry to be inserted.
    </para>
    <para>
     <parameter>value</parameter> is the value to be inserted.
    </para>
    <para>
     <parameter>handle</parameter> is a database handle returned by
     <function>dba_open</function>.
    </para>
    <para>
     <function>dba_insert</function> returns true or false, depending on
     whether it succeeds of fails, respectively.
    </para>
    <para>
     See also:
     <function>dba_exists</function>
     <function>dba_delete</function>
     <function>dba_fetch</function>
     <function>dba_replace</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dba-nextkey">
   <refnamediv>
    <refname>dba_nextkey</refname>
    <refpurpose>Fetch next key</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>dba_nextkey</function></funcdef>
      <paramdef>int <parameter>handle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>dba_nextkey</function> returns the next key of the database
     specified by <parameter>handle</parameter> and increments the internal
     key pointer.
    </para> 
    <para>
     <parameter>handle</parameter> is a database handle returned by
     <function>dba_open</function>.
    </para>
    <para>
     <function>dba_nextkey</function> returns the key or false depending on
     whether it succeeds or fails, respectively.
    </para>
    <para>
     See also:
     <function>dba_firstkey</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dba-popen">
   <refnamediv>
    <refname>dba_popen</refname>
    <refpurpose>Open database persistently</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>dba_popen</function></funcdef>
      <paramdef>string <parameter>path</parameter></paramdef>
      <paramdef>string <parameter>mode</parameter></paramdef>
      <paramdef>string <parameter>handler</parameter></paramdef>
      <paramdef><parameter><optional>...</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>

    <para>
     <function>dba_popen</function> establishes a persistent database instance
     for <parameter>path</parameter> with <parameter>mode</parameter> using
     <parameter>handler</parameter>.
    </para>
    <para>
     <parameter>path</parameter> is commonly a regular path in your filesystem.
    </para>
    <para>
     <parameter>mode</parameter> is "r" for read access, "w" for read/write
     access to an already existing database, "c" for read/write access
     and database creation if it doesn't currently exist, and "n" for
     create, truncate and read/write access.
    </para>
    <para>
     <parameter>handler</parameter> is the name of the handler which shall be
     used for accessing <parameter>path</parameter>. It is passed all optional
     parameters given to <function>dba_popen</function> and can act on behalf
     of them.
    </para>
    <para>
     <function>dba_popen</function> returns a positive handler id or false, in
     the case the open is successful or fails, respectively.
    </para>
    <para>
     See also:
     <function>dba_open</function>
     <function>dba_close</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dba-open">
   <refnamediv>
    <refname>dba_open</refname>
    <refpurpose>Open database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>dba_open</function></funcdef>
      <paramdef>string <parameter>path</parameter></paramdef>
      <paramdef>string <parameter>mode</parameter></paramdef>
      <paramdef>string <parameter>handler</parameter></paramdef>
      <paramdef><parameter><optional>...</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>dba_open</function> establishes a database instance for
     <parameter>path</parameter> with <parameter>mode</parameter> using
     <parameter>handler</parameter>.
    </para>
    <para>
     <parameter>path</parameter> is commonly a regular path in your filesystem.
    </para>
    <para>
     <parameter>mode</parameter> is "r" for read access, "w" for read/write
     access to an already existing database, "c" for read/write access
     and database creation if it doesn't currently exist, and "n" for
     create, truncate and read/write access.
    </para>
    <para>
     <parameter>handler</parameter> is the name of the handler which shall be
     used for accessing <parameter>path</parameter>. It is passed all optional
     parameters given to <function>dba_open</function> and can act on behalf of
     them.
    </para>
    <para>
     <function>dba_open</function> returns a positive handler id or false, in
     the case the open is successful or fails, respectively.
    </para>
    <para>
     See also:
     <function>dba_popen</function>
     <function>dba_close</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dba-optimize">
   <refnamediv>
    <refname>dba_optimize</refname>
    <refpurpose>Optimize database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>dba_optimize</function></funcdef>
      <paramdef>int <parameter>handle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>dba_optimize</function> optimizes the underlying database
     specified by <parameter>handle</parameter>.
    </para>
    <para>
     <parameter>handle</parameter> is a database handle returned by
     <function>dba_open</function>.
    </para>
    <para>
     <function>dba_optimize</function> returns true or false, if the
     optimization succeeds or fails, respectively.
    </para>
    <para>
     See also:
     <function>dba_sync</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dba-replace">
   <refnamediv>
    <refname>dba_replace</refname>
    <refpurpose>Replace or insert entry</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>dba_replace</function></funcdef>
      <paramdef>string <parameter>key</parameter></paramdef>
      <paramdef>string <parameter>value</parameter></paramdef>
      <paramdef>int <parameter>handle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>dba_replace</function> replaces or inserts the entry described
     with <parameter>key</parameter> and <parameter>value</parameter> into the
     database specified by <parameter>handle</parameter>.
    </para> 
    <para>
     <parameter>key</parameter> is the key of the entry to be inserted.
    </para>
    <para>
     <parameter>value</parameter> is the value to be inserted.
    </para>
    <para>
     <parameter>handle</parameter> is a database handle returned by
     <function>dba_open</function>.
    </para>
    <para>
     <function>dba_replace</function> returns true or false, depending on
     whether it succeeds of fails, respectively.
    </para>
    <para>
     See also: <function>dba_exists</function>,
     <function>dba_delete</function>, <function>dba_fetch</function>,
     and <function>dba_insert</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dba-sync">
   <refnamediv>
    <refname>dba_sync</refname>
    <refpurpose>Synchronize database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>dba_sync</function></funcdef>
      <paramdef>int <parameter>handle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>dba_sync</function> synchronizes the database specified by
     <parameter>handle</parameter>. This will probably trigger a physical write
     to disk, if supported.
    </para>
    <para>
     <parameter>handle</parameter> is a database handle returned by
     <function>dba_open</function>.
    </para>
    <para>
     <function>dba_sync</function> returns true or false, if the
     synchronization succeeds or fails, respectively.
    </para>
    <para>
     See also: <function>dba_optimize</function>
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/dbase.xml
+++ phpdoc/kr/functions/dbase.xml
 <reference id="ref.dbase">
  <title>dBase functions</title>
  <titleabbrev>dBase</titleabbrev>

  <partintro>
   <simpara>
    These functions allow you to access records stored in dBase-format
    (dbf) databases.
   </simpara>
   <simpara>
    There is no support for indexes or memo fields. There is no
    support for locking, too. Two concurrent webserver processes
    modifying the same dBase file will very likely ruin your database.
   </simpara>
   <simpara>
    Unlike SQL databases, dBase "databases" cannot change the database
    definition afterwards.  Once the file is created, the database
    definition is fixed. There are no indexes that speed searching or
    otherwise organize your data. dBase files are simple sequential
    files of fixed length records. Records are appended to the end of
    the file and delete records are kept until you call
    <function>dbase_pack()</function>.
   </simpara>
   <simpara>
    We recommend that you do not use dBase files as your production
    database. Choose any real SQL server instead; MySQL or Postgres
    are common choices with PHP. dBase support is here to allow you to
    import and export data to and from your web database, since the
    file format is commonly understood with Windows spreadsheets and
    organizers. Import and export of data is about all that dBase
    support is good for.
   </simpara>
  </partintro>

  <refentry id="function.dbase-create">
   <refnamediv>
    <refname>dbase_create</refname>
    <refpurpose>Creates a dBase database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>dbase_create</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
      <paramdef>array <parameter>fields</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <parameter>fields</parameter> parameter is an array of
     arrays, each array describing the format of one field in the
     database. Each field consists of a name, a character indicating
     the field type, a length, and a precision.
    </para>
    <para>
     The types of fields available are:
     <variablelist>
      <varlistentry>
       <term>L</term>
       <listitem>
        <simpara>
         Boolean. These do not have a length or precision.
        </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term>M</term>
       <listitem>
        <simpara>
         Memo. (Note that these aren't supported by PHP.)  These do
         not have a length or precision.
        </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term>D</term>
       <listitem>
        <simpara>
         Date (stored as YYYYMMDD).  These do not have a length or
         precision.
        </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term>N</term>
       <listitem>
        <simpara>
         Number. These have both a length and a precision (the number
         of digits after the decimal point).
        </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term>C</term>
       <listitem>
        <simpara>
         String.
        </simpara>
       </listitem>
      </varlistentry>
     </variablelist>
    </para>
    <para>
     If the database is successfully created, a dbase_identifier is
     returned, otherwise false is returned.
     <example>
      <title>Creating a dBase database file</title>
      <programlisting role="php">
// "database" name
$dbname = "/tmp/test.dbf";

// database "definition"
$def =
    array(
        array("date",     "D"),
        array("name",     "C",  50),
        array("age",      "N",   3, 0),
        array("email",    "C", 128),
        array("ismember", "L")
    );

// creation
if (!dbase_create($dbname, $def))
    print "&lt;strong>Error!&lt;/strong>";
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dbase-open">
   <refnamediv>
    <refname>dbase_open</refname>
    <refpurpose>Opens a dBase database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>dbase_open</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
      <paramdef>int <parameter>flags</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The flags correspond to those for the open() system call.
     (Typically 0 means read-only, 1 means write-only, and 2 means
     read and write.)
    </para>
    <para>
     Returns a dbase_identifier for the opened database, or false if
     the database couldn't be opened.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dbase-close">
   <refnamediv>
    <refname>dbase_close</refname>
    <refpurpose>Close a dBase database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>dbase_close</function></funcdef>
      <paramdef>int <parameter>dbase_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Closes the database associated with
     <parameter>dbase_identifier</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dbase-pack">
   <refnamediv>
    <refname>dbase_pack</refname>
    <refpurpose>Packs a dBase database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>dbase_pack</function></funcdef>
      <paramdef>int <parameter>dbase_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Packs the specified database (permanently deleting all records
     marked for deletion using
     <function>dbase_delete_record</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dbase-add-record">
   <refnamediv>
    <refname>dbase_add_record</refname>
    <refpurpose>Add a record to a dBase database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>dbase_add_record</function></funcdef>
      <paramdef>int <parameter>dbase_identifier</parameter></paramdef>
      <paramdef>array <parameter>record</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Adds the data in the <parameter>record </parameter>to the
     database. If the number of items in the supplied record isn't
     equal to the number of fields in the database, the operation will
     fail and false will be returned.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dbase-replace-record">
   <refnamediv>
    <refname>dbase_replace_record</refname>
    <refpurpose>Replace a record in a dBase database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>dbase_replace_record</function></funcdef>
      <paramdef>int <parameter>dbase_identifier</parameter></paramdef>
      <paramdef>array <parameter>record</parameter></paramdef>
      <paramdef>int <parameter>dbase_record_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Replaces the data associated with the record
     <parameter>record_number</parameter> with the data in the
     <parameter>record</parameter> in the database. If the number of
     items in the supplied record is not equal to the number of fields
     in the database, the operation will fail and false will be
     returned.
    </simpara>
    <simpara>
     <parameter>dbase_record_number</parameter> is an integer which
     spans from 1 to the number of records in the database (as
     returned by <function>dbase_numrecords</function>).
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.dbase-delete-record">
   <refnamediv>
    <refname>dbase_delete_record</refname>
    <refpurpose>Deletes a record from a dBase database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>dbase_delete_record</function></funcdef>
      <paramdef>int <parameter>dbase_identifier</parameter></paramdef>
      <paramdef>int <parameter>record</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Marks <parameter>record</parameter> to be deleted from the
     database.  To actually remove the record from the database, you
     must also call <function>dbase_pack</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dbase-get-record">
   <refnamediv>
    <refname>dbase_get_record</refname>
    <refpurpose>Gets a record from a dBase database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>dbase_get_record</function></funcdef>
      <paramdef>int <parameter>dbase_identifier</parameter></paramdef>
      <paramdef>int <parameter>record</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the data from <parameter>record</parameter> in an
     array. The array is indexed starting at 0, and includes an
     associative member named 'deleted' which is set to 1 if the
     record has been marked for deletion (see
     <function>dbase_delete_record</function>.
    </para>
    <para>
     Each field is converted to the appropriate PHP type. (Dates are
     left as strings.)
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dbase-get-record-with-names">
   <refnamediv>
    <refname>dbase_get_record_with_names</refname>
    <refpurpose>
     Gets a record from a dBase database as an associative array
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array 
       <function>dbase_get_record_with_names</function>
      </funcdef>
      <paramdef>int <parameter>dbase_identifier</parameter></paramdef>
      <paramdef>int <parameter>record</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the data from <parameter>record</parameter> in an
     associative array.  The array also includes an associative member
     named 'deleted' which is set to 1 if the record has been marked
     for deletion (see <function>dbase_delete_record</function>.
    </para>
    <para>
     Each field is converted to the appropriate PHP type. (Dates are
     left as strings.)
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dbase-numfields">
   <refnamediv>
    <refname>dbase_numfields</refname>
    <refpurpose>
     Find out how many fields are in a dBase database
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>dbase_numfields</function></funcdef>
      <paramdef>int <parameter>dbase_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the number of fields (columns) in the specified
     database. Field numbers are between 0 and dbase_numfields($db)-1,
     while record numbers are between 1 and dbase_numrecords($db).
     <example>
      <title>Using <function>dbase_numfields</function></title>
      <programlisting role="php">
$rec = dbase_get_record($db, $recno);
$nf  = dbase_numfields($db);
for ($i=0; $i &lt; $nf; $i++) {
    print $rec[$i]."&lt;br>\n";
}
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dbase-numrecords">
   <refnamediv>
    <refname>dbase_numrecords</refname>
    <refpurpose>
     Find out how many records are in a dBase database
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>dbase_numrecords</function></funcdef>
      <paramdef>int <parameter>dbase_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the number of records (rows) in the specified
     database. Record numbers are between 1 and dbase_numrecords($db),
     while field numbers are between 0 and dbase_numfields($db)-1.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/dbm.xml
+++ phpdoc/kr/functions/dbm.xml
 <reference id="ref.dbm">
  <title>DBM Functions</title>
  <titleabbrev>DBM</titleabbrev>

  <partintro>
   <simpara>
    These functions allow you to store records stored in a dbm-style
    database. This type of database (supported by the Berkeley DB,
    GDBM, and some system libraries, as well as a built-in flatfile
    library) stores key/value pairs (as opposed to the full-blown
    records supported by relational databases).
   </simpara>
   <para>
    <example>
     <title>DBM example</title>
     <programlisting role="php">
$dbm = dbmopen ("lastseen", "w");
if (dbmexists ($dbm, $userid)) {
    $last_seen = dbmfetch ($dbm, $userid);
} else {
    dbminsert ($dbm, $userid, time());
}
do_stuff();
dbmreplace ($dbm, $userid, time());
dbmclose ($dbm);
     </programlisting>
    </example>
   </para>
  </partintro>

  <refentry id="function.dbmopen">
   <refnamediv>
    <refname>dbmopen</refname>
    <refpurpose>Opens a DBM database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>dbmopen</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
      <paramdef>string <parameter>flags</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The first argument is the full-path filename of the DBM file to
     be opened and the second is the file open mode which is one of
     "r", "n", "c" or "w" for read-only, new (implies read-write, and
     most likely will truncate an already-existing database of the
     same name), create (implies read-write, and will not truncate an
     already-existing database of the same name) and read-write
     respectively.
    </para>
    <para>
     Returns an identifer to be passed to the other DBM functions on
     success, or false on failure.
    </para>
    <para>
     If NDBM support is used, NDBM will actually create filename.dir
     and filename.pag files. GDBM only uses one file, as does the
     internal flat-file support, and Berkeley DB creates a
     <filename>filename.db</filename> file. Note that PHP does its own
     file locking in addition to any file locking that may be done by
     the DBM library itself. PHP does not delete the
     <filename>.lck</filename> files it creates. It uses these files
     simply as fixed inodes on which to do the file locking. For more
     information on DBM files, see your Unix man pages, or obtain
     <ulink url="&url.gdbm;">GNU's GDBM</ulink>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dbmclose">
   <refnamediv>
    <refname>dbmclose</refname>
    <refpurpose>Closes a dbm database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>dbmclose</function></funcdef>
      <paramdef>int <parameter>dbm_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Unlocks and closes the specified database.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dbmexists">
   <refnamediv>
    <refname>dbmexists</refname>
    <refpurpose>
     Tells if a value exists for a key in a DBM database
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>dbmexists</function></funcdef>
      <paramdef>int <parameter>dbm_identifier</parameter></paramdef>
      <paramdef>string <parameter>key</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns TRUE if there is a value associated with the
     <parameter>key</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dbmfetch">
   <refnamediv>
    <refname>dbmfetch</refname>
    <refpurpose>
     Fetches a value for a key from a DBM database
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>dbmfetch</function></funcdef>
      <paramdef>int <parameter>dbm_identifier</parameter></paramdef>
      <paramdef>string <parameter>key</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the value associated with <parameter>key</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dbminsert">
   <refnamediv>
    <refname>dbminsert</refname>
    <refpurpose>
     Inserts a value for a key in a DBM database
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>dbminsert</function></funcdef>
      <paramdef>int <parameter>dbm_identifier</parameter></paramdef>
      <paramdef>string <parameter>key</parameter></paramdef>
      <paramdef>string <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Adds the value to the database with the specified key.
    </para>
    <para>
     Returns -1 if the database was opened read-only, 0 if the insert
     was successful, and 1 if the specified key already exists. (To
     replace the value, use <function>dbmreplace</function>.)
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dbmreplace">
   <refnamediv>
    <refname>dbmreplace</refname>
    <refpurpose>
     Replaces the value for a key in a DBM database
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>dbmreplace</function></funcdef>
      <paramdef>int <parameter>dbm_identifier</parameter></paramdef>
      <paramdef>string <parameter>key</parameter></paramdef>
      <paramdef>string <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Replaces the value for the specified key in the database.
    </para>
    <para>
     This will also add the key to the database if it didn't already
     exist.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dbmdelete">
   <refnamediv>
    <refname>dbmdelete</refname>
    <refpurpose>
     Deletes the value for a key from a DBM database
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>dbmdelete</function></funcdef>
      <paramdef>int <parameter>dbm_identifier</parameter></paramdef>
      <paramdef>string <parameter>key</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Deletes the value for <parameter>key</parameter> in the database.
    </para>
    <para>
     Returns false if the key didn't exist in the database.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dbmfirstkey">
   <refnamediv>
    <refname>dbmfirstkey</refname>
    <refpurpose>
     Retrieves the first key from a DBM database
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>dbmfirstkey</function></funcdef>
      <paramdef>int <parameter>dbm_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the first key in the database. Note that no particular order
     is guaranteed since the database may be built using a hash-table,
     which doesn't guarantee any ordering.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dbmnextkey">
   <refnamediv>
    <refname>dbmnextkey</refname>
    <refpurpose>
     Retrieves the next key from a DBM database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>dbmnextkey</function></funcdef>
      <paramdef>int <parameter>dbm_identifier</parameter></paramdef>
      <paramdef>string <parameter>key</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the next key after <parameter>key</parameter>. By calling
     <function>dbmfirstkey</function> followed by successive
     calls to <function>dbmnextkey</function> it is possible to
     visit every key/value pair in the dbm database. For example:
     <example>
      <title>Visiting every key/value pair in a DBM database</title>
      <programlisting role="php">
$key = dbmfirstkey ($dbm_id);
while ($key) {
    echo "$key = " . dbmfetch ($dbm_id, $key) . "\n";
    $key = dbmnextkey ($dbm_id, $key);
}
     </programlisting>
    </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dblist">
   <refnamediv>
    <refname>dblist</refname>
    <refpurpose>
     Describes the DBM-compatible library being used
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>dblist</function></funcdef>
      <paramdef>void</paramdef>
     </funcprototype>
    </funcsynopsis>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/dir.xml
+++ phpdoc/kr/functions/dir.xml
 <reference id="ref.dir">
  <title>Directory functions</title>
  <titleabbrev>Directories</titleabbrev>

  <refentry id="function.chdir">
   <refnamediv>
    <refname>chdir</refname>
    <refpurpose>change directory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>chdir</function></funcdef>
      <paramdef>string <parameter>directory</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Changes PHP's current directory to
     <parameter>directory</parameter>.  Returns FALSE if unable to
     change directory, TRUE otherwise.
    </para>
   </refsect1>
  </refentry>

  <refentry id="class.dir">
   <refnamediv>
    <refname>dir</refname>
    <refpurpose>directory class</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>new <function>dir</function></funcdef>
      <paramdef>string <parameter>directory</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     A pseudo-object oriented mechanism for reading a directory.  The
     given <parameter>directory</parameter> is opened.  Two properties
     are available once directory has been opened.  The handle
     property can be used with other directory functions such as
     <function>readdir</function>, <function>rewinddir</function> and
     <function>closedir</function>.  The path property is set to path
     the directory that was opened.  Three methods are available:
     read, rewind and close.
     <example>
      <title><function>Dir</function> Example</title>
      <programlisting role="php">
$d = dir("/etc");
echo "Handle: ".$d->handle."&lt;br>\n";
echo "Path: ".$d->path."&lt;br>\n";
while($entry=$d->read()) {
    echo $entry."&lt;br>\n";
}
$d->close();
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.closedir">
   <refnamediv>
    <refname>closedir</refname>
    <refpurpose>close directory handle</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>closedir</function></funcdef>
      <paramdef>int <parameter>dir_handle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Closes the directory stream indicated by
     <parameter>dir_handle</parameter>. The stream must have previously
     been opened by <function>opendir</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.getcwd">
   <refnamediv>
    <refname>getcwd</refname>
    <refpurpose>gets the current working directory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>getcwd</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the current working directory.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.opendir">
   <refnamediv>
    <refname>opendir</refname>
    <refpurpose>open directory handle</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>opendir</function></funcdef>
      <paramdef>string <parameter>path</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns a directory handle to be used in subsequent
     <function>closedir</function>, <function>readdir</function>, and
     <function>rewinddir</function> calls.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.readdir">
   <refnamediv>
    <refname>readdir</refname>
    <refpurpose>read entry from directory handle</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>readdir</function></funcdef>
      <paramdef>int <parameter>dir_handle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the filename of the next file from the directory. The
     filenames are not returned in any particular order.
     <example>
      <title>List all files in the current directory</title>
      <programlisting role="php">
// Note that !== did not exist until 4.0.0-RC2
&lt;?php
$handle=opendir('.');
echo "Directory handle: $handle\n";
echo "Files:\n";
while (($file = readdir($handle))!==false) {
    echo "$file\n";
}
closedir($handle); 
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     Note that <function>readdir</function> will return the . and
     .. entries.  If you don't want these, simply strip them out:
     <example>
      <title>
       List all files in the current directory and strip out . and
       ..
      </title>
      <programlisting role="php">
&lt;?php 
$handle=opendir('.'); 
while (false!==($file = readdir($handle))) { 
    if ($file != "." &amp;&amp; $file != "..") { 
        echo "$file\n"; 
    } 
}
closedir($handle); 
?&gt;
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.rewinddir">
   <refnamediv>
    <refname>rewinddir</refname>
    <refpurpose>rewind directory handle</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>rewinddir</function></funcdef>
      <paramdef>int <parameter>dir_handle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Resets the directory stream indicated by
     <parameter>dir_handle</parameter> to the beginning of the
     directory.
    </para>

   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/domxml.xml
+++ phpdoc/kr/functions/domxml.xml
 <reference id="ref.domxml">
  <title>DOM XML functions</title>
  <titleabbrev>DOM XML</titleabbrev>

  <partintro>
   <simpara>
    These functions are only available if PHP was configured with
    <option role="configure">--with-dom=[DIR]</option>, using the
    GNOME xml library. You will need at least libxml-2.0.0 (the beta
    version will not work). These functions have been added in PHP 4.
   </simpara>
   <simpara>
    This module defines the following constants:
   </simpara>
   <table>
    <title>XML constants</title>
    <tgroup cols="3">
     <thead>
      <row>
       <entry>Constant</entry>
       <entry>Value</entry>
       <entry>Description</entry>
      </row>
     </thead>
     <tbody>
      <row>
       <entry>XML_ELEMENT_NODE</entry>
       <entry>1</entry>
       <entry></entry>
      </row>
      <row>
       <entry>XML_ATTRIBUTE_NODE</entry>
       <entry>2</entry>
       <entry></entry>
      </row>
      <row>
       <entry>XML_TEXT_NODE</entry>
       <entry>3</entry>
       <entry></entry>
      </row>
      <row>
       <entry>XML_CDATA_SECTION_NODE</entry>
       <entry>4</entry>
       <entry></entry>
      </row>
      <row>
       <entry>XML_ENTITY_REF_NODE</entry>
       <entry>5</entry>
       <entry></entry>
      </row>
      <row>
       <entry>XML_ENTITY_NODE</entry>
       <entry>6</entry>
       <entry></entry>
      </row>
      <row>
       <entry>XML_PI_NODE</entry>
       <entry>7</entry>
       <entry></entry>
      </row>
      <row>
       <entry>XML_COMMENT_NODE</entry>
       <entry>8</entry>
       <entry></entry>
      </row>
      <row>
       <entry>XML_DOCUMENT_NODE</entry>
       <entry>9</entry>
       <entry></entry>
      </row>
      <row>
       <entry>XML_DOCUMENT_TYPE_NODE</entry>
       <entry>10</entry>
       <entry></entry>
      </row>
      <row>
       <entry>XML_DOCUMENT_FRAG_NODE</entry>
       <entry>11</entry>
       <entry></entry>
      </row>
      <row>
       <entry>XML_NOTATION_NODE</entry>
       <entry>12</entry>
       <entry></entry>
      </row>
      <row>
       <entry>XML_GLOBAL_NAMESPACE</entry>
       <entry>1</entry>
       <entry></entry>
      </row>
      <row>
       <entry>XML_LOCAL_NAMESPACE</entry>
       <entry>2</entry>
       <entry></entry>
      </row>
     </tbody>
    </tgroup>
   </table>
   <simpara>
    This module defines a number of classes. The DOM XML functions
    return a parsed tree of the XML document with each node being an
    object belonging to one of these classes.
   </simpara>
  </partintro>

  <!-- class Dom document -->
  <!-- has member functions
        array root([int doc_handle]) 
           returns array of root nodes of this document. Array
           elements are objects of class "Dom node" having properties of
           "node" (resource), "type" (long), "name" (string)
           and optionally "content" (string).

        array children([ int node ])
           returns an array of child nodes of this element. Array
           elements are objects of class "Dom node" having properties
           of "node" (resource), "type" (long), "name" (string)
           and optionally "content" (string).

        object add_root([int doc_handle,] string name)
           Add a root node to document.

           returns an object of class "Dom node" having properties
           of "node" (resource), "type" (long), "name" (string)
           and optionally "content" (string). 

        object intdtd([int doc_handle])
           returns the DTD of document.

           returns an object of class "Dtd" having properties
           of "dtd" (resource), "sysid" (string), "name" (string)
           and optionally "extid" (string).

        string dumpmem([int doc_handle])
           dumps document into string.
    -->

   <!-- class Dom node
        object lastchild([int node])
          returns Dom node object

        array children([int node])
          as above

        object parent([ int node])
          returns Dom node object
          (parent of this node)

        new_child
        string getattr([int node,] string attrname)
          get value of attribute named attrname

        bool setattr([int node,] string attrname, string value)
          set value of given attribute.

        array attributes([int node])
          returns associative array of (string name, string value)
          pairs.

        object node(string name)
          creates a named Dom node object.
    -->

  <!-- class Dom Attribute
       name
    -->

  <!-- class Dom Namespace
    -->

  <!-- class Dtd
    -->        

  <refentry id="function.xmldoc">
   <refnamediv>
    <refname>xmldoc</refname>
    <refpurpose>Creates a DOM object of an XML document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>object <function>xmldoc</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The function parses the XML document in
     <parameter>str</parameter> and returns an object of class "Dom
     document", having the properties "doc" (resource), "version"
     (string) and "type" (long).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xmldocfile">
   <refnamediv>
    <refname>xmldocfile</refname>
    <refpurpose>Creates a DOM object from XML file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>object <function>xmldocfile</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The function parses the XML document in the file named
     <parameter>filename</parameter> and returns an object of class
     "Dom document", having the properties "doc" (resource), "version"
     (string).

     <!-- conspiciously the file attribute is missing? -->

    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xmltree">
   <refnamediv>
    <refname>xmltree</refname>
    <refpurpose>
     Creates a tree of php objects from XML document
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>object <function>xmltree</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The function parses the XML document in
     <parameter>str</parameter> and returns a tree PHP objects as the
     parsed document.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!--
   TODO

   domxml_root
   domxml_add_root
   domxml_dumpmem
   domxml_attributes
   domxml_getattr
   domxml_setattr
   domxml_children
   domxml_new_child
   domxml_node
   domxml_new_xmldoc alias new_xmldoc
-->

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/errorfunc.xml
+++ phpdoc/kr/functions/errorfunc.xml
 <reference id="ref.errorfunc">
  <title>Error Handling and Logging Functions</title>
  <titleabbrev>Errors and Logging</titleabbrev>

  <partintro>
   <para>
    These are functions dealing with error handling and logging. They
    allow you to define your own error handling rules, as well as modify
    the way the errors can be logged. This allows you to change and
    enhance error reporting to suit your needs.
   </para>
   <para> 
    With the logging functions, you can send messages directly to other
    machines, to an email (or email to pager gateway!), to system logs,
    etc., so you can selectively log and monitor the most important parts
    of your applications and websites.
   </para>
   <para> 
    The error reporting functions allow you to customize what level and
    kind of error feedback is given, ranging from simple notices to customized
    functions returned during errors. 
   </para>
  </partintro>

  <refentry id="function.error-log">
   <refnamediv>
    <refname>error_log</refname>
    <refpurpose>send an error message somewhere</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>error_log</function></funcdef>
      <paramdef>string <parameter>message</parameter></paramdef>
      <paramdef>int <parameter>message_type</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>destination</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>extra_headers</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sends an error message to the web server's error log, a
     <acronym>TCP</acronym> port or to a file.  The first parameter,
     <parameter>message</parameter>, is the error message that should
     be logged.  The second parameter,
     <parameter>message_type</parameter> says where the message should
     go:
     <table>
      <title><function>error_log</function> log types</title>
      <tgroup cols="2">
       <tbody>
    <row>
     <entry>0</entry>
     <entry>
      <parameter>message</parameter> is sent to PHP's system
      logger, using the Operating System's system logging
      mechanism or a file, depending on what the <link
      linkend="ini.error-log">error_log</link> configuration
      directive is set to.
     </entry>
    </row>
    <row>
     <entry>1</entry>
     <entry>
      <parameter>message</parameter> is sent by email to the
      address in the <parameter>destination</parameter> parameter.
      This is the only message type where the fourth parameter,
      <parameter>extra_headers</parameter> is used.  This message
      type uses the same internal function as
      <function>Mail</function> does.
     </entry>
    </row>
    <row>
     <entry>2</entry>
     <entry>
      <parameter>message</parameter> is sent through the PHP debugging
      connection.  This option is only available if <link
      linkend="install.configure.enable-debugger">remote debugging has
      been enabled</link>.  In this case, the
      <parameter>destination</parameter> parameter specifies the host
      name or IP address and optionally, port number, of the socket
      receiving the debug information.
     </entry>
    </row>
    <row>
     <entry>3</entry>
     <entry>
      <parameter>message</parameter> is appended to the file
      <parameter>destination</parameter>.
     </entry>
    </row>
       </tbody>
      </tgroup>
     </table>
    </para>
    <para>
     <example role="php">
      <title><function>error_log</function> examples</title>
      <programlisting role="php">
// Send notification through the server log if we can not
// connect to the database.
if (!Ora_Logon ($username, $password)) {
    error_log ("Oracle database not available!", 0);
}

// Notify administrator by email if we run out of FOO
if (!($foo = allocate_new_foo()) {
    error_log ("Big trouble, we're all out of FOOs!", 1,
               "[EMAIL PROTECTED]");
}

// other ways of calling error_log():
error_log ("You messed up!", 2, "127.0.0.1:7000");
error_log ("You messed up!", 2, "loghost");
error_log ("You messed up!", 3, "/var/tmp/my-errors.log");
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.error-reporting">
   <refnamediv>
    <refname>error_reporting</refname>
    <refpurpose>set which PHP errors are reported</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>error_reporting</function></funcdef>
      <paramdef>int
       <parameter><optional>level</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets PHP's error reporting level and returns the old level.  The
     error reporting level is either a bitmask, or named constant. Using
     named constants is strongly encouraged to ensure compatibility for
     future versions. As error levels are added, the range of integers
     increases, so older integer-based error levels will not always
     behave as expected.
     <example role="php">
      <title>Error Integer changes</title>
      <programlisting role="php">
error_reporting (55);   // PHP 3 equivalent to E_ALL ^ E_NOTICE

/* ...in PHP 4, '55' would mean (E_ERROR | E_WARNING | E_PARSE |
E_CORE_ERROR | E_CORE_WARNING) */

error_reporting (2039); // PHP 4 equivalent to E_ALL ^ E_NOTICE

error_reporting (E_ALL ^ E_NOTICE); // The same in both PHP 3 and 4
      </programlisting>
     </example>
     Follow the links for the internal values to get their meanings:
     <table>
      <title><function>error_reporting</function> bit values</title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>constant</entry>
         <entry>value</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>1</entry>
         <entry>
          <link linkend="internal.e-error">E_ERROR</link>
         </entry>
        </row>
        <row>
         <entry>2</entry>
         <entry>
          <link linkend="internal.e-warning">E_WARNING</link>
         </entry>
        </row>
        <row>
         <entry>4</entry>
         <entry>
          <link linkend="internal.e-parse">E_PARSE</link>
         </entry>
        </row>
        <row>
         <entry>8</entry>
         <entry>
          <link linkend="internal.e-notice">E_NOTICE</link>
         </entry>
        </row>
        <row>
         <entry>16</entry>
         <entry>
          <link linkend="internal.e-core-error">E_CORE_ERROR</link>
         </entry>
        </row>
        <row>
         <entry>32</entry>
         <entry>
          <link linkend="internal.e-core-warning">E_CORE_WARNING</link>
         </entry>
        </row>
        <row>
         <entry>64</entry>
         <entry>
          <link linkend="internal.e-compile-error">E_COMPILE_ERROR</link>
         </entry>
        </row>
        <row>
         <entry>128</entry>
         <entry>
          <link linkend="internal.e-compile-warning">E_COMPILE_WARNING</link>
         </entry>
        </row>
        <row>
         <entry>256</entry>
         <entry>
          <link linkend="internal.e-user-error">E_USER_ERROR</link>
         </entry>
        </row>
        <row>
         <entry>512</entry>
         <entry>
          <link linkend="internal.e-user-warning">E_USER_WARNING</link>
         </entry>
        </row>
        <row>
         <entry>1024</entry>
         <entry>
          <link linkend="internal.e-user-error">E_USER_NOTICE</link>
         </entry>
        </row>
       </tbody>
      </tgroup>
     </table>
    </para>
    <para>
     <example role="php">
      <title><function>error_reporting</function> examples</title>
      <programlisting role="php">
error_reporting(0);
/* Turn off all reporting */

error_reporting (7); // Old syntax, PHP 2/3
error_reporting  (E_ERROR | E_WARNING | E_PARSE); // New syntax for PHP 3/4
/* Good to use for simple running errors  */

error_reporting  (15); // Old syntax, PHP 2/3
error_reporting (E_ERROR | E_WARNING | E_PARSE | E_NOTICE); // New syntax for PHP 3/4
/*  good for code authoring to report uninitialized or (possibly mis-spelled) 
variables */

error_reporting (63); // Old syntax, PHP 2/3
error_reporting (E_ALL); // New syntax for PHP 3/4
/* report all PHP errors */
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.restore-error-handler">
   <refnamediv>
    <refname>restore_error_handler</refname>
    <refpurpose>
     Restores the previous error handler function
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>restore_error_handler</function></funcdef>
      <paramdef>void</paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Used after changing the error handler function using
     <function>set_error_handler</function>, to revert to the previous error
     handler (which could be the built-in or a user defined function)
    </para>
    <para>
     See also <function>error_reporting</function>,
     <function>set_error_handler</function>,
     <function>trigger_error</function>, <function>user_error</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.set-error-handler">
   <refnamediv>
    <refname>set_error_handler</refname>
    <refpurpose>
     Sets a user-defined error handler function.  
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>set_error_handler</function></funcdef>
      <paramdef>string <parameter>error_handler</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets a user function (<parameter>error_handler</parameter>) to handle
     errors in a script.  Returns the previously defined error handler (if
     any), or false on error.  This function can be used for defining your own
     way of handling errors during runtime, for example in applications in
     which you need to do cleanup of data/files when a critical error happens,
     or when you need to trigger an error under certain conditions (using
     <function>trigger_error</function>)
    </para>
    <para>
     The user function needs to accept 2 parameters: the error code, and a
     string describing the error. From PHP 4.0.2, an additional 3 optional
     parameters are supplied: the filename in which the error occured, the
     line number in which the error occured, and the context in which the
     error occured (an array that points to the active symbol table at the
     point the error occurred).
    </para>
    <para>
     The example below shows the handling of 
     internal execptions by triggering errors and handling them with a user
     defined function:
     <example>
      <title>
       Error handling with <function>set_error_handler</function> and
       <function>trigger_error</function>
      </title>
      <programlisting role="php">
&lt;?php

// redefine the user error constants - PHP 4 only
define (FATAL,E_USER_ERROR);
define (ERROR,E_USER_WARNING);
define (WARNING,E_USER_NOTICE);

// set the error reporting level for this script
error_reporting (FATAL | ERROR | WARNING);

// error handler function
function myErrorHandler ($errno, $errstr, $errfile, $errline) {
  switch ($errno) {
  case FATAL:
    echo &quot;&lt;b&gt;FATAL&lt;/b&gt; [$errno] $errstr&lt;br&gt;\n&quot;;
    echo &quot;  Fatal error in line &quot;.$errline.&quot; of file &quot;.$errfile;
    echo &quot;, PHP &quot;.PHP_VERSION.&quot; 
(&quot;.PHP_OS.&quot;)&lt;br&gt;\n&quot;;
    echo &quot;Aborting...&lt;br&gt;\n&quot;;
    exit -1;
    break;
  case ERROR:
    echo &quot;&lt;b&gt;ERROR&lt;/b&gt; [$errno] $errstr&lt;br&gt;\n&quot;;
    break;
  case WARNING:
    echo &quot;&lt;b&gt;WARNING&lt;/b&gt; [$errno] $errstr&lt;br&gt;\n&quot;;
    break;
    default:
    echo &quot;Unkown error type: [$errno] $errstr&lt;br&gt;\n&quot;;
    break;
  }
}

// function to test the error handling
function scale_by_log ($vect, $scale) {
  if ( !is_numeric($scale) || $scale &lt;= 0 )
    trigger_error(&quot;log(x) for x &lt;= 0 is undefined, you used: scale = 
$scale&quot;,
      FATAL);
  if (!is_array($vect)) {
    trigger_error(&quot;Incorrect input vector, array of values expected&quot;, ERROR);
    return null;
  }
  for ($i=0; $i&lt;count($vect); $i++) {
    if (!is_numeric($vect[$i]))
      trigger_error(&quot;Value at position $i is not a number, using 0 (zero)&quot;, 
        WARNING);
    $temp[$i] = log($scale) * $vect[$i];
  }
  return $temp;
}

// set to the user defined error handler
$old_error_handler = set_error_handler(&quot;myErrorHandler&quot;);

// trigger some errors, first define a mixed array with a non-numeric item
echo &quot;vector a\n&quot;;
$a = array(2,3,&quot;foo&quot;,5.5,43.3,21.11);
print_r($a);

// now generate second array, generating a warning
echo &quot;----\nvector b - a warning (b = log(PI) * a)\n&quot;;
$b = scale_by_log($a, M_PI);
print_r($b);

// this is trouble, we pass a string instead of an array
echo &quot;----\nvector c - an error\n&quot;;
$c = scale_by_log(&quot;not array&quot;,2.3);
var_dump($c);

// this is a critical error, log of zero or negative number is undefined
echo &quot;----\nvector d - fatal error\n&quot;;
$d = scale_by_log($a, -2.5);

?&gt;
      </programlisting>
     </example>
     And when you run this sample script, the output will be
     <informalexample>
      <programlisting>
vector a
Array
(
    [0] =&gt; 2
    [1] =&gt; 3
    [2] =&gt; foo
    [3] =&gt; 5.5
    [4] =&gt; 43.3
    [5] =&gt; 21.11
)
----
vector b - a warning (b = log(PI) * a)
&lt;b&gt;WARNING&lt;/b&gt; [1024] Value at position 2 is not a number, using 0 
(zero)&lt;br&gt;
Array
(
    [0] =&gt; 2.2894597716988
    [1] =&gt; 3.4341896575482
    [2] =&gt; 0
    [3] =&gt; 6.2960143721717
    [4] =&gt; 49.566804057279
    [5] =&gt; 24.165247890281
)
----
vector c - an error
&lt;b&gt;ERROR&lt;/b&gt; [512] Incorrect input vector, array of values 
expected&lt;br&gt;
NULL
----
vector d - fatal error
&lt;b&gt;FATAL&lt;/b&gt; [256] log(x) for x &lt;= 0 is undefined, you used: scale = 
-2.5&lt;br&gt;
  Fatal error in line 36 of file trigger_error.php, PHP 4.0.2 (Linux)&lt;br&gt;
Aborting...&lt;br&gt;
      </programlisting>
     </informalexample>
    </para>
    <para>
     It is important to remember that the standard PHP error handler is completely
     bypassed. <function>error_reporting</function> settings will have no effect
     and your error handler will be called regardless - however you are still
     able to read the current value of <function>error_reporting</function> and
     act appropriately. Of particular note is that this value will be 0 if the
     statement that caused the error was prepended by the
     <link linkend="language.operators.errorcontrol">@ error-control
     operator</link>.
    </para>
    <para>
     Also note that it is your responsibility to <function>die</function> if
     necessary. If the error-handler function returns, script execution
     will continue with the next statement after the one that caused an error.
    </para>
    <para>
     See also <function>error_reporting</function>,
     <function>restore_error_handler</function>,
     <function>trigger_error</function>, <function>user_error</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.trigger-error">
   <refnamediv>
    <refname>trigger_error</refname>
    <refpurpose>
     Generates a user-level error/warning/notice message
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>trigger_error</function></funcdef>
      <paramdef>string <parameter>error_msg</parameter></paramdef>
      <paramdef>int
       <parameter><optional>error_type</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Used to trigger a user error condition, it can be used by in conjunction
     with the built-in error handler, or with a user defined function that has
     been set as the new error handler
     (<function>set_error_handler</function>). It only works with the E_USER
     family of constants, and will default to <constant>E_USER_NOTICE</constant>.
    </para>
    <para>
      This function is useful when
     you need to generate a particular response to an exception at runtime.
     For example:
     <informalexample>
      <programlisting>
if (assert ($divisor == 0))
   trigger_error ("Cannot divide by zero", E_USER_ERROR);
      </programlisting>
     </informalexample>
     <note>
     <para>
     See <function>set_error_handler</function> for a more extensive example.
     </para>
     </note>
    </para>
    <para>
     See also <function>error_reporting</function>,
     <function>set_error_handler</function>,
     <function>restore_error_handler</function>, 
     <function>user_error</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.user-error">
   <refnamediv>
    <refname>user_error</refname>
    <refpurpose>
     Generates a user-level error/warning/notice message
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>user_error</function></funcdef>
      <paramdef>string <parameter>error_msg</parameter></paramdef>
      <paramdef>int
       <parameter><optional>error_type</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This is an alias for the function <function>trigger_error</function>.
    </para>
    <para>
     See also <function>error_reporting</function>,
     <function>set_error_handler</function>,
     <function>restore_error_handler</function>, and
     <function>trigger_error</function>
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->


Index: phpdoc/kr/functions/exec.xml
+++ phpdoc/kr/functions/exec.xml
 <reference id="ref.exec">
  <title>Program Execution functions</title>
  <titleabbrev>Program Execution</titleabbrev>

  <refentry id="function.escapeshellarg">
   <refnamediv>
    <refname>escapeshellarg</refname>
    <refpurpose>escape a string to be used as a shell argument</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>escapeshellarg</function></funcdef>
      <paramdef>string <parameter>arg</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>EscapeShellArg</function> adds single quotes around a string
         and quotes/escapes any existing single quotes allowing you to pass a
         string directly to a shell function and having it be treated as a single
         safe argument.  This function should be used to escape individual
         arguments to shell functions coming from user input.  The shell functions
         include <function>exec</function>, <function>system</function> and the 
         <link linkend="language.operators.execution">backtick operator</link>. 
         A standard use would be:</para>
    <para>
     <informalexample>
      <programlisting role="php">
system("ls ".EscapeShellArg($dir))
      </programlisting>
     </informalexample>
    </para>
    <para>
     See also <function>exec</function>, <function>popen</function>,
     <function>system</function>, and the <link
     linkend="language.operators.execution">backtick operator</link>.
    </para>

   </refsect1>
  </refentry>

  <refentry id="function.escapeshellcmd">
   <refnamediv>
    <refname>escapeshellcmd</refname>
    <refpurpose>escape shell metacharacters</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>escapeshellcmd</function></funcdef>
      <paramdef>string <parameter>command</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>EscapeShellCmd</function> escapes any characters in a
     string that might be used to trick a shell command into executing
     arbitrary commands.  This function should be used to make sure
     that any data coming from user input is escaped before this data
     is passed to the <function>exec</function> or
     <function>system</function> functions, or to the <link
     linkend="language.operators.execution">backtick
     operator</link>. A standard use would be:</para>
    <para>
     <informalexample>
      <programlisting role="php">
$e = EscapeShellCmd($userinput);
system("echo $e"); // here we don't care if $e has spaces
$f = EscapeShellCmd($filename);
system("touch \"/tmp/$f\"; ls -l \"/tmp/$f\""); // and here we do, so we use quotes
      </programlisting>
     </informalexample>
    </para>
    <para>
     See also <function>escapeshellarg</function>, <function>exec</function>, 
         <function>popen</function>, <function>system</function>, and the <link
     linkend="language.operators.execution">backtick operator</link>.
    </para>

   </refsect1>
  </refentry>

  <refentry id="function.exec">
   <refnamediv>
    <refname>exec</refname>
    <refpurpose>Execute an external program</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>exec</function></funcdef>
      <paramdef>string <parameter>command</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>array</optional>
       </parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>return_var</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>exec</function> executes the given
     <parameter>command</parameter>, however it does not output
     anything.  It simply returns the last line from the result of the
     command.  If you need to execute a command and have all the data
     from the command passed directly back without any interference,
     use the <function>PassThru</function> function.
    </para>
    <para>
     If the <parameter>array</parameter> argument is present, then the
     specified array will be filled with every line of output from the
     command.  Note that if the array already contains some elements,
     <function>exec</function> will append to the end of the array.
     If you do not want the function to append elements, call
     <function>unset</function> on the array before passing it to
     <function>exec</function>.
    </para>
    <para>
     If the <parameter>return_var</parameter> argument is present
     along with the <parameter>array</parameter> argument, then the
     return status of the executed command will be written to this
     variable.
    </para>
    <para>
     Note that if you are going to allow data coming from user input
     to be passed to this function, then you should be using
     <function>EscapeShellCmd</function> to make sure that users
     cannot trick the system into executing arbitrary commands.
    </para>
    <para>
     Note also that if you start a program using this function and
     want to leave it running in the background, you have to make
     sure that the output of that program is redirected to a file or
     some other output stream or else PHP will hang until the
     execution of the program ends.
    </para>
    <para>
     See also <function>system</function>,
     <function>PassThru</function>, <function>popen</function>,
     <function>EscapeShellCmd</function>, and the <link
     linkend="language.operators.execution">backtick operator</link>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.passthru">
   <refnamediv>
    <refname>passthru</refname>
    <refpurpose>
     Execute an external program and display raw output
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>passthru</function></funcdef>
      <paramdef>string <parameter>command</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>return_var</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>passthru</function> function is similar to the
     <function>Exec</function> function in that it executes a
     <parameter>command</parameter>.  If the
     <parameter>return_var</parameter> argument is present, the return
     status of the Unix command will be placed here.  This function
     should be used in place of <function>Exec</function> or
     <function>System</function> when the output from the Unix command
     is binary data which needs to be passed directly back to the
     browser.  A common use for this is to execute something like the
     pbmplus utilities that can output an image stream directly.  By
     setting the content-type to <emphasis>image/gif</emphasis> and
     then calling a pbmplus program to output a gif, you can create
     PHP scripts that output images directly.</para>
    <para>
     Note that if you start a program using this function and want to
     leave it running in the background, you have to make sure that the
     output of that program is redirected to a file or some other
     output stream or else PHP will hang until the execution of the
     program ends.
    </para>
    <para>
     See also <function>exec</function>, <function>system</function>,
     <function>popen</function>, <function>EscapeShellCmd</function>,
     and the <link linkend="language.operators.execution">backtick
     operator</link>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.system">
   <refnamediv>
    <refname>system</refname>
    <refpurpose>Execute an external program and display output</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>system</function></funcdef>
      <paramdef>string <parameter>command</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>return_var</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>System</function> is just like the C version of the
     function in that it executes the given
     <parameter>command</parameter> and outputs the result.  If a
     variable is provided as the second argument, then the return
     status code of the executed command will be written to this
     variable.
    </para>
    <para>
     Note, that if you are going to allow data coming from user input
     to be passed to this function, then you should be using the
     <function>EscapeShellCmd</function> function to make sure that
     users cannot trick the system into executing arbitrary
     commands.
    </para>
    <para>
     Note also that if you start a program using this function and want
     to leave it running in the background, you have to make sure that
     the output of that program is redirected to a file or some other
     output stream or else PHP will hang until the execution of the
     program ends.
    </para>
    <para>
     The <function>System</function> call also tries to automatically
     flush the web server's output buffer after each line of output if
     PHP is running as a server module.
    </para>
    <para>
     Returns the last line of the command output on success, and false
     on failure.
    </para>
    <para>
     If you need to execute a command and have all the data from the
     command passed directly back without any interference, use the
     <function>PassThru</function> function.
    </para>
    <para>
     See also <function>exec</function>,
     <function>PassThru</function>, <function>popen</function>,
     <function>EscapeShellCmd</function>, and the <link
     linkend="language.operators.execution">backtick operator</link>.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/fdf.xml
+++ phpdoc/kr/functions/fdf.xml
 <reference id="ref.fdf">
  <title>Forms Data Format functions</title>
  <titleabbrev>FDF</titleabbrev>

  <partintro>

   <simpara>
    Forms Data Format (FDF) is a format for handling
    forms within PDF documents. You should read the documentation at 
                  <ulink url="&spec.pdf.fdf;">&spec.pdf.fdf;</ulink>
    for more information on what FDF is and how it is used in general.
   </simpara>

   <note><simpara>
    If you run into problems configuring php with fdftk support, check
    whether the header file FdfTk.h and the library libFdfTk.so are at
    the right place. They should be in fdftk-dir/include and
    fdftk-dir/lib. This will not be the case if you just unpack
    the FdfTk distribution.
   </simpara></note>

   <simpara>
    The general idea of FDF is similar to HTML forms. The diffence is
    basically the format how data is transmitted to the server when the submit
    button is pressed (this is actually the Form Data Format) and the format
    of the form itself (which is the Portable Document Format, PDF).
    Processing the FDF data is one of the features provided by the fdf
    functions. But there is more.  One may as well take an existing PDF form
    and populated the input fields with data without modifying the form
    itself. In such a case one would create a FDF document
    (<function>fdf_create</function>) set the values of each input field
    (<function>fdf_set_value</function>) and associate it with a PDF form
    (<function>fdf_set_file</function>). Finally it has to be sent to the
    browser with MimeType <literal>application/vnd.fdf</literal>. The Acrobat
    reader plugin of your browser recognizes the MimeType,  reads the
    associated PDF form and fills in the data from the FDF document.
   </simpara>

   <simpara>
    If you look at an FDF-document with a text editor you will find a
    catalogue object with the name <literal>FDF</literal>. Such an object may
    contain a number of entries like <literal>Fields</literal>,
    <literal>F</literal>, <literal>Status</literal> etc..
    The most commonly used entries are <literal>Fields</literal> whicht points
    to a list of input fields, and <literal>F</literal> which contains the
    filename of the PDF-document this data belongs to. Those entries are
    referred to in the FDF documention as /F-Key or /Status-Key.
    Modifying this entries
    is done by functions like <function>fdf_set_file</function> and
    <function>fdf_set_status</function>. Fields are modified with
    <function>fdf_set_value</function>, <function>fdf_set_opt</function> etc..
   </simpara>
   <simpara>
    The following examples shows just the evaluation of form data.</simpara>
   <simpara></simpara>
    <example>
     <title>Evaluating a FDF document</title>
     <programlisting>
&lt;?php
// Save the FDF data into a temp file
$fdffp = fopen("test.fdf", "w");
fwrite($fdffp, $HTTP_FDF_DATA, strlen($HTTP_FDF_DATA));
fclose($fdffp);

// Open temp file and evaluate data
// The pdf form contained several input text fields with the names
// volume, date, comment, publisher, preparer, and two checkboxes
// show_publisher and show_preparer.
$fdf = fdf_open("test.fdf");
$volume = fdf_get_value($fdf, "volume");
echo "The volume field has the value '&lt;B>$volume&lt;/B>'&lt;BR>";

$date = fdf_get_value($fdf, "date");
echo "The date field has the value '&lt;B>$date&lt;/B>'&lt;BR>";

$comment = fdf_get_value($fdf, "comment");
echo "The comment field has the value '&lt;B>$comment&lt;/B>'&lt;BR>";

if(fdf_get_value($fdf, "show_publisher") == "On") {
  $publisher = fdf_get_value($fdf, "publisher");
  echo "The publisher field has the value '&lt;B>$publisher&lt;/B>'&lt;BR>";
} else
  echo "Publisher shall not be shown.&lt;BR>";

if(fdf_get_value($fdf, "show_preparer") == "On") {
  $preparer = fdf_get_value($fdf, "preparer");
  echo "The preparer field has the value '&lt;B>$preparer&lt;/B>'&lt;BR>";
} else
  echo "Preparer shall not be shown.&lt;BR>";
fdf_close($fdf);
?>
     </programlisting>
    </example>

  </partintro>

  <refentry id="function.fdf-open">
   <refnamediv>
    <refname>fdf_open</refname>
    <refpurpose>Open a FDF document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>fdf_open</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>fdf_open</function> function opens
     a file with form data. This file must contain the data as returned
     from a PDF form. Currently, the file has to be created 'manually'
     by using <function>fopen</function> and writing the content
     of HTTP_FDF_DATA with <function>fwrite</function> into it.
     A mechanism like for HTML form data where for each input
     field a variable is created does not exist.</para>

    <para>
    <example>
     <title>Accessing the form data</title>
     <programlisting>
&lt;?php
// Save the FDF data into a temp file
$fdffp = fopen("test.fdf", "w");
fwrite($fdffp, $HTTP_FDF_DATA, strlen($HTTP_FDF_DATA));
fclose($fdffp);

// Open temp file and evaluate data
$fdf = fdf_open("test.fdf");
..
fdf_close($fdf);
?>
     </programlisting>
    </example></para>

    <para>
     See also <function>fdf_close</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.fdf-close">
   <refnamediv>
    <refname>fdf_close</refname>
    <refpurpose>Close an FDF document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>fdf_close</function></funcdef>
      <paramdef>int <parameter>fdf_document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>fdf_close</function> function closes the FDF document.</para>

    <para>
     See also <function>fdf_open</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.fdf-create">
   <refnamediv>
    <refname>fdf_create</refname>
    <refpurpose>Create a new FDF document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>fdf_create</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>fdf_create</function> creates a new
     FDF document. This function is needed if one would like to
     populate input fields in a PDF document with data.</para>
    <para>
    <example>
     <title>Populating a PDF document</title>
     <programlisting>
&lt;?php
$outfdf = fdf_create();
fdf_set_value($outfdf, "volume", $volume, 0);

fdf_set_file($outfdf, "http:/testfdf/resultlabel.pdf");
fdf_save($outfdf, "outtest.fdf");
fdf_close($outfdf);
Header("Content-type: application/vnd.fdf");
$fp = fopen("outtest.fdf", "r");
fpassthru($fp);
unlink("outtest.fdf");
?>
     </programlisting>
    </example></para>

    <para>
     See also <function>fdf_close</function>,
              <function>fdf_save</function>,
              <function>fdf_open</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.fdf-save">
   <refnamediv>
    <refname>fdf_save</refname>
    <refpurpose>Save a FDF document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>fdf_save</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>fdf_save</function> function saves
     a FDF document.
     The FDF Toolkit provides a way to output the document to stdout if
     the parameter <parameter>filename</parameter>
     is '.'. This does not work if PHP is used as an apache module.
     In such a case one will have to write to a file and use e.g.
     <function>fpassthru</function>. to output it.</para>

    <para>
     See also <function>fdf_close</function> and example for
              <function>fdf_create</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.fdf-get-value">
   <refnamediv>
    <refname>fdf_get_value</refname>
    <refpurpose>Get the value of a field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>fdf_get_value</function></funcdef>
      <paramdef>int <parameter>fdf_document</parameter></paramdef>
      <paramdef>string <parameter>fieldname</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>fdf_get_value</function> function returns the
     value of a field.</para>

    <para>
     See also <function>fdf_set_value</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.fdf-set-value">
   <refnamediv>
    <refname>fdf_set_value</refname>
    <refpurpose>Set the value of a field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>fdf_set_value</function></funcdef>
      <paramdef>int <parameter>fdf_document</parameter></paramdef>
      <paramdef>string <parameter>fieldname</parameter></paramdef>
      <paramdef>string <parameter>value</parameter></paramdef>
      <paramdef>int <parameter>isName</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>fdf_set_value</function> function sets the
     value of a field. The last parameter determines if the field value
     is to be converted to a PDF Name (<parameter>isName</parameter> = 1)
     or set to a PDF String (<parameter>isName</parameter> = 0).</para>

    <para>
     See also <function>fdf_get_value</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.fdf-next-field-name">
   <refnamediv>
    <refname>fdf_next_field_name</refname>
    <refpurpose>Get the next field name</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>fdf_next_field_name</function></funcdef>
      <paramdef>int <parameter>fdf_document</parameter></paramdef>
      <paramdef>string <parameter>fieldname</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>fdf_next_field_name</function> function returns the
     name of the field after the field in
     <parameter>fieldname</parameter> or the field name of the first field
     if the second paramter is NULL.</para>

    <para>
     See also <function>fdf_set_field</function>,
              <function>fdf_get_field</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.fdf-set-ap">
   <refnamediv>
    <refname>fdf_set_ap</refname>
    <refpurpose>Set the appearance of a field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>fdf_set_ap</function></funcdef>
      <paramdef>int <parameter>fdf_document</parameter></paramdef>
      <paramdef>string <parameter>field_name</parameter></paramdef>
      <paramdef>int <parameter>face</parameter></paramdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
      <paramdef>int <parameter>page_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>fdf_set_ap</function> function sets the
     appearance of a field (i.e. the value of the /AP key).
     The possible values of <parameter>face</parameter>
     are 1=FDFNormalAP, 2=FDFRolloverAP, 3=FDFDownAP.</para>

   </refsect1>
  </refentry>

  <refentry id="function.fdf-set-status">
   <refnamediv>
    <refname>fdf_set_status</refname>
    <refpurpose>Set the value of the /STATUS key</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>fdf_set_status</function></funcdef>
      <paramdef>int <parameter>fdf_document</parameter></paramdef>
      <paramdef>string <parameter>status</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>fdf_set_status</function> sets the value
     of the /STATUS key.</para>

    <para>
     See also <function>fdf_get_status</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.fdf-get-status">
   <refnamediv>
    <refname>fdf_get_status</refname>
    <refpurpose>Get the value of the /STATUS key</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>fdf_get_status</function></funcdef>
      <paramdef>int <parameter>fdf_document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>fdf_get_status</function> returns the value
     of the /STATUS key.</para>

    <para>
     See also <function>fdf_set_status</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.fdf-set-file">
   <refnamediv>
    <refname>fdf_set_file</refname>
    <refpurpose>Set the value of the /F key</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>fdf_set_file</function></funcdef>
      <paramdef>int <parameter>fdf_document</parameter></paramdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>fdf_set_file</function> sets the value
     of the /F key. The /F key is just a reference to a PDF form
     which is to be populated with data.
     In a web environment it is a URL (e.g. http:/testfdf/resultlabel.pdf).</para>

    <para>
     See also <function>fdf_get_file</function> and example for
              <function>fdf_create</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.fdf-get-file">
   <refnamediv>
    <refname>fdf_get_file</refname>
    <refpurpose>Get the value of the /F key</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>fdf_get_file</function></funcdef>
      <paramdef>int <parameter>fdf_document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>fdf_set_file</function> returns the value
     of the /F key.</para>

    <para>
     See also <function>fdf_set_file</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.fdf-set-flags">
   <refnamediv>
    <refname>fdf_set_flags</refname>
    <refpurpose>Sets a flag of a field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>fdf_set_flags</function></funcdef>
      <paramdef>int <parameter>fdf_document</parameter></paramdef>
      <paramdef>string <parameter>fieldname</parameter></paramdef>
      <paramdef>int <parameter>whichFlags</parameter></paramdef>
      <paramdef>int <parameter>newFlags</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>fdf_set_flags</function> sets certain flags
     of the given field <parameter>fieldname</parameter>.
    </para>
    <para>
     See also <function>fdf_set_opt</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.fdf-set-opt">
   <refnamediv>
    <refname>fdf_set_opt</refname>
    <refpurpose>Sets an option of a field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>fdf_set_opt</function></funcdef>
      <paramdef>int <parameter>fdf_document</parameter></paramdef>
      <paramdef>string <parameter>fieldname</parameter></paramdef>
      <paramdef>int <parameter>element</parameter></paramdef>
      <paramdef>string <parameter>str1</parameter></paramdef>
      <paramdef>string <parameter>str2</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>fdf_set_opt</function> sets options 
     of the given field <parameter>fieldname</parameter>.
    </para>
    <para>
     See also <function>fdf_set_flags</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.fdf-set-submit-form-action">
   <refnamediv>
    <refname>fdf_set_submit_form_action</refname>
    <refpurpose>Sets an javascript action of a field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>fdf_set_submit_form_action</function></funcdef>
      <paramdef>int <parameter>fdf_document</parameter></paramdef>
      <paramdef>string <parameter>fieldname</parameter></paramdef>
      <paramdef>int <parameter>trigger</parameter></paramdef>
      <paramdef>string <parameter>script</parameter></paramdef>
      <paramdef>int <parameter>flags</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>fdf_set_submit_form_action</function> sets a submit form
     action for the given field <parameter>fieldname</parameter>.
    </para>
    <para>
     See also <function>fdf_set_javascript_action</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.fdf-set-javascript-action">
   <refnamediv>
    <refname>fdf_set_javascript_action</refname>
    <refpurpose>Sets an javascript action of a field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>fdf_set_javascript_action</function></funcdef>
      <paramdef>int <parameter>fdf_document</parameter></paramdef>
      <paramdef>string <parameter>fieldname</parameter></paramdef>
      <paramdef>int <parameter>trigger</parameter></paramdef>
      <paramdef>string <parameter>script</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>fdf_set_javascript_action</function> sets a javascript
     action for the given field <parameter>fieldname</parameter>.
    </para>
    <para>
     See also <function>fdf_set_submit_form_action</function>.
    </para>
   </refsect1>
  </refentry>
 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
 -->

Index: phpdoc/kr/functions/filepro.xml
+++ phpdoc/kr/functions/filepro.xml
 <reference id="ref.filepro">
  <title>filePro functions</title>
  <titleabbrev>filePro</titleabbrev>

  <partintro>
   <simpara>
    These functions allow read-only access to data stored in filePro 
databases.</simpara>
   <simpara>
    filePro is a registered trademark of Fiserv, Inc. You can find more
    information about filePro at <ulink 
url="&url.filepro;">&url.filepro;</ulink>.</simpara>  
  </partintro>

  <refentry id="function.filepro">
   <refnamediv>
    <refname>filepro</refname>
    <refpurpose>read and verify the map file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>filepro</function></funcdef>
      <paramdef>string <parameter>directory</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This reads and verifies the map file, storing the field count
     and info.</para>
    <para>
     No locking is done, so you should avoid modifying your filePro
     database while it may be opened in PHP.</para>
   </refsect1>
  </refentry>

  <refentry id="function.filepro-fieldname">
   <refnamediv>
    <refname>filepro_fieldname</refname>
    <refpurpose>gets the name of a field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>filepro_fieldname</function></funcdef>
      <paramdef>int <parameter>field_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the name of the field corresponding to 
<parameter>field_number</parameter>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.filepro-fieldtype">
   <refnamediv>
    <refname>filepro_fieldtype</refname>
    <refpurpose>gets the type of a field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>filepro_fieldtype</function></funcdef>
      <paramdef>int <parameter>field_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the edit type of the field corresponding to 
<parameter>field_number</parameter>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.filepro-fieldwidth">
   <refnamediv>
    <refname>filepro_fieldwidth</refname>
    <refpurpose>gets the width of a field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>filepro_fieldwidth</function></funcdef>
      <paramdef>int <parameter>field_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the width of the field corresponding to 
<parameter>field_number</parameter>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.filepro-retrieve">
   <refnamediv>
    <refname>filepro_retrieve</refname>
    <refpurpose>retrieves data from a filePro database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>filepro_retrieve</function></funcdef>
      <paramdef>int <parameter>row_number</parameter></paramdef>
      <paramdef>int <parameter>field_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the data from the specified location in the database.</para>
   </refsect1>
  </refentry>

  <refentry id="function.filepro-fieldcount">
   <refnamediv>
    <refname>filepro_fieldcount</refname>
    <refpurpose>find out how many fields are in a filePro database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>filepro_fieldcount</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
        Returns the number of fields (columns) in the opened filePro
        database.</para>
    <para>
     See also <function>filepro</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.filepro-rowcount">
   <refnamediv>
    <refname>filepro_rowcount</refname>
    <refpurpose>find out how many rows are in a filePro database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>filepro_rowcount</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the number of rows in the opened filePro database.</para>
    <para>
     See also <function>filepro</function>.</para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/filesystem.xml
+++ phpdoc/kr/functions/filesystem.xml
 <reference id="ref.filesystem">
  <title>Filesystem functions</title>
  <titleabbrev>Filesystem</titleabbrev>

  <refentry id="function.basename">
   <refnamediv>
    <refname>basename</refname>
    <refpurpose>
     Returns filename component of path
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>basename</function></funcdef>
      <paramdef>string <parameter>path</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Given a string containing a path to a file, this function will
     return the base name of the file.
    </para>
    <para>
     On Windows, both slash (<literal>/</literal>) and backslash
     (<literal>\</literal>) are used as path separator character.  In
     other environments, it is the forward slash
     (<literal>/</literal>).
    </para>
    <para>
     <example>
      <title><function>basename</function> example</title>
      <programlisting role="php">
$path = "/home/httpd/html/index.php3";
$file = basename ($path); // $file is set to "index.php3"
      </programlisting>
     </example>
    </para>
    <para>
     See also: <function>dirname</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.chgrp">
   <refnamediv>
    <refname>chgrp</refname>
    <refpurpose>Changes file group</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>chgrp</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
      <paramdef>mixed <parameter>group</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Attempts to change the group of the file
     <parameter>filename</parameter> to
     <parameter>group</parameter>. Only the superuser may change the
     group of a file arbitrarily; other users may change the group of
     a file to any group of which that user is a member.
    </para>
    <para>
     Returns true on success; otherwise returns false.
    </para>
    <para>
     See also <function>chown</function> and
     <function>chmod</function>.
    </para>
    <note>
     <simpara>
      This function does not work on Windows systems
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.chmod">
   <refnamediv>
    <refname>chmod</refname>
    <refpurpose>Changes file mode</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>chmod</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Attempts to change the mode of the file specified by
     <parameter>filename</parameter> to that given in
     <parameter>mode</parameter>.
    </para>
    <para>
     Note that <parameter>mode</parameter> is not automatically
     assumed to be an octal value, so strings (such as "g+w") will
     not work properly. To ensure the expected operation,
     you need to prefix <parameter>mode</parameter> with a zero (0):
     <informalexample>
      <programlisting role="php">
chmod ("/somedir/somefile", 755);   // decimal; probably incorrect   
chmod ("/somedir/somefile", "u+rwx,go+rx"); // string; incorrect       
chmod ("/somedir/somefile", 0755);  // octal; correct value of mode
      </programlisting>
     </informalexample>
    </para>
    <para>
     Returns true on success and false otherwise.
    </para>
    <para>
     See also <function>chown</function> and
     <function>chgrp</function>.
    </para>
    <note>
     <simpara>
      This function does not work on Windows systems
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.chown">
   <refnamediv>
    <refname>chown</refname>
    <refpurpose>Changes file owner</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>chown</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
      <paramdef>mixed <parameter>user</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Attempts to change the owner of the file filename to user
     user. Only the superuser may change the owner of a file.
    </para>
    <para>
     Returns true on success; otherwise returns false.
    </para>
    <para>
     See also <function>chown</function> and
     <function>chmod</function>.
    </para>
    <note>
     <simpara>
     This function does not work on Windows systems
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.clearstatcache">
   <refnamediv>
    <refname>clearstatcache</refname>
    <refpurpose>Clears file stat cache</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>clearstatcache</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     Invoking the <systemitem>stat</systemitem> or
     <systemitem>lstat</systemitem> system call on most systems is
     quite expensive. Therefore, the result of the last call to any of
     the status functions (listed below) is stored for use on the next
     such call using the same filename. If you wish to force a new
     status check, for instance if the file is being checked many
     times and may change or disappear, use this function to clear the
     results of the last call from memory.
    </para>
    <para>
     This value is only cached for the lifetime of a single request.
    </para>
    <para>
     Affected functions include <function>stat</function>,
     <function>lstat</function>,
     <function>file_exists</function>,
     <function>is_writable</function>,
     <function>is_readable</function>,
     <function>is_executable</function>,
     <function>is_file</function>,
     <function>is_dir</function>,
     <function>is_link</function>,
     <function>filectime</function>,
     <function>fileatime</function>,
     <function>filemtime</function>,
     <function>fileinode</function>,
     <function>filegroup</function>,
     <function>fileowner</function>,
     <function>filesize</function>,
     <function>filetype</function>, and
     <function>fileperms</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.copy">
   <refnamediv>
    <refname>copy</refname>
    <refpurpose>Copies file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>copy</function></funcdef>
      <paramdef>string <parameter>source</parameter></paramdef>
      <paramdef>string <parameter>dest</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Makes a copy of a file.  Returns true if the copy succeeded,
     false otherwise.
     <example>
      <title><function>Copy</function> example</title>
      <programlisting role="php">
if (!copy($file, $file.'.bak')) {
    print ("failed to copy $file...&lt;br>\n");
}
      </programlisting>
     </example>
    </para>
    <para>
     See also: <function>rename</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.delete">
   <refnamediv>
    <refname>delete</refname>
    <refpurpose>A dummy manual entry</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>delete</function></funcdef>
      <paramdef>string <parameter>file</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This is a dummy manual entry to satisfy those people who are
     looking for <function>unlink</function> or
     <function>unset</function> in the wrong place.
    </para>
    <para>
     See also: <function>unlink</function> to delete files,
     <function>unset</function> to delete variables.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dirname">
   <refnamediv>
    <refname>dirname</refname>
    <refpurpose>Returns directory name component of path</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>dirname</function></funcdef>
      <paramdef>string <parameter>path</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Given a string containing a path to a file, this function will
     return the name of the directory.</para>
    <para>
     On Windows, both slash (<literal>/</literal>) and backslash
     (<literal>\</literal>) are used as path separator character.  In
     other environments, it is the forward slash
     (<literal>/</literal>).</para>
    <para>
     <example>
      <title><function>Dirname</function> example</title>
      <programlisting role="php">
$path = "/etc/passwd";
$file = dirname ($path); // $file is set to "/etc"
      </programlisting>
     </example>
    </para>
    <para>
     See also: <function>basename</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.diskfreespace">
   <refnamediv>
    <refname>diskfreespace</refname>
    <refpurpose>Returns available space in directory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>float <function>diskfreespace</function></funcdef>
      <paramdef>string <parameter>directory</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Given a string containing a directory, this function will return
     the number of bytes available on the corresponding filesystem or
     disk partition.
    </para>
    <para>
     <example>
      <title><function>diskfreespace</function> example</title>
      <programlisting role="php">
$df = diskfreespace("/"); // $df contains the number of bytes 
                          // available on "/"
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.fclose">
   <refnamediv>
    <refname>fclose</refname>
    <refpurpose>Closes an open file pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>fclose</function></funcdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The file pointed to by fp is closed.
    </para>
    <para>
     Returns true on success and false on failure.
    </para>
    <para>
     The file pointer must be valid, and must point to a file
     successfully opened by <function>fopen</function> or
     <function>fsockopen</function>.
    </para> 
   </refsect1>
  </refentry>

  <refentry id="function.feof">
   <refnamediv>
    <refname>feof</refname>
    <refpurpose>Tests for end-of-file on a file pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>feof</function></funcdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true if the file pointer is at EOF or an error occurs;
     otherwise returns false.
    </para>
    <para>
     The file pointer must be valid, and must point to a file
     successfully opened by <function>fopen</function>,
     <function>popen</function>, or <function>fsockopen</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.fflush">
   <refnamediv>
    <refname>fflush</refname>
    <refpurpose>Flushes the output to a file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>fflush</function></funcdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function forces a write of all buffered output to the 
     to the resource pointed to by the file handle 
     <parameter>fp</parameter>. Returns true if succesful, false
     otherwise.
    </para>
    <para>
     The file pointer must be valid, and must point to a file
     successfully opened by <function>fopen</function>,
     <function>popen</function>, or <function>fsockopen</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.fgetc">
   <refnamediv>
    <refname>fgetc</refname>
    <refpurpose>Gets character from file pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>fgetc</function></funcdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string containing a single character read from the
     file pointed to by fp.  Returns FALSE on EOF.
    </para>
    <para>
     The file pointer must be valid, and must point to a file
     successfully opened by <function>fopen</function>,
     <function>popen</function>, or <function>fsockopen</function>.
    </para>
    <para> 
     See also <function>fread</function>, <function>fopen</function>,
     <function>popen</function>, <function>fsockopen</function>, and
     <function>fgets</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.fgetcsv">
   <refnamediv>
    <refname>fgetcsv</refname>
    <refpurpose>
     Gets line from file pointer and parse for CSV fields
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>fgetcsv</function></funcdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
      <paramdef>int <parameter>length</parameter></paramdef>
      <paramdef>string 
       <parameter>
        <optional>delimiter</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Similar to <function>fgets</function> except that
     <function>fgetcsv</function> parses the line it reads for fields
     in <acronym>CSV</acronym> format and returns an array containing
     the fields read.  The field delimiter is a comma, unless you
     specify another delimiter with the optional third parameter.
    </simpara>
    <simpara>
     <parameter>Fp</parameter> must be a valid file pointer to a file
     successfully opened by <function>fopen</function>,
     <function>popen</function>, or <function>fsockopen</function>
    </simpara>
    <simpara>
     Length must be greater than the longest line to be found in the
     CSV file (allowing for trailing line-end characters).
    </simpara>
    <simpara>
     <function>Fgetcsv</function> returns false on error, including
     end of file.
    </simpara>
    <simpara>
     N.B. A blank line in a CSV file will be returned as an array
     comprising a single null field, and will not be treated as an
     error.
    </simpara>
    <example>
     <title>
      <function>Fgetcsv</function> example - Read and print entire
      contents of a CSV file
     </title>
     <programlisting role="php">
$row = 1;
$fp = fopen ("test.csv","r");
while ($data = fgetcsv ($fp, 1000, ",")) {
    $num = count ($data);
    print "&lt;p&gt; $num fields in line $row: &lt;br&gt;";
    $row++;
    for ($c=0; $c&lt;$num; $c++) {
        print $data[$c] . "&lt;br&gt;";
    }
}
fclose ($fp);
     </programlisting>
    </example>
   </refsect1>
  </refentry>

  <refentry id="function.fgets">
   <refnamediv>
    <refname>fgets</refname>
    <refpurpose>Gets line from file pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>fgets</function></funcdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
      <paramdef>int <parameter>length</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string of up to length - 1 bytes read from the file
     pointed to by fp. Reading ends when length - 1 bytes have been
     read, on a newline (which is included in the return value), or on
     EOF (whichever comes first).
    </para>
    <para>
     If an error occurs, returns false.
    </para>
    <para>
     Common Pitfalls:
    </para>
    <simpara>
     People used to the 'C' semantics of fgets should note the
     difference in how EOF is returned.
    </simpara>
    <simpara>
     The file pointer must be valid, and must point to a file
     successfully opened by <function>fopen</function>,
     <function>popen</function>, or
     <function>fsockopen</function>.
    </simpara>
    <para>
     A simple example follows:
     <example> 
      <title>Reading a file line by line</title>
      <programlisting role="php">
$fd = fopen ("/tmp/inputfile.txt", "r");
while (!feof ($fd)) {
    $buffer = fgets($fd, 4096);
    echo $buffer;
}
fclose ($fd);
      </programlisting>
     </example>
    </para>
    <para> 
     See also <function>fread</function>, <function>fopen</function>,
     <function>popen</function>, <function>fgetc</function>,
     <function>fsockopen</function>, and
     <function>socket_set_timeout</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.fgetss">
   <refnamediv>
    <refname>fgetss</refname>
    <refpurpose>
     Gets line from file pointer and strip HTML tags
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>fgetss</function></funcdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
      <paramdef>int <parameter>length</parameter></paramdef>
      <paramdef>string 
       <parameter>
        <optional>allowable_tags</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Identical to <function>fgets</function>, except that fgetss
     attempts to strip any HTML and PHP tags from the text it
     reads.
    </para>
    <para>
     You can use the optional third parameter to specify tags which
     should not be stripped.
     <note>
      <para>
       <parameter>allowable_tags</parameter> was added in PHP 3.0.13,
       PHP4B3.
      </para> 
     </note>
    </para>
    <para>
     See also <function>fgets</function>, <function>fopen</function>,
     <function>fsockopen</function>, <function>popen</function>, and
     <function>strip_tags</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.file">
   <refnamediv>
    <refname>file</refname> 
    <refpurpose>Reads entire file into an array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>file</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>use_include_path</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Identical to <function>readfile</function>, except that
     <function>file</function> returns the file in an array. Each
     element of the array corresponds to a line in the file, with the
     newline still attached.
    </para>
    <para>
     You can use the optional second parameter and set it to "1", if
     you want to search for the file in the <link
     linkend="ini.include-path">include_path</link>, too.
    </para>
    <para>
     <informalexample>
      <programlisting role="php">
&lt;?php
// get a web page into an array and print it out
$fcontents = file ('http://www.php.net');
while (list ($line_num, $line) = each ($fcontents)) {
    echo "&lt;b&gt;Line $line_num:&lt;/b&gt; " . htmlspecialchars ($line) . 
"&lt;br&gt;\n";
}

// get a web page into a string
$fcontents = join ('', file ('http://www.php.net'));
?&gt;
      </programlisting>
     </informalexample>
    </para>
    <para> 
     See also <function>readfile</function>,
     <function>fopen</function>, <function>fsockopen</function>, and
     <function>popen</function>.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.file-exists">
   <refnamediv>
    <refname>file_exists</refname>
    <refpurpose>Checks whether a file exists</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>file_exists</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns true if the file specified by
     <parameter>filename</parameter> exists; false otherwise.
    </simpara>
    <simpara>
     <function>file_exists</function> will not work on remote files;
     the file to be examined must be accessible via the server's
     filesystem.
    </simpara>
    <simpara>
     The results of this function are cached. See
     <function>clearstatcache</function> for more details.
    </simpara>
   </refsect1>
  </refentry>


  <refentry id="function.fileatime">
   <refnamediv>
    <refname>fileatime</refname>
    <refpurpose>Gets last access time of file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>fileatime</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara> 
     Returns the time the file was last accessed, or false in case of
     an error. The time is returned as a Unix timestamp.
    </simpara>
    <simpara>
     The results of this function are cached. See
     <function>clearstatcache</function> for more details.
    </simpara>
    <simpara>
     Note: The atime of a file is supposed to change whenever
     the data blocks of a file are being read. This can be
     costly performancewise when an appliation regularly
     accesses a very large number of files or directories. Some
     Unix filesystems can be mounted with atime updates disabled
     to increase the performance of such applications; USENET
     news spools are a common example. On such filesystems
     this function will be useless.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.filectime">
   <refnamediv>
    <refname>filectime</refname>
    <refpurpose>Gets inode change time of file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>filectime</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the time the file was last changed, or false in case of
     an error. The time is returned as a Unix timestamp.
    </para>
    <para>
     The results of this function are cached. See
     <function>clearstatcache</function> for more details.
    </para>
    <para>Note: In most Unix filesystem, a file is considered
     changed, when it's Inode data is changed, that is, when
     the permissions, the owner, the group or other metadata
     from the Inode is written to. See also 
     <function>filemtime</function> (this is what you want to use
     when you want to create "Last Modified" footers on web pages) and 
     <function>fileatime</function>.
    </para>
    <para>Note: In some Unix texts the ctime of a file is being
     referred to as the creation time of the file. This is wrong.
     There is no creation time for Unix files in most Unix 
     filesystems.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.filegroup">
   <refnamediv>
    <refname>filegroup</refname>
    <refpurpose>Gets file group</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>filegroup</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>    
     Returns the group ID of the owner of the file, or false in case
     of an error. The group ID is returned in numerical format, use
     <function>posix_getgrgid</function> to resolve it to a group name.
    </para>
    <para>
     The results of this function are cached. See
     <function>clearstatcache</function> for more details.
    </para>
    <note>
     <simpara>
     This function does not work on Windows systems
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.fileinode">
   <refnamediv>
    <refname>fileinode</refname>
    <refpurpose>Gets file inode</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>fileinode</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns the inode number of the file, or false in case of an
     error.</para>
    <para>
     The results of this function are cached. See
     <function>clearstatcache</function> for more details.
    </para>
    <note>
     <simpara>
     This function does not work on Windows systems
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.filemtime">
   <refnamediv>
    <refname>filemtime</refname>
    <refpurpose>Gets file modification time</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>filemtime</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the time the file was last modified, or false in case of
     an error. The time is returned as a Unix timestamp.
    </para>
    <para>
     The results of this function are cached. See
     <function>clearstatcache</function> for more details.
    </para>
    <para>Note: This function returns the time when the data
     blocks of a file were being written to, that is, the time
     when the content of the file was changed. Use
     <function>date</function> on the result of this function
     to get a printable modification date for use in page footers.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.fileowner">
   <refnamediv>
    <refname>fileowner</refname>
    <refpurpose>Gets file owner</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>fileowner</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>    
     Returns the user ID of the owner of the file, or false in case of
     an error. The user ID is returned in numerical format, use
     <function>posix_getpwuid</function> to resolve it to a username.
    </para>
    <para>
     The results of this function are cached. See
     <function>clearstatcache</function> for more details.
    </para>
    <note>
     <simpara>
     This function does not work on Windows systems
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.fileperms">
   <refnamediv>
    <refname>fileperms</refname>
    <refpurpose>Gets file permissions</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>fileperms</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>    
     Returns the permissions on the file, or false in case of an error.
    </para>
    <para>
     The results of this function are cached. See
     <function>clearstatcache</function> for more details.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.filesize">
   <refnamediv>
    <refname>filesize</refname>
    <refpurpose>Gets file size</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>filesize</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns the size of the file, or false in case of an error.
    </para>
    <para>
     The results of this function are cached. See
     <function>clearstatcache</function> for more details.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.filetype">
   <refnamediv>
    <refname>filetype</refname>
    <refpurpose>Gets file type</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>filetype</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>    
     Returns the type of the file. Possible values are fifo, char,
     dir, block, link, file, and unknown.</para> <para> Returns false
     if an error occurs.
    </para>
    <para>
     The results of this function are cached. See
     <function>clearstatcache</function> for more details.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.flock">
   <refnamediv>
    <refname>flock</refname>
    <refpurpose>Portable advisory file locking</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>flock</function></funcdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
      <paramdef>int <parameter>operation</parameter></paramdef>
      <paramdef>int 
       <parameter>
        <optional>wouldblock</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     PHP supports a portable way of locking complete files in an
     advisory way (which means all accessing programs have to use the
     same way of locking or it will not work).
    </simpara>
    <simpara>
     <function>flock</function> operates on <parameter>fp</parameter>
     which must be an open file
     pointer. <parameter>operation</parameter> is one of the following
     values:
    </simpara>
    <para>
     <itemizedlist>
      <listitem>
       <simpara>
         To acquire a shared lock (reader), set
         <parameter>operation</parameter> to LOCK_SH (set to 1 prior to
         PHP 4.0.1).
       </simpara>
      </listitem>
      <listitem>
       <simpara>
         To acquire an exclusive lock (writer), set
         <parameter>operation</parameter> to LOCK_EX (set to 2 prior to
         PHP 4.0.1).
       </simpara>
      </listitem>
      <listitem>
       <simpara>
         To release a lock (shared or exclusive), set
         <parameter>operation</parameter> to LOCK_UN (set to 3 prior to
         PHP 4.0.1).
       </simpara>
      </listitem>
      <listitem>
       <simpara>
         If you don't want <function>flock</function> to block while
         locking, add LOCK_NB (4 prior to PHP 4.0.1) to
         <parameter>operation</parameter>.
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <simpara>
     <function>Flock</function> allows you to perform a simple
     reader/writer model which can be used on virtually every platform
     (including most Unices and even Windows).  The optional 3rd
     argument is set to true if the lock would block (EWOULDBLOCK
     errno condition)
    </simpara>
    <simpara>
     <function>Flock</function> returns true on success and false on
     error (e.g. when a lock could not be acquired).
    </simpara>
    <warning>
     <para>
      On most operation systems <function>flock</function> is implemented
      at the process level. When using a multithreaded server API like
      ISAPI you cannot rely on <function>flock</function> to protect
      files against other PHP scripts running in parallel threads of the
      same server instance!
     </para>
    </warning>
   </refsect1>
  </refentry>

  <refentry id="function.fopen">
   <refnamediv>
    <refname>fopen</refname>
    <refpurpose>Opens file or URL</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>fopen</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
      <paramdef>string <parameter>mode</parameter></paramdef>
      <paramdef>int 
       <parameter>
        <optional>use_include_path</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     If <parameter>filename</parameter> begins with "http://" (not
     case sensitive), an HTTP 1.0 connection is opened to the
     specified server and a file pointer is returned to the beginning
     of the text of the response. A 'Host:' header is sent with the
     request in order to handle name-based virtual hosts.
    </simpara>
    <simpara>
     Does not handle HTTP redirects, so you must include trailing
     slashes on directories.
    </simpara>
    <simpara>
     If <parameter>filename</parameter> begins with "ftp://" (not case
     sensitive), an ftp connection to the specified server is opened
     and a pointer to the requested file is returned. If the server
     does not support passive mode ftp, this will fail. You can open
     files for either reading or writing via ftp (but not both
     simultaneously).
    </simpara>
    <simpara>
     If <parameter>filename</parameter> is one of "php://stdin",
     "php://stdout", or "php://stderr", the corresponding stdio
     stream will be opened.  (This was introduced in PHP 3.0.13;
     in earlier versions, a filename such as "/dev/stdin" or
     "/dev/fd/0" must be used to access the stdio streams.)
    </simpara>
    <simpara>
     If <parameter>filename</parameter> begins with anything else, the
     file will be opened from the filesystem, and a file pointer to
     the file opened is returned.
    </simpara>
    <simpara>
     If the open fails, the function returns false.
    </simpara>
    <para>
     <parameter>mode</parameter> may be any of the following:
     <itemizedlist>
      <listitem>
       <simpara>
        'r' - Open for reading only; place the file pointer at the
        beginning of the file.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        'r+' - Open for reading and writing; place the file pointer at
        the beginning of the file.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        'w' - Open for writing only; place the file pointer at the
        beginning of the file and truncate the file to zero length.
        If the file does not exist, attempt to create it.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        'w+' - Open for reading and writing; place the file pointer at
        the beginning of the file and truncate the file to zero
        length.  If the file does not exist, attempt to create it.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        'a' - Open for writing only; place the file pointer at the end
        of the file. If the file does not exist, attempt to create
        it.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        'a+' - Open for reading and writing; place the file pointer at
        the end of the file. If the file does not exist, attempt to
        create it.
       </simpara>
      </listitem>
     </itemizedlist>
     The <parameter>mode</parameter> may contain the letter
     'b'. This is useful only on systems which differentiate between
     binary and text files (i.e., it's useless on Unix). If not
     needed, this will be ignored.
    </para>
    <para>
     You can use the optional third parameter and set it to "1", if
     you want to search for the file in the <link
     linkend="ini.include-path">include_path</link>, too.
    </para>
    <para>
     <example>
      <title><function>Fopen</function> example</title>
      <programlisting role="php">
$fp = fopen ("/home/rasmus/file.txt", "r");
$fp = fopen ("/home/rasmus/file.gif", "wb");
$fp = fopen ("http://www.php.net/", "r");
$fp = fopen ("ftp://user:[EMAIL PROTECTED]/", "w");
      </programlisting>
     </example>
    </para>
    <simpara>
     If you are experiencing problems with reading and writing to
     files and you're using the server module version of PHP, remember
     to make sure that the files and directories you're using are
     accessible to the server process.
    </simpara>
    <para>
     On the Windows platform, be careful to escape any backslashes
     used in the path to the file, or use forward slashes.
     <informalexample>
      <programlisting role="php"> 
$fp = fopen ("c:\\data\\info.txt", "r");
      </programlisting>
     </informalexample>
    </para>
    <simpara>
     See also <function>fclose</function>,
     <function>fsockopen</function>,
     <function>socket_set_timeout</function>, and
     <function>popen</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.fpassthru">
   <refnamediv>
    <refname>fpassthru</refname> 
    <refpurpose>
     Output all remaining data on a file pointer
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>fpassthru</function></funcdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Reads to EOF on the given file pointer and writes the results to
     standard output.
    </simpara>
    <simpara>
     If an error occurs, <function>fpassthru</function> returns
     false.
    </simpara>
    <simpara>
     The file pointer must be valid, and must point to a file
     successfully opened by <function>fopen</function>,
     <function>popen</function>, or <function>fsockopen</function>.
     The file is closed when <function>fpassthru</function> is done
     reading it (leaving <parameter>fp</parameter> useless).
    </simpara>
    <simpara>
     If you just want to dump the contents of a file to stdout you may
     want to use the <function>readfile</function>, which saves you
     the <function>fopen</function> call.
    </simpara>
    <simpara>
     See also <function>readfile</function>,
     <function>fopen</function>, <function>popen</function>, and
     <function>fsockopen</function>
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.fputs">
   <refnamediv>
    <refname>fputs</refname>
    <refpurpose>Writes to a file pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>fputs</function></funcdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
      <paramdef>string <parameter>str</parameter></paramdef>
      <paramdef>int 
       <parameter>
        <optional>length</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Fputs</function> is an alias to
     <function>fwrite</function>, and is identical in every way.  Note
     that the <parameter>length</parameter> parameter is optional and
     if not specified the entire string will be written.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.fread">
   <refnamediv>
    <refname>fread</refname>
    <refpurpose>Binary-safe file read</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>fread</function></funcdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
      <paramdef>int <parameter>length</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Fread</function> reads up to
     <parameter>length</parameter> bytes from the file pointer
     referenced by <parameter>fp</parameter>. Reading stops when
     <parameter>length</parameter> bytes have been read or EOF is
     reached, whichever comes first.
    </simpara> 
    <para>
     <informalexample>
      <programlisting role="php">
// get contents of a file into a string
$filename = "/usr/local/something.txt";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);
      </programlisting>
     </informalexample>
    </para>
    <simpara>
     See also <function>fwrite</function>, <function>fopen</function>,
     <function>fsockopen</function>, <function>popen</function>,
     <function>fgets</function>, <function>fgetss</function>,
     <function>fscanf</function>, <function>file</function>, and
     <function>fpassthru</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.fscanf">
   <refnamediv>
    <refname>fscanf</refname>
    <refpurpose>Parses input from a file according to a format</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>fscanf</function></funcdef>
      <paramdef>int <parameter>handle</parameter></paramdef>
      <paramdef>string <parameter>format</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>var1</optional></parameter>...
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The function <function>fscanf</function> is similar to
     <function>sscanf</function>, but it takes its input from a file
     associated with <parameter>handle</parameter> and interprets the
     input according to the specified
     <parameter>format</parameter>. If only two parameters were passed
     to this function, the values parsed will be returned as an array.
     Otherwise, if optional parameters are passed, the function will
     return the number of assigned values. The optional parameters
     must be passed by reference.
     <example>
      <title><function>Fscanf</function> Example</title>
      <programlisting role="php">
$fp = fopen ("users.txt","r");
while ($userinfo = fscanf ($fp, "%s\t%s\t%s\n")) {
    list ($name, $profession, $countrycode) = $userinfo;
    //... do something with the values
}
fclose($fp);
      </programlisting>
     </example>
     <example>
      <title>users.txt</title>
      <programlisting>
javier  argonaut        pe
hiroshi sculptor        jp
robert  slacker us
luigi   florist it
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>fread</function>, <function>fgets</function>,
     <function>fgetss</function>, <function>sscanf</function>,
     <function>printf</function>, and <function>sprintf</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.fseek">
   <refnamediv>
    <refname>fseek</refname>
    <refpurpose>Seeks on a file pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>fseek</function></funcdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
      <paramdef>int <parameter>offset</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>whence</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets the file position indicator for the file referenced by
     <parameter>fp</parameter>.The new position, measured in bytes
     from the beginning of the file, is obtained by adding
     <parameter>offset</parameter> to the position specified by
     <parameter>whence</parameter>, whose values are defined as
     follows:
     <simplelist>
      <member>SEEK_SET - Set position equal to
      <parameter>offset</parameter> bytes.</member> <member>SEEK_CUR -
      Set position to current location plus
      <parameter>offset</parameter>.</member> <member>SEEK_END - Set
      position to end-of-file plus
      <parameter>offset</parameter>.</member>
     </simplelist>
    </para>
    <para>If <parameter>whence is not specified, it is assumed to be
    SEEK_SET.</parameter>
    </para>
    <para>
     Upon success, returns 0; otherwise, returns -1. Note that seeking
     past EOF is not considered an error.
    </para>
    <para>
     May not be used on file pointers returned by
     <function>fopen</function> if they use the "http://" or "ftp://"
     formats.
    </para>
    <note>
     <para>
      The <parameter>whence</parameter> argument was added after PHP 4.0 RC1.
     </para>
    </note>
    <para>
     See also <function>ftell</function> and
     <function>rewind</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.fstat">
   <refnamediv>
    <refname>fstat</refname>
    <refpurpose>
     Gets information about a file using an open file pointer
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>fstat</function></funcdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Gathers the statistics of the file opened by the file
     pointer fp.  This function is similar to the
     <function>stat</function> function except that it operates
     on an open file pointer instead of a filename.
    </para>
    <para>
     Returns an array with the statistics of the file with the
     following elements:
     <orderedlist>
      <listitem><simpara>device</simpara></listitem>
      <listitem><simpara>inode</simpara></listitem>
      <listitem><simpara>number of links</simpara></listitem>
      <listitem><simpara>user id of owner</simpara></listitem>
      <listitem><simpara>group id owner</simpara></listitem>
      <listitem><simpara>device type if inode device *</simpara></listitem>
      <listitem><simpara>size in bytes</simpara></listitem>
      <listitem><simpara>time of last access</simpara></listitem>
      <listitem><simpara>time of last modification</simpara></listitem>
      <listitem><simpara>time of last change</simpara></listitem>
      <listitem><simpara>blocksize for filesystem I/O *</simpara></listitem>
      <listitem><simpara>number of blocks allocated</simpara></listitem>
     </orderedlist>
     * - only valid on systems supporting the st_blksize type--other
     systems (i.e. Windows) return -1</para>
    <para>
     The results of this function are cached. See
     <function>clearstatcache</function> for more details.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ftell">
   <refnamediv>
    <refname>ftell</refname>
    <refpurpose>Tells file pointer read/write position</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ftell</function></funcdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the position of the file pointer referenced by fp; i.e.,
     its offset into the file stream.
    </para>
    <para>
     If an error occurs, returns false.
    </para>
    <para>
     The file pointer must be valid, and must point to a file
     successfully opened by <function>fopen</function> or
     <function>popen</function>.
    </para>
    <para> 
     See also <function>fopen</function>, <function>popen</function>,
     <function>fseek</function> and <function>rewind</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ftruncate">
   <refnamediv>
    <refname>ftruncate</refname>
    <refpurpose>
     Truncates a file to a given length.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ftruncate</function></funcdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
      <paramdef>int <parameter>size</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Takes the filepointer, fp, and truncates the file to length, size.
     This function returns true on success and false on failure.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.fwrite">
   <refnamediv>
    <refname>fwrite</refname>
    <refpurpose>Binary-safe file write</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>fwrite</function></funcdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
      <paramdef>string <parameter>string</parameter></paramdef>
      <paramdef>int 
       <parameter>
        <optional>length</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>fwrite</function> writes the contents of
     <parameter>string</parameter> to the file stream pointed to by
     <parameter>fp</parameter>. If the <parameter>length</parameter>
     argument is given, writing will stop after
     <parameter>length</parameter> bytes have been written or the end
     of <parameter>string</parameter> is reached, whichever comes
     first.
    </simpara>
    <simpara>
     Note that if the <parameter>length</parameter> argument is given,
     then the <link
     linkend="ini.magic-quotes-runtime">magic_quotes_runtime</link>
     configuration option will be ignored and no slashes will be
     stripped from <parameter>string</parameter>.
    </simpara>
    <simpara>
     See also <function>fread</function>, <function>fopen</function>,
     <function>fsockopen</function>, <function>popen</function>, and
     <function>fputs</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.set-file-buffer">
   <refnamediv>
    <refname>set_file_buffer</refname>
    <refpurpose>
     Sets file buffering on the given file pointer
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>set_file_buffer</function></funcdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
      <paramdef>int <parameter>buffer</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Output using <function>fwrite</function> is normally buffered at
     8K.  This means that if there are two processess wanting to write
     to the same output stream (a file), each is paused after 8K of
     data to allow the other to write.  <function>set_file_buffer</function>
     sets the buffering for write operations on the given filepointer
     <parameter>fp</parameter> to <parameter>buffer</parameter> bytes.
     If <parameter>buffer</parameter> is 0 then write operations are
     unbuffered.  This ensures that all writes with
     <function>fwrite</function> are completed before other processes
     are allowed to write to that output stream.
    </simpara>
    <simpara>
     The function returns 0 on success, or EOF if the request cannot
     be honored.
    </simpara>
    <para>
     The following example demonstrates how to use
     <function>set_file_buffer</function> to create an unbuffered stream.
     <example>
      <title><function>set_file_buffer</function> example</title>
      <programlisting role="php">
$fp=fopen($file, "w");
if($fp){
  set_file_buffer($fp, 0);
  fputs($fp, $output);
  fclose($fp);
}
      </programlisting>
     </example>
    </para>

    <simpara>
     See also <function>fopen</function>, <function>fwrite</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.is-dir">
   <refnamediv>
    <refname>is_dir</refname>
    <refpurpose>Tells whether the filename is a directory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>is_dir</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true if the filename exists and is a directory.
    </para>
    <para>
     The results of this function are cached. See
     <function>clearstatcache</function> for more details.
    </para>
    <para>
     See also <function>is_file</function> and
     <function>is_link</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.is-executable">
   <refnamediv>
    <refname>is_executable</refname>
    <refpurpose>Tells whether the filename is executable</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>is_executable</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true if the filename exists and is executable.
    </para>
    <para>
     The results of this function are cached. See
     <function>clearstatcache</function> for more details.
    </para>
    <para>
     See also <function>is_file</function> and
     <function>is_link</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.is-file">
   <refnamediv>
    <refname>is_file</refname>
    <refpurpose>
     Tells whether the filename is a regular file
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>is_file</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true if the filename exists and is a regular file.
    </para>
    <para>
     The results of this function are cached. See
     <function>clearstatcache</function> for more details.
    </para>
    <para>
     See also <function>is_dir</function> and
     <function>is_link</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.is-link">
   <refnamediv>
    <refname>is_link</refname>
    <refpurpose>
     Tells whether the filename is a symbolic link
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>is_link</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true if the filename exists and is a symbolic link.
    </para>
    <para>
     The results of this function are cached. See
     <function>clearstatcache</function> for more details.
    </para>
    <para>
     See also <function>is_dir</function> and
     <function>is_file</function>.
    </para>
    <note>
     <simpara>
     This function does not work on Windows systems
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.is-readable">
   <refnamediv>
    <refname>is_readable</refname>
    <refpurpose>
     Tells whether the filename is readable
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>is_readable</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true if the filename exists and is readable.
    </para>
    <para>
     Keep in mind that PHP may be accessing the file as the user
     id that the web server runs as (often 'nobody'). Safe mode
     limitations are not taken into account.
    </para>
    <para>
     The results of this function are cached. See
     <function>clearstatcache</function> for more details.
    </para>
    <para>
     See also <function>is_writable</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.is-writable">
   <refnamediv>
    <refname>is_writable</refname>
    <refpurpose>Tells whether the filename is writable</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>is_writable</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true if the filename exists and is writable.  The
     filename argument may be a directory name allowing you to check
     if a directory is writeable.
    </para>
    <para>
     Keep in mind that PHP may be accessing the file as the user id
     that the web server runs as (often 'nobody'). Safe mode
     limitations are not taken into account.
    </para>
    <para>
     The results of this function are cached. See
     <function>clearstatcache</function> for more details.
    </para>
    <para>
     See also <function>is_readable</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.is-uploaded-file">
   <refnamediv>
    <refname>is_uploaded_file</refname>
    <refpurpose>Tells whether the file was uploaded via HTTP POST.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>is_uploaded_file</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>

    <para>
     This function is available only in versions of PHP 3 after PHP
     3.0.16, and in versions of PHP 4 after 4.0.2.
    </para>

    <para>
     Returns true if the file named by <varname>filename</varname> was
     uploaded via HTTP POST. This is useful to help ensure that a
     malicious user hasn't tried to trick the script into working on
     files upon which it should not be working--for instance,
     <filename>/etc/passwd</filename>.
    </para>

    <para>
     This sort of check is especially important if there is any chance
     that anything done with uploaded files could reveal their
     contents to the user, or even to other users on the same
     system.
    </para>

    <para>
     See also <function>move_uploaded_file</function>, and the section
     <link linkend="features.file-upload">Handling file uploads</link>
     for a simple usage example.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.link">
   <refnamediv>
    <refname>link</refname>
    <refpurpose>Create a hard link</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>link</function></funcdef>
      <paramdef>string <parameter>target</parameter></paramdef>
      <paramdef>string <parameter>link</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
    <function>Link</function> creates a hard link.</para>
    <para>
     See also the <function>symlink</function> to create soft links,
     and <function>readlink</function> along with
     <function>linkinfo</function>.
    </para>
    <note>
     <simpara>
     This function does not work on Windows systems
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.linkinfo">
   <refnamediv>
    <refname>linkinfo</refname>
    <refpurpose>Gets information about a link</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>linkinfo</function></funcdef>
      <paramdef>string <parameter>path</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Linkinfo</function> returns the st_dev field of the
     UNIX C stat structure returned by the lstat system call.  This
     function is used to verify if a link (pointed to by
     <parameter>path</parameter>) really exists (using the same method
     as the S_ISLNK macro defined in stat.h).  Returns 0 or FALSE in
     case of error.
    </para>
    <para>
     See also <function>symlink</function>, <function>link</function>,
     and <function>readlink</function>.
    </para>
    <note>
     <simpara>
     This function does not work on Windows systems
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.mkdir">
   <refnamediv>
    <refname>mkdir</refname>
    <refpurpose>Makes directory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mkdir</function></funcdef>
      <paramdef>string <parameter>pathname</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Attempts to create the directory specified by pathname.
    </para>
    <para>
     Note that you probably want to specify the mode as an
     octal number, which means it should have a leading zero.
     <informalexample>
      <programlisting role="php">
mkdir ("/path/to/my/dir", 0700);
      </programlisting>
     </informalexample>
    </para>
    <para>
     Returns true on success and false on failure.
    </para>
    <para>
     See also <function>rmdir</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.move-uploaded-file">
   <refnamediv>
    <refname>move_uploaded_file</refname>
    <refpurpose>Moves an uploaded file to a new location.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>move_uploaded_file</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
      <paramdef>string <parameter>destination</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>

    <para>
     This function is available only in versions of PHP 3 after PHP
     3.0.16, and in versions of PHP 4 after 4.0.2.
    </para>

    <para>
     This function checks to ensure that the file designated by
     <parameter>filename</parameter> is a valid upload file (meaning
     that it was uploaded via PHP's HTTP POST upload mechanism). If
     the file is valid, it will be moved to the filename given by
     <parameter>destination</parameter>.
    </para>

    <para>
     If <parameter>filename</parameter> is not a valid upload file,
     then no action will occur, and
     <function>move_uploaded_file</function> will return
     <literal>false</literal>. 
    </para>

    <para>
     If <parameter>filename</parameter> is a valid upload file, but
     cannot be moved for some reason, no action will occur, and
     <function>move_uploaded_file</function> will return
     <literal>false</literal>. Additionally, a warning will be issued.
    </para>

    <para>
     This sort of check is especially important if there is any chance
     that anything done with uploaded files could reveal their
     contents to the user, or even to other users on the same
     system.
    </para>

    <para>
     See also <function>is_uploaded_file</function>, and the section
     <link linkend="features.file-upload">Handling file uploads</link>
     for a simple usage example.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pclose">
   <refnamediv>
    <refname>pclose</refname>
    <refpurpose>Closes process file pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pclose</function></funcdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Closes a file pointer to a pipe opened by
     <function>popen</function>.
    </para> 
    <para> 
     The file pointer must be valid, and must have been returned by a
     successful call to <function>popen</function>.
    </para> 
    <para>
     Returns the termination status of the process that was
     run.
    </para>
    <para>
     See also <function>popen</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.popen">
   <refnamediv>
    <refname>popen</refname>
    <refpurpose>Opens process file pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>popen</function></funcdef>
      <paramdef>string <parameter>command</parameter></paramdef>
      <paramdef>string <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Opens a pipe to a process executed by forking the command given
     by command.
    </para>
    <para> 
     Returns a file pointer identical to that returned by
     <function>fopen</function>, except that it is unidirectional (may
     only be used for reading or writing) and must be closed with
     <function>pclose</function>. This pointer may be used with
     <function>fgets</function>, <function>fgetss</function>, and
     <function>fputs</function>.
    </para>
    <para>
     If an error occurs, returns false.
    </para>
    <para>
     <informalexample>
      <programlisting role="php">
$fp = popen ("/bin/ls", "r");
      </programlisting>
     </informalexample>
    </para>
    <para>
     See also <function>pclose</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.readfile">
   <refnamediv>
    <refname>readfile</refname>
    <refpurpose>Outputs a file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>readfile</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
      <paramdef>int 
       <parameter>
        <optional>use_include_path</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Reads a file and writes it to standard output.
    </para>
    <para>
     Returns the number of bytes read from the file. If an error
     occurs, false is returned and unless the function was called as
     @readfile, an error message is printed.
    </para>
    <para>
     If <parameter>filename</parameter> begins with "http://"
     (not case sensitive), an HTTP 1.0 connection is opened to the
     specified server and the text of the response is written to
     standard output.
    </para>
    <para>
     Does not handle HTTP redirects, so you must include trailing
     slashes on directories.
    </para>
    <para>
     If <parameter>filename</parameter> begins with "ftp://"
     (not case sensitive), an ftp connection to the specified server is
     opened and the requested file is written to standard output. If the server
     does not support passive mode ftp, this will fail.
    </para>
    <para>
     If <parameter>filename</parameter> begins with neither
     of these strings, the file will be opened from the filesystem and
     its contents written to standard output.
    </para>
    <para>
     You can use the optional second parameter and set it to "1", if
     you want to search for the file in the <link
     linkend="ini.include-path">include_path</link>, too.
    </para>
    <para>
     See also <function>fpassthru</function>,
     <function>file</function>, <function>fopen</function>,
     <function>include</function>, <function>require</function>, and
     <function>virtual</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.readlink">
   <refnamediv>
    <refname>readlink</refname>
    <refpurpose>Returns the target of a symbolic link</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>readlink</function></funcdef>
      <paramdef>string <parameter>path</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
    <function>Readlink</function> does the same as the readlink C
    function and returns the contents of the symbolic link path or 0
    in case of error.
    </para>
    <para>
     See also <function>symlink</function>,
     <function>readlink</function> and
     <function>linkinfo</function>.
    </para>
    <note>
     <simpara>
     This function does not work on Windows systems
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.rename">
   <refnamediv>
    <refname>rename</refname>
    <refpurpose>Renames a file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>rename</function></funcdef>
      <paramdef>string <parameter>oldname</parameter></paramdef>
      <paramdef>string <parameter>newname</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Attempts to rename <parameter>oldname</parameter> to
     <parameter>newname</parameter>.
    </para> 
    <para> 
     Returns true on success and false on failure.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.rewind">
   <refnamediv>
    <refname>rewind</refname>
    <refpurpose>Rewind the position of a file pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>rewind</function></funcdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>    
     Sets the file position indicator for fp to the beginning of the
     file stream.</para> <para> If an error occurs, returns 0.</para>
     <para> The file pointer must be valid, and must point to a file
     successfully opened by <function>fopen</function>.
    </para>
    <para>
     See also <function>fseek</function> and
     <function>ftell</function>.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.rmdir">
   <refnamediv>
    <refname>rmdir</refname>
    <refpurpose>Removes directory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>rmdir</function></funcdef>
      <paramdef>string <parameter>dirname</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Attempts to remove the directory named by pathname. The directory
     must be empty, and the relevant permissions must permit.
     this.
    </para> 
    <para> 
     If an error occurs, returns 0.
    </para>
    <para>
     See also <function>mkdir</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.stat">
   <refnamediv>
    <refname>stat</refname>
    <refpurpose>Gives information about a file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>stat</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Gathers the statistics of the file named by filename.</para>
    <para>
     Returns an array with the statistics of the file with the
     following elements:
     <orderedlist>
      <listitem><simpara>device</simpara></listitem>
      <listitem><simpara>inode</simpara></listitem>
      <listitem><simpara>inode protection mode</simpara></listitem>
      <listitem><simpara>number of links</simpara></listitem>
      <listitem><simpara>user id of owner</simpara></listitem>
      <listitem><simpara>group id owner</simpara></listitem>
      <listitem><simpara>device type if inode device *</simpara></listitem>
      <listitem><simpara>size in bytes</simpara></listitem>
      <listitem><simpara>time of last access</simpara></listitem>
      <listitem><simpara>time of last modification</simpara></listitem>
      <listitem><simpara>time of last change</simpara></listitem>
      <listitem><simpara>blocksize for filesystem I/O *</simpara></listitem>
      <listitem><simpara>number of blocks allocated</simpara></listitem>
     </orderedlist>
     * - only valid on systems supporting the st_blksize type--other
     systems (i.e. Windows) return -1</para>
    <para>
     The results of this function are cached. See
     <function>clearstatcache</function> for more details.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.lstat">
   <refnamediv>
    <refname>lstat</refname>
    <refpurpose>
     Gives information about a file or symbolic link
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>lstat</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Gathers the statistics of the file or symbolic link named by
     filename.  This function is identical to the
     <function>stat</function> function except that if the
     <parameter>filename</parameter> parameter is a symbolic link, the
     status of the symbolic link is returned, not the status of the
     file pointed to by the symbolic link.
    </para>
    <para>
     Returns an array with the statistics of the file with the
     following elements:
     <orderedlist>
      <listitem><simpara>device</simpara></listitem>
      <listitem><simpara>inode</simpara></listitem>
      <listitem><simpara>inode protection mode</simpara></listitem>
      <listitem><simpara>number of links</simpara></listitem>
      <listitem><simpara>user id of owner</simpara></listitem>
      <listitem><simpara>group id owner</simpara></listitem>
      <listitem><simpara>device type if inode device *</simpara></listitem>
      <listitem><simpara>size in bytes</simpara></listitem>
      <listitem><simpara>time of last access</simpara></listitem>
      <listitem><simpara>time of last modification</simpara></listitem>
      <listitem><simpara>time of last change</simpara></listitem>
      <listitem><simpara>blocksize for filesystem I/O *</simpara></listitem>
      <listitem><simpara>number of blocks allocated</simpara></listitem>
     </orderedlist>
     * - only valid on systems supporting the st_blksize type--other
     systems (i.e. Windows) return -1</para>
    <para>
     The results of this function are cached. See
     <function>clearstatcache</function> for more details.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.realpath">
   <refnamediv>
    <refname>realpath</refname>
    <refpurpose>Returns canonicalized absolute pathname</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>realpath</function></funcdef>
      <paramdef>string <parameter>path</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>realpath</function> expands all symbolic links and
     resolves references to '/./', '/../' and extra '/' characters in
     the input <parameter>path</parameter> and return the canonicalized
     absolute pathname.  The resulting path will have no symbolic link,
     '/./' or '/../' components.
    </para>
    <para>
     <example>
      <title><function>realpath</function> example</title>
      <programlisting role="php">
$real_path = realpath ("../../index.php");
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.symlink">
   <refnamediv>
    <refname>symlink</refname>
    <refpurpose>Creates a symbolic link</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>symlink</function></funcdef>
      <paramdef>string <parameter>target</parameter></paramdef>
      <paramdef>string <parameter>link</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>symlink</function> creates a symbolic link
     from the existing <parameter>target</parameter> with
     the specified name <parameter>link</parameter>.
    </para>
    <para>
     See also <function>link</function> to create hard links,
     and <function>readlink</function> along with
     <function>linkinfo</function>.
    </para>
    <note>
     <simpara>
      This function does not work on Windows systems.
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.tempnam">
   <refnamediv>
    <refname>tempnam</refname>
    <refpurpose>Creates unique file name</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>tempnam</function></funcdef>
      <paramdef>string <parameter>dir</parameter></paramdef>
      <paramdef>string <parameter>prefix</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Creates a unique temporary filename in the specified directory.
     If the directory does not exist, <function>tempnam</function> may
     generate a filename in the system's temporary directory.
    </para>
    <para>
     The behaviour of the <function>tempnam</function> function is
     system dependent. On Windows the TMP environment variable will
     override the <parameter>dir</parameter> parameter, on Linux the
     TMPDIR environment variable has precedence, while SVR4 will always
     use your <parameter>dir</parameter> parameter if the directory it
     points to exists. Consult your system documentation on the 
     tempnam(3) function if in doubt.
    </para>
    <para>
     Returns the new temporary filename, or the null string on
     failure.
     <example>
      <title><function>Tempnam</function> example</title>
      <programlisting role="php">
$tmpfname = tempnam ("/tmp", "FOO");
      </programlisting>
     </example>
    </para>
    <note>
     <simpara>
      This function's behavior changed in 4.0.3. The temporary file is also
      created to avoid a race condition where the file might appear in the
      filesystem between the time the string was generated and before the
      the script gets around to creating the file. 
     </simpara>
    </note>
    <para>
     See also <function>tmpfile</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.tmpfile">
   <refnamediv>
    <refname>tmpfile</refname>
    <refpurpose>Creates a temporary file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>tmpfile</function></funcdef>
      <paramdef>void</paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Creates a temporary file with an unique name in write mode,
     returning a file handle similar to the one returned by
     <function>fopen</function>.
     The file is automatically removed when closed (using
     <function>fclose</function>), or when the script ends.
    </para>
    <para>
     For details, consult your system documentation on the
     <literal>tmpfile(3)</literal> function, as well as the
     <filename>stdio.h</filename> header file.
    </para>
    <para>
     See also <function>tempnam</function>.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.touch">
   <refnamediv>
    <refname>touch</refname>
    <refpurpose>Sets modification time of file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>touch</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
      <paramdef>int 
        <parameter>
         <optional>time</optional>
        </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Attempts to set the modification time of the file named by
     filename to the value given by time. If the option time is not
     given, uses the present time.
    </para>
    <para>
     If the file does not exist, it is created.
    </para>
    <para>
     Returns true on success and false otherwise.
     <example>
      <title><function>Touch</function> example</title>
      <programlisting role="php">
if (touch ($FileName)) {
    print "$FileName modification time has been 
           changed to todays date and time";
} else {
    print "Sorry Could Not change modification time of $FileName";
}
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.umask">
   <refnamediv>
    <refname>umask</refname>
    <refpurpose>Changes the current umask</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>umask</function></funcdef>
      <paramdef>int <parameter>mask</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Umask</function> sets PHP's umask to mask &amp; 0777 and
     returns the old umask. When PHP is being used as a server module,
     the umask is restored when each request is finished.
    </para>
    <para>
     <function>Umask</function> without arguments simply returns the
     current umask.
    </para>
    <note>
     <simpara>
      This function may not work on Windows systems.
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.unlink">
   <refnamediv>
    <refname>unlink</refname>
    <refpurpose>Deletes a file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>unlink</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Deletes <parameter>filename</parameter>.  Similar to the Unix C
     unlink() function.
    </para>
    <para>
     Returns 0 or FALSE on an error.
    </para>
    <para>
     See also <function>rmdir</function> for removing directories.
    </para>
    <note>
     <simpara>
      This function may not work on Windows systems.
     </simpara>
    </note>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/ftp.xml
+++ phpdoc/kr/functions/ftp.xml
 <reference id="ref.ftp">
  <title>FTP functions</title>
  <titleabbrev>FTP</titleabbrev>

  <partintro>
   <para>
    FTP stands for File Transfer Protocol.</para>

   <para>
    The following constants are defined when using the FTP module:
    <constant>FTP_ASCII</constant> and <constant>FTP_BINARY</constant>.
   </para>
   <para>
    <example>
     <title><function>ftp</function> example</title>
      <programlisting>
&lt;?php
// set up basic connection
$conn_id = ftp_connect("$ftp_server"); 

// login with username and password
$login_result = ftp_login($conn_id, "$ftp_user_name", "$ftp_user_pass"); 

// check connection
if ((!$conn_id) || (!$login_result)) { 
        echo "Ftp connection has failed!";
        echo "Attempted to connect to $ftp_server for user $user"; 
        die; 
    } else {
        echo "Connected to $ftp_server, for user $user";
    }

// upload the file
$upload = ftp_put($conn_id, "$destination_file", "$source_file", FTP_BINARY); 

// check upload status
if (!$upload) { 
        echo "Ftp upload has failed!";
    } else {
        echo "Uploaded $source_file to $ftp_server as $destination_file";
    }

// close the FTP stream 
ftp_quit($conn_id); 
?>
     </programlisting>
    </example>
   </para>
  </partintro>

  <refentry id="function.ftp-connect">
   <refnamediv>
    <refname>ftp_connect</refname>
    <refpurpose>Opens up an FTP connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ftp_connect</function></funcdef>
      <paramdef>string <parameter>host</parameter></paramdef>
      <paramdef>int <parameter><optional>port</optional>
       </parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a FTP stream on success, false on error.</para>  
    <para>
     <function>ftp_connect</function> opens up a FTP connection to the
     specified <parameter>host</parameter>.  The <parameter>port</parameter>
     parameter specifies an alternate port to connect to.  If it is
     omitted or zero, then the default FTP port, 21, will be used.</para>
   </refsect1>
  </refentry>


  <refentry id="function.ftp-login">
   <refnamediv>
    <refname>ftp_login</refname>
    <refpurpose>Logs in an FTP connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ftp_login</function></funcdef>
      <paramdef>int <parameter>ftp_stream</parameter></paramdef>
      <paramdef>string <parameter>username</parameter></paramdef>
      <paramdef>string <parameter>password</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on error.</para>
    <para> 
     Logs in the given FTP stream.</para>
   </refsect1>
  </refentry>

  <refentry id="function.ftp-pwd">
   <refnamediv>
    <refname>ftp_pwd</refname>
    <refpurpose>Returns the current directory name</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ftp_pwd</function></funcdef>
      <paramdef>int <parameter>ftp_stream</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the current directory, or false on error.</para>
   </refsect1>
  </refentry>

  <refentry id="function.ftp-cdup">
   <refnamediv>
    <refname>ftp_cdup</refname>
    <refpurpose>Changes to the parent directory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ftp_cdup</function></funcdef>
      <paramdef>int <parameter>ftp_stream</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on error.</para>
    <para> 
     Changes to the parent directory.</para>
   </refsect1>
  </refentry>

  <refentry id="function.ftp-chdir">
   <refnamediv>
    <refname>ftp_chdir</refname>
    <refpurpose>Changes directories on a FTP server</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ftp_chdir</function></funcdef>
      <paramdef>int <parameter>ftp_stream</parameter></paramdef>
      <paramdef>string <parameter>directory</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on error.</para>
    <para> 
     Changes to the specified <parameter>directory</parameter>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.ftp-mkdir">
   <refnamediv>
    <refname>ftp_mkdir</refname>
    <refpurpose>Creates a directory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ftp_mkdir</function></funcdef>
      <paramdef>int <parameter>ftp_stream</parameter></paramdef>
      <paramdef>string <parameter>directory</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the newly created directory name on success, false on error.</para>
    <para> 
     Creates the specified <parameter>directory</parameter>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.ftp-rmdir">
   <refnamediv>
    <refname>ftp_rmdir</refname>
    <refpurpose>Removes a directory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ftp_rmdir</function></funcdef>
      <paramdef>int <parameter>ftp_stream</parameter></paramdef>
      <paramdef>string <parameter>directory</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on error.</para>
    <para> 
     Removes the specified <parameter>directory</parameter>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.ftp-nlist">
   <refnamediv>
    <refname>ftp_nlist</refname>
    <refpurpose>Returns a list of files in the given directory.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>ftp_nlist</function></funcdef>
      <paramdef>int <parameter>ftp_stream</parameter></paramdef>
      <paramdef>string <parameter>directory</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of filenames on success, false on error.</para>
   </refsect1>
  </refentry>

  <refentry id="function.ftp-rawlist">
   <refnamediv>
    <refname>ftp_rawlist</refname>
    <refpurpose>
     Returns a detailed list of files in the given directory.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>ftp_rawlist</function></funcdef>
      <paramdef>int <parameter>ftp_stream</parameter></paramdef>
      <paramdef>string <parameter>directory</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ftp_rawlist</function> executes the FTP LIST command,
     and returns the result as an array.  Each array element corresponds
     to one line of text.  The output is not parsed in any way.  The
     system type identifier returned by <function>ftp_systype</function>
     can be used to determine how the results should be interpreted.</para>
   </refsect1>
  </refentry>

  <refentry id="function.ftp-systype">
   <refnamediv>
    <refname>ftp_systype</refname>
    <refpurpose>
     Returns the system type identifier of the remote FTP server.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ftp_systype</function></funcdef>
      <paramdef>int <parameter>ftp_stream</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the remote system type, or false on error.</para>
   </refsect1>
  </refentry>

  <refentry id="function.ftp-pasv">
   <refnamediv>
    <refname>ftp_pasv</refname>
    <refpurpose>Turns passive mode on or off.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ftp_pasv</function></funcdef>
      <paramdef>int <parameter>ftp_stream</parameter></paramdef>
      <paramdef>int <parameter>pasv</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on error.</para>
    <para>
     <function>ftp_pasv</function> turns on passive mode if the
     <parameter>pasv</parameter> parameter is true (it turns off
     passive mode if <parameter>pasv</parameter> is false.)  In
     passive mode, data connections are initiated by the client,
     rather than by the server.</para>
   </refsect1>
  </refentry>

  <refentry id="function.ftp-get">
   <refnamediv>
    <refname>ftp_get</refname>
    <refpurpose>Downloads a file from the FTP server.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ftp_get</function></funcdef>
      <paramdef>int <parameter>ftp_stream</parameter></paramdef>
      <paramdef>string <parameter>local_file</parameter></paramdef>
      <paramdef>string <parameter>remote_file</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on error.</para>
    <para>
     <function>ftp_get</function> retrieves <parameter>remote_file</parameter>
     from the FTP server, and saves it to <parameter>local_file</parameter>
     locally.  The transfer <parameter>mode</parameter> specified must
     be either <constant>FTP_ASCII</constant> or
     <constant>FTP_BINARY</constant>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ftp-fget">
   <refnamediv>
    <refname>ftp_fget</refname>
    <refpurpose>Downloads a file from the FTP server and saves to an
     open file.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ftp_fget</function></funcdef>
      <paramdef>int <parameter>ftp_stream</parameter></paramdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
      <paramdef>string <parameter>remote_file</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on error.</para>
    <para>
     <function>ftp_fget</function> retrieves <parameter>remote_file</parameter>
     from the FTP server, and writes it to the given file pointer,
     <parameter>fp</parameter>.  The transfer <parameter>mode</parameter>
     specified must be either FTP_ASCII or FTP_BINARY.</para>
   </refsect1>
  </refentry>

  <refentry id="function.ftp-put">
   <refnamediv>
    <refname>ftp_put</refname>
    <refpurpose>Uploads a file to the FTP server.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ftp_put</function></funcdef>
      <paramdef>int <parameter>ftp_stream</parameter></paramdef>
      <paramdef>string <parameter>remote_file</parameter></paramdef>
      <paramdef>string <parameter>local_file</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on error.</para>
    <para>
     <function>ftp_put</function> stores <parameter>local_file</parameter>
     on the FTP server, as <parameter>remote_file</parameter>.  The transfer
     <parameter>mode</parameter> specified must be either
     <constant>FTP_ASCII</constant> or <constant>FTP_BINARY</constant>.
    </para>
    <para>
     <example>
      <title><function>Ftp_put</function> example</title>
      <programlisting role="php">
$upload = ftp_put ($conn_id, "$destination_file", "$source_file", FTP_ASCII); 
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ftp-fput">
   <refnamediv>
    <refname>ftp_fput</refname>
    <refpurpose>Uploads from an open file to the FTP server.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ftp_fput</function></funcdef>
      <paramdef>int <parameter>ftp_stream</parameter></paramdef>
      <paramdef>string <parameter>remote_file</parameter></paramdef>
      <paramdef>int <parameter>fp</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on error.</para>
    <para>
     <function>ftp_fput</function> uploads the data from the file pointer
     <parameter>fp</parameter> until end of file.  The results are stored
     in <parameter>remote_file</parameter> on the FTP server.  The transfer
     <parameter>mode</parameter> specified must be either
     <constant>FTP_ASCII</constant> or <constant>FTP_BINARY</constant>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ftp-size">
   <refnamediv>
    <refname>ftp_size</refname>
    <refpurpose>Returns the size of the given file.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ftp_size</function></funcdef>
      <paramdef>int <parameter>ftp_stream</parameter></paramdef>
      <paramdef>string <parameter>remote_file</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the file size on success, or -1 on error.</para>
    <para>
     <function>ftp_size</function> returns the size of a file.  If an
     error occurs, of if the file does not exist, -1 is returned.  Not
     all servers support this feature.</para>
   </refsect1>
  </refentry>

  <refentry id="function.ftp-mdtm">
   <refnamediv>
    <refname>ftp_mdtm</refname>
    <refpurpose>Returns the last modified time of the given file.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ftp_mdtm</function></funcdef>
      <paramdef>int <parameter>ftp_stream</parameter></paramdef>
      <paramdef>string <parameter>remote_file</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a UNIX timestamp on success, or -1 on error.</para>
    <para>
     <function>ftp_mdtm</function> checks the last-modified time for a
     file, and returns it as a UNIX timestamp.  If an error occurs, or
     the file does not exist, -1 is returned.  Note that not all servers
     support this feature.
    </para>
    <note>
     <para>
      <function>ftp_mdtm</function> does not work with directories.
     </para>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.ftp-rename">
   <refnamediv>
    <refname>ftp_rename</refname>
    <refpurpose>Renames a file on the ftp server.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ftp_rename</function></funcdef>
      <paramdef>int <parameter>ftp_stream</parameter></paramdef>
      <paramdef>string <parameter>from</parameter></paramdef>
      <paramdef>string <parameter>to</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on error.</para>
    <para>
     <function>ftp_rename</function> renames the file specified
     by <parameter>from</parameter> to the new name
     <parameter>to</parameter>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ftp-delete">
   <refnamediv>
    <refname>ftp_delete</refname>
    <refpurpose>Deletes a file on the ftp server.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ftp_delete</function></funcdef>
      <paramdef>int <parameter>ftp_stream</parameter></paramdef>
      <paramdef>string <parameter>path</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on error.</para>
    <para>
     <function>ftp_delete</function> deletes the file specified by
     <parameter>path</parameter> from the FTP server.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ftp-site">
   <refnamediv>
    <refname>ftp_site</refname>
    <refpurpose>Sends a SITE command to the server.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ftp_site</function></funcdef>
      <paramdef>int <parameter>ftp_stream</parameter></paramdef>
      <paramdef>string <parameter>cmd</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on error.</para>
    <para>
     <function>ftp_site</function> sends the command specified by
     <parameter>cmd</parameter> to the FTP server.  SITE commands
     are not standardized, and vary from server to server.  They are
     useful for handling such things as file permissions and group
     membership. </para>
   </refsect1>
  </refentry>

  <refentry id="function.ftp-quit">
   <refnamediv>
    <refname>ftp_quit</refname>
    <refpurpose>Closes an FTP connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ftp_quit</function></funcdef>
      <paramdef>int <parameter>ftp_stream</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ftp_connect</function> closes <parameter>ftp_stream</parameter>.
    </para>
   </refsect1>
  </refentry>

</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/funchand.xml
+++ phpdoc/kr/functions/funchand.xml
 <reference id="ref.funchand">
  <title>Function Handling functions</title>
  <titleabbrev>Functions</titleabbrev>

  <partintro>
   <para>
    These functions all handle various operations involved in working
    with functions.
   </para>
  </partintro>
  
  <refentry id="function.call-user-func">
   <refnamediv>
    <refname>call_user_func</refname>
    <refpurpose>
     Call a user function given by the first parameter
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed 
       <function>call_user_func</function>
      </funcdef>
      <paramdef>string 
       <parameter>function_name</parameter>
      </paramdef>
      <paramdef>mixed 
       <parameter><optional>parameter</optional></parameter>
      </paramdef>
      <paramdef>mixed 
       <parameter><optional>...</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Call a user defined function given by the
     <parameter>function_name</parameter> parameter.  Take the
     following:
     <informalexample>
      <programlisting role="php">
function barber ($type) {
    print "You wanted a $type haircut, no problem";
}
call_user_func ('barber', "mushroom");
call_user_func ('barber', "shave");
      </programlisting>
     </informalexample>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.create-function">
   <refnamediv>
    <refname>create_function</refname>
    <refpurpose>Create an anonymous (lambda-style) function</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>create_function</function></funcdef>
      <paramdef>string <parameter>args</parameter></paramdef>
      <paramdef>string <parameter>code</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Creates an anonymous function from the parameters passed, and
     returns a unique name for it. Usually the
     <parameter>args</parameter> will be passed as a single quote
     delimited string, and this is also recommended for the
     <parameter>code</parameter>. The reason for using single quoted
     strings, is to protect
     the variable names from parsing, otherwise, if you use double
     quotes there will be a need to escape the variable names, e.g. 
     <literal>\$avar</literal>.
    </para>
    <para>
     You can use this function, to (for example) create a function
     from information gathered at run time:
     <example>
      <title>
       Creating an anonymous function with <function>create_function</function>
      </title>
      <programlisting role="php">
$newfunc = create_function('$a,$b','return "ln($a) + ln($b) = ".log($a * $b);');
echo "New anonymous function: $newfunc\n";
echo $newfunc(2,M_E)."\n";
// outputs
// New anonymous function: lambda_1
// ln(2) + ln(2.718281828459) = 1.6931471805599
      </programlisting>
     </example>
     Or, perhaps to have general handler function that can apply a set
     of operations to a list of parameters:
     <example>
      <title>
       Making a general processing function with
       <function>create_function</function>
      </title>
      <programlisting role="php">
function process($var1, $var2, $farr) {
    for ($f=0; $f &lt; count($farr); $f++)
    echo $farr[$f]($var1,$var2)."\n";
}

// create a bunch of math functions
$f1 = 'if ($a &gt;=0) {return "b*a^2 = ".$b*sqrt($a);} else {return false;}';
$f2 = "return \"min(b^2+a, a^2,b) = \".min(\$a*\$a+\$b,\$b*\$b+\$a);";
$f3 = 'if ($a &gt; 0 &amp;&amp; $b != 0) {return "ln(a)/b = ".log($a)/$b;} else 
{return false;}';
$farr = array(
    create_function('$x,$y', 'return "some trig: ".(sin($x) + $x*cos($y));'),
    create_function('$x,$y', 'return "a hypotenuse: ".sqrt($x*$x + $y*$y);'),
    create_function('$a,$b', $f1),
    create_function('$a,$b', $f2),
    create_function('$a,$b', $f3)
    );

echo "\nUsing the first array of anonymous functions\n";
echo "parameters: 2.3445, M_PI\n";
process(2.3445, M_PI, $farr);

// now make a bunch of string processing functions
$garr = array(
    create_function('$b,$a','if (strncmp($a,$b,3) == 0) return "** \"$a\" '.
    'and \"$b\"\n** Look the same to me! (looking at the first 3 chars)";'),
    create_function('$a,$b','; return "CRCs: ".crc32($a)." , ".crc32(b);'),
    create_function('$a,$b','; return "similar(a,b) = 
".similar_text($a,$b,&$p)."($p%)";')
    );
echo "\nUsing the second array of anonymous functions\n";
process("Twas brilling and the slithy toves", "Twas the night", $garr);
      </programlisting>
     </example>
     and when you run the code above, the output will be:
     <informalexample>
      <programlisting>
Using the first array of anonymous functions
parameters: 2.3445, M_PI
some trig: -1.6291725057799
a hypotenuse: 3.9199852871011
b*a^2 = 4.8103313314525
min(b^2+a, a^2,b) = 8.6382729035898
ln(a/b) = 0.27122299212594

Using the second array of anonymous functions
** "Twas the night" and "Twas brilling and the slithy toves"
** Look the same to me! (looking at the first 3 chars)
CRCs: -725381282 , 1908338681
similar(a,b) = 11(45.833333333333%)
      </programlisting>
     </informalexample>
    But perhaps the most common use for of lambda-style (anonymous) functions
    is to create callback functions, for example when using
    <function>array_walk</function> or <function>usort</function>
    <example>
     <title>Using anonymous functions as callback functions</title>
     <programlisting role="php">
$av = array("the ","a ","that ","this ");
array_walk($av, create_function('&$v,$k','$v = $v."mango";'));
print_r($av);  // for PHP 3 use var_dump()
// outputs:
// Array
// (
//   [0] =&gt; the mango
//   [1] =&gt; a mango
//   [2] =&gt; that mango
//   [3] =&gt; this mango
// )

// an array of strings ordered from shorter to longer
$sv = array("small","larger","a big string","it is a string thing");
print_r($sv);
// outputs:
// Array
// (
//   [0] =&gt; small
//   [1] =&gt; larger
//   [2] =&gt; a big string
//   [3] =&gt; it is a string thing
// )

// sort it from longer to shorter
usort($sv, create_function('$a,$b','return strlen($b) - strlen($a);'));
print_r($sv);
// outputs:
// Array
// (
//   [0] =&gt; it is a string thing
//   [1] =&gt; a big string
//   [2] =&gt; larger
//   [3] =&gt; small
// )
     </programlisting>
    </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.func-get-arg">
   <refnamediv>
    <refname>func_get_arg</refname>
    <refpurpose>Return an item from the argument list</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>func_get_arg</function></funcdef>
      <paramdef>int <parameter>arg_num</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns the argument which is at the
     <parameter>arg_num</parameter>'th offset into a user-defined
     function's argument list. Function arguments are counted starting
     from zero. <function>Func_get_arg</function> will generate a
     warning if called from outside of a function definition.
    </simpara>
    <simpara>
     If <parameter>arg_num</parameter> is greater than the number of
     arguments actually passed, a warning will be generated and
     <function>func_get_arg</function> will return FALSE.
    </simpara>
    <para>
     <informalexample>
      <programlisting role="php">
&lt;?php
function foo() {
     $numargs = func_num_args();
     echo "Number of arguments: $numargs&lt;br&gt;\n";
     if ($numargs &gt;= 2) {
     echo "Second argument is: " . func_get_arg (1) . "&lt;br&gt;\n";
     }
} 

foo (1, 2, 3);
?&gt;
      </programlisting>
     </informalexample>
    </para>
    <simpara>
     <function>Func_get_arg</function> may be used in conjunction with
     <function>func_num_args</function> and
     <function>func_get_args</function> to allow user-defined
     functions to accept variable-length argument lists.
    </simpara>
    <note>
     <simpara>
      This function was added in PHP 4.
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.func-get-args">
   <refnamediv>
    <refname>func_get_args</refname>
    <refpurpose>
     Returns an array comprising a function's argument list
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>func_get_args</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns an array in which each element is the corresponding
     member of the current user-defined function's argument
     list. <function>Func_get_args</function> will generate a warning
     if called from outside of a function definition.
    </simpara>
    <para>
     <informalexample>
      <programlisting role="php">
&lt;?php
function foo() {
    $numargs = func_num_args();
    echo "Number of arguments: $numargs&lt;br&gt;\n";
    if ($numargs &gt;= 2) {
    echo "Second argument is: " . func_get_arg (1) . "&lt;br&gt;\n";
    }
    $arg_list = func_get_args();
    for ($i = 0; $i &lt; $numargs; $i++) {
    echo "Argument $i is: " . $arg_list[$i] . "&lt;br&gt;\n";
    }
} 

foo (1, 2, 3);
?&gt;
      </programlisting>
     </informalexample>
    </para>
    <simpara>
     <function>Func_get_args</function> may be used in conjunction
     with <function>func_num_args</function> and
     <function>func_get_arg</function> to allow user-defined functions
     to accept variable-length argument lists.
    </simpara>
    <note>
     <simpara>
      This function was added in PHP 4.
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.func-num-args">
   <refnamediv>
    <refname>func_num_args</refname>
    <refpurpose>
     Returns the number of arguments passed to the function
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>func_num_args</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns the number of arguments passed into the current
     user-defined function. <function>Func_num_args</function> will
     generate a warning if called from outside of a function
     definition.
    </simpara>
    <para>
     <informalexample>
      <programlisting role="php">
&lt;?php
function foo() {
    $numargs = func_num_args();
    echo "Number of arguments: $numargs\n";
} 

foo (1, 2, 3);    // Prints 'Number of arguments: 3'
?&gt;
      </programlisting>
     </informalexample>
    </para>
    <simpara>
     <function>Func_num_args</function> may be used in conjunction
     with <function>func_get_arg</function> and
     <function>func_get_args</function> to allow user-defined
     functions to accept variable-length argument lists.
    </simpara>
    <note>
     <simpara>
      This function was added in PHP 4.
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.function-exists">
   <refnamediv>
    <refname>function_exists</refname>
    <refpurpose>
     Return true if the given function has been defined
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>function_exists</function></funcdef>
      <paramdef>string <parameter>function_name</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Checks the list of defined functions for
     <parameter>function_name</parameter>.    Returns true if the given
     function name was found, false otherwise.
     <informalexample>
      <programlisting role="php">
if (function_exists('imap_open')) {
    echo "IMAP functions are available.&lt;br&gt;\n";
} else {
    echo "IMAP functions are not available.&lt;br&gt;\n";
}
      </programlisting>
     </informalexample>
     Note that a function name may exist, even if the function itself
     is unusable due to configuration or compiling options. 
    </para>
    <para>
     See also <function>method_exists</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.register-shutdown-function">
   <refnamediv>
    <refname>register_shutdown_function</refname>
    <refpurpose>
     Register a function for execution on shutdown
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>register_shutdown_function</function>
      </funcdef>
      <paramdef>string <parameter>func</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Registers the function named by <parameter>func</parameter> to be
     executed when script processing is complete.</simpara>
    <para>
     Common Pitfalls:
    </para>
    <simpara>
     Since no output is allowed to the browser in this function, you
     will be unable to debug it using statements such as print or
     echo.
    </simpara>
   </refsect1>
  </refentry>
  
 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/gettext.xml
+++ phpdoc/kr/functions/gettext.xml
 <reference id="ref.gettext">
  <title>GNU Gettext</title>
  <titleabbrev>gettext</titleabbrev>

  <partintro>
        <simpara>
         The gettext functions implement a NLS (Native Language Support)
         API which can be used to internationalize your PHP applications.
         Please see the GNU gettext documentation for a thorough explanation
         of these functions.
        </simpara>
  </partintro>
  <refentry id="function.bindtextdomain">
   <refnamediv>
    <refname>bindtextdomain</refname>
    <refpurpose>Sets the path for a domain</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>bindtextdomain</function></funcdef>
      <paramdef>string <parameter>domain</parameter></paramdef>
      <paramdef>string <parameter>directory</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>bindtextdomain</function> function sets the path
     for a domain.
    </para>
   </refsect1>
  </refentry>
  <refentry id="function.dcgettext">
   <refnamediv>
    <refname>dcgettext</refname>
    <refpurpose>Overrides the domain for a single lookup</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>dcgettext</function></funcdef>
      <paramdef>string <parameter>domain</parameter></paramdef>
      <paramdef>string <parameter>message</parameter></paramdef>
      <paramdef>int <parameter>category</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function allows you to override the current domain for a
     single message lookup. It also allows you to specify a category.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dgettext">
   <refnamediv>
    <refname>dgettext</refname>
    <refpurpose>Override the current domain</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>dgettext</function></funcdef>
      <paramdef>string <parameter>domain</parameter></paramdef>
      <paramdef>string <parameter>message</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>dgettext</function> function allows you to override
     the current domain for a single message lookup.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.gettext">
   <refnamediv>
    <refname>gettext</refname>
    <refpurpose>Lookup a message in the current domain</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>gettext</function></funcdef>
      <paramdef>string <parameter>message</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns a translated string if one is found in the
     translation table, or the submitted message if not found. You may
     use an underscore character as an alias to this function.
    </para>
    <example>
     <title><function>Gettext</function>-check</title>
     <programlisting>
&lt;?php
// Set language to German
putenv ("LANG=de");

// Specify location of translation tables
bindtextdomain ("myPHPApp", "./locale");

// Choose domain
textdomain ("myPHPApp");

// Print a test message
print (gettext ("Welcome to My PHP Application"));
?>
     </programlisting>
    </example>
   </refsect1>
  </refentry>
  
  <refentry id="function.textdomain">
   <refnamediv>
    <refname>textdomain</refname>
    <refpurpose>Sets the default domain</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>textdomain</function></funcdef>
      <paramdef>string <parameter>text_domain</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function sets the domain to search within when calls are
     made to <function>gettext</function>, usually the named after an
     application.  The previous default domain is returned.  Call it
     with no parameters to get the current setting without changing
     it.
    </para>
   </refsect1>
  </refentry>
 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/gmp.xml
+++ phpdoc/kr/functions/gmp.xml
 <reference id="ref.gmp">
  <title>GMP functions</title>
  <titleabbrev>GMP</titleabbrev>
  <partintro>
   <simpara>
    These functions allow you to work with arbitrary-length integers
    using the GNU <acronym>MP</acronym> library. In order to have these
    functions available, you must compile PHP with
    <acronym>GMP</acronym> support by using the <option
    role="configure">--with-gmp</option> option.
   </simpara>
   <simpara>
    You can download the <acronym>GMP</acronym> library from <ulink
    url="&url.gmp;">&url.gmp;</ulink>.  This site also has the
    <acronym>GMP</acronym> manual available.
   </simpara>
   <simpara>
    You will need GMP version 2 or better to use these functions. Some
    functions may require more recent version of the GMP library.
   </simpara>
   <simpara>
    These functions have been added in PHP 4.0.4. 
   </simpara>
   <note>
    <para>
     Most GMP functions accept GMP number arguments, defined as
     <literal>resource</literal> below. However, most of these
     functions will also accept numeric and string arguments, given
     that it is possible to convert the latter to a number. Also, 
     if there is a faster function that can operate on integer arguments,
     it would be used instead of the slower function when the supplied arguments are
     integers. This is done transparently, so the bottom line is that
     you can use integers in every function that expects GMP
     number. See also the <function>gmp_init</function> function.
    </para>
   </note>
   <para>
    <example>
     <title>Factorial function using GMP</title>
     <programlisting role="php">
&lt;?php
function fact ($x) {
    if ($x <= 1) 
        return 1;
    else
        return gmp_mul ($x, fact ($x-1));
}

print gmp_strval (fact (1000)) . "\n";
?>
     </programlisting>
    </example>
   </para>
   <para>
    This will calculate factiorial of 1000 (pretty big number)
    very fast.
   </para>
  </partintro>

  <refentry id="function.gmp-init">
   <refnamediv>
    <refname>gmp_init</refname>
    <refpurpose>Create GMP number</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_init</function></funcdef>
      <paramdef>mixed <parameter>number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Creates a GMP number from an integer or string. String
     representation can be decimal or hexadecimal. In the latter case,
     the string should start with <literal>0x</literal>.
    </para>
    <para>
     <example>
      <title>Creating GMP number</title>
      <programlisting role="php">
&lt;?php
    $a = gmp_init (123456);
    $b = gmp_init ("0xFFFFDEBACDFEDF7200");
?>
      </programlisting>
     </example>
    </para>
    <note>
     <para>
      It is not necessary to call this function if you want to use
      integer or string in place of GMP number in GMP functions, like
      <function>gmp_add</function>. Function arguments are
      automatically converted to GMP numbers, if such conversion is
      possible and needed, using the same rules as
      <function>gmp_init</function>.
     </para>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-intval">
   <refnamediv>
    <refname>gmp_intval</refname>
    <refpurpose>Convert GMP number to integer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gmp_intval</function></funcdef>
     <paramdef>resource <parameter>gmpnumber</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function allows to convert GMP number to integer.
     <warning>
      <simpara> 
       This function returns a useful result only if the number actually
       fits the PHP integer (i.e., signed long type). If you want just
       to print the GMP number, use <function>gmp_strval</function>.
      </simpara>
     </warning>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-strval">
   <refnamediv>
    <refname>gmp_strval</refname>
    <refpurpose>Convert GMP number to string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>gmp_strval</function></funcdef>
     <paramdef>resource <parameter>gmpnumber</parameter></paramdef>
     <paramdef>int
      <parameter><optional>base</optional></parameter>
     </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Convert GMP number to string representation in base
     <parameter>base</parameter>. The default base is 10.  Allowed
     values for the base are from 2 to 36.
    </para>
    <para>
     <example>
      <title>Converting a GMP number to a string</title>
      <programlisting role="php">
&lt;?php
    $a = gmp_init("0x41682179fbf5");
    printf ("Decimal: %s, 36-based: %s", gmp_strval($a), gmp_strval($a,36));
?>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-add">
   <refnamediv>
    <refname>gmp_add</refname>
    <refpurpose>Add numbers</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_add</function></funcdef>
     <paramdef>resource <parameter>a</parameter></paramdef>
     <paramdef>resource <parameter>b</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Add two GMP numbers. The result will be a GMP number representing
     the sum of the arguments.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-sub">
   <refnamediv>
    <refname>gmp_sub</refname>
    <refpurpose>Subtract numbers</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_sub</function></funcdef>
     <paramdef>resource <parameter>a</parameter></paramdef>
     <paramdef>resource <parameter>b</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Subtracts <parameter>b</parameter> from <parameter>a</parameter>
     and returns the result.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-mul">
   <refnamediv>
    <refname>gmp_mul</refname>
    <refpurpose>Multiply numbers</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_mul</function></funcdef>
     <paramdef>resource <parameter>a</parameter></paramdef>
     <paramdef>resource <parameter>b</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Multiplies <parameter>a</parameter> by <parameter>b</parameter>
     and returns the result.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-div-q">
   <refnamediv>
    <refname>gmp_div_q</refname>
    <refpurpose>Divide numbers</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_div_q</function></funcdef>
     <paramdef>resource <parameter>a</parameter></paramdef>
     <paramdef>resource <parameter>b</parameter></paramdef>
     <paramdef>int
      <parameter><optional>round</optional></parameter>
     </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Divides <parameter>a</parameter> by <parameter>b</parameter> and
     returns the integer result. The result rounding is defined by the
     <parameter>round</parameter>, which can have the following
     values:
     <itemizedlist>
      <listitem>
       <simpara>
        <parameter>GMP_ROUND_ZERO</parameter>: The result is truncated
        towards 0.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>GMP_ROUND_PLUSINF</parameter>: The result is
        rounded towards <literal>+infinity</literal>.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <parameter>GMP_ROUND_MINUSINF</parameter>: The result is
        rounded towards <literal>-infinity</literal>.
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <simpara>
     This function can also be called as <function>gmp_div</function>.
    </simpara>
    <para>
     See also <function>gmp_div_r</function>,
     <function>gmp_div_qr</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-div-r">
   <refnamediv>
    <refname>gmp_div_r</refname>
    <refpurpose>Remainder of the division of numbers</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_div_r</function></funcdef>
     <paramdef>resource <parameter>n</parameter></paramdef>
     <paramdef>resource <parameter>d</parameter></paramdef>
     <paramdef>int
      <parameter><optional>round</optional></parameter>
     </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Calculates remainder of the integer division of
     <parameter>n</parameter> by <parameter>d</parameter>. The
     remainder has the sign of the <parameter>n</parameter> argument,
     if not zero.
    </para>
    <para>
     See the <function>gmp_div_q</function> function for description
     of the <parameter>round</parameter> argument.
    </para>
    <para>
     See also <function>gmp_div_q</function>,
     <function>gmp_div_qr</function>
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.gmp-div-qr">
   <refnamediv>
    <refname>gmp_div_qr</refname>
    <refpurpose>Divide numbers and get quotient and remainder</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>gmp_div_qr</function></funcdef>
      <paramdef>resource <parameter>n</parameter></paramdef>
      <paramdef>resource <parameter>d</parameter></paramdef>
      <paramdef>int
       <parameter><optional>round</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The function divides <parameter>n</parameter> by
     <parameter>d</parameter> and returns array, with the first
     element being <literal>[n/d]</literal> (the integer result of the
     division) and the second being <literal>(n - [n/d] * d)</literal>
     (the remainder of the division).
    </para>
    <para>
     See the <function>gmp_div_q</function> function for description
     of the <parameter>round</parameter> argument.
    </para>
    <para>
     <example>
      <title>Division of GMP numbers</title>
      <programlisting role="php">
&lt;?php
    $a = gmp_init ("0x41682179fbf5");
    $res = gmp_div_qr ($a, "0xDEFE75");
    printf("Result is: q - %s, r - %s", 
            gmp_strval ($res[0]), gmp_strval ($res[1]));
?>
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>gmp_div_q</function>,
     <function>gmp_div_r</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-div">
   <refnamediv>
    <refname>gmp_div</refname>
    <refpurpose>Divide numbers</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_divexact</function></funcdef>
      <paramdef>resource <parameter>a</parameter></paramdef>
      <paramdef>resource <parameter>b</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function is an alias to <function>gmp_div_q</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-mod">
   <refnamediv>
    <refname>gmp_mod</refname>
    <refpurpose>Modulo operation</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_mod</function></funcdef>
      <paramdef>resource <parameter>n</parameter></paramdef>
      <paramdef>resource <parameter>d</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Calculates <parameter>n</parameter> modulo
     <parameter>d</parameter>. The result is always non-negative, the
     sign of <parameter>d</parameter> is ignored.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-divexact">
   <refnamediv>
    <refname>gmp_divexact</refname>
    <refpurpose>Exact division of numbers</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_divexact</function></funcdef>
      <paramdef>resource <parameter>n</parameter></paramdef>
      <paramdef>resource <parameter>d</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Divides <parameter>n</parameter> by <parameter>d</parameter>,
     using fast "exact division" algorithm. This function produces
     correct results only when it is known in advance that
     <parameter>d</parameter> divides <parameter>n</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-cmp">
   <refnamediv>
    <refname>gmp_cmp</refname>
    <refpurpose>Compare numbers</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gmp_cmp</function></funcdef>
      <paramdef>resource <parameter>a</parameter></paramdef>
      <paramdef>resource <parameter>b</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a positive value if <literal>a > b</literal>, zero if
     <literal>a = b</literal> and negative value if <literal>a &lt;
     b</literal>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-neg">
   <refnamediv>
    <refname>gmp_neg</refname>
    <refpurpose>Negate number</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_neg</function></funcdef>
      <paramdef>resource <parameter>a</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns -<parameter>a</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-abs">
   <refnamediv>
    <refname>gmp_abs</refname>
    <refpurpose>Absolute value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_abs</function></funcdef>
      <paramdef>resource <parameter>a</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns absolute value of <parameter>a</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-sign">
   <refnamediv>
    <refname>gmp_sign</refname>
    <refpurpose>Sign of number</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gmp_sign</function></funcdef>
     <paramdef>resource <parameter>a</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Return sign of <parameter>a</parameter> - 1 if
     <parameter>a</parameter> is positive and -1 if it's negative.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-fact">
   <refnamediv>
    <refname>gmp_fact</refname>
    <refpurpose>Factorial</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_fact</function></funcdef>
      <paramdef>int <parameter>a</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Calculates factorial (<literal>a!</literal>) of <parameter>a</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-sqrt">
   <refnamediv>
    <refname>gmp_sqrt</refname>
    <refpurpose>Square root</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_sqrt</function></funcdef>
     <paramdef>resource <parameter>a</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Calculates square root of <parameter>a</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-sqrtrm">
   <refnamediv>
    <refname>gmp_sqrtrm</refname>
    <refpurpose>Square root with remainder</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>gmp_sqrtrm</function></funcdef>
      <paramdef>resource <parameter>a</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns array where first element is the integer square root of
     <parameter>a</parameter> (see also
     <function>gmp_sqrt</function>), and the second is the remainder
     (i.e., the difference between <parameter>a</parameter> and the
     first element squared).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-perfect-square">
   <refnamediv>
    <refname>gmp_perfect_square</refname>
    <refpurpose>Perfect square check</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>gmp_perfect_square</function></funcdef>
      <paramdef>resource <parameter>a</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true if <parameter>a</parameter> is a perfect square,
     false otherwise.
    </para>
    <para>
     See also: <function>gmp_sqrt</function>,
     <function>gmp_sqrtrm</function>.  
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-pow">
   <refnamediv>
    <refname>gmp_pow</refname>
    <refpurpose>Raise number into power</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_pow</function></funcdef>
      <paramdef>resource <parameter>base</parameter></paramdef>
      <paramdef>int <parameter>exp</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Raise <parameter>base</parameter> into power
     <parameter>exp</parameter>. The case of 0^0 yields
     1. <parameter>exp</parameter> cannot be negative.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-powm">
   <refnamediv>
    <refname>gmp_powm</refname>
    <refpurpose>Raise number into power with modulo</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_powm</function></funcdef>
      <paramdef>resource <parameter>base</parameter></paramdef>
      <paramdef>resource <parameter>exp</parameter></paramdef>
      <paramdef>resource <parameter>mod</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Calculate (<parameter>base</parameter> raised into power
     <parameter>exp</parameter>) modulo <parameter>mod</parameter>. If
     <parameter>exp</parameter> is negative, result is undefined.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-prob-prime">
   <refnamediv>
    <refname>gmp_prob_prime</refname>
    <refpurpose>Check if number is "probably prime"</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gmp_prob_prime</function></funcdef>
      <paramdef>resource <parameter>a</parameter></paramdef>
      <paramdef>int <parameter><optional>reps</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     If this function returns 0, <parameter>a</parameter> is
     definitely not prime. If it returns 1, then
     <parameter>a</parameter> is "probably" prime.  If it returns 2,
     then <parameter>a</parameter> is surely prime. Reasonable values
     of <parameter>reps</parameter> vary from 5 to 10 (default being
     10); a higher value lowers the probability for a non-prime to
     pass as a "probable" prime.
    </para>
    <para>
     The function uses Miller-Rabin's probabilistic test.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-gcd">
   <refnamediv>
    <refname>gmp_gcd</refname>
    <refpurpose>Calculate GCD</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_gcd</function></funcdef>
     <paramdef>resource <parameter>a</parameter></paramdef>
     <paramdef>resource <parameter>b</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Calculate greatest common divisor of <parameter>a</parameter> and
     <parameter>b</parameter>. The result is always positive even if
     either of, or both, input operands are negative.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-gcdext">
   <refnamediv>
    <refname>gmp_gcdext</refname>
    <refpurpose>Calculate GCD and multipliers</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>gmp_gcdext</function></funcdef>
      <paramdef>resource <parameter>a</parameter></paramdef>
      <paramdef>resource <parameter>b</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Calculates g, s, and t, such that <literal>a*s + b*t = g =
     gcd(a,b)</literal>, where gcd is the greatest common divisor. Returns
     an array with respective elements g, s and t.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-invert">
   <refnamediv>
    <refname>gmp_invert</refname>
    <refpurpose>Inverse by modulo</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_invert</function></funcdef>
      <paramdef>resource <parameter>a</parameter></paramdef>
      <paramdef>resource <parameter>b</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Computes the inverse of <parameter>a</parameter> modulo
     <parameter>b</parameter>. Returns false if an inverse does not
     exist.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-legendre">
   <refnamediv>
    <refname>gmp_legendre</refname>
    <refpurpose>Legendre symbol</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gmp_legendre</function></funcdef>
      <paramdef>resource <parameter>a</parameter></paramdef>
      <paramdef>resource <parameter>p</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Compute the
     <ulink url="http://www.utm.edu/research/primes/glossary/LegendreSymbol.html">
     Legendre symbol</ulink> of <parameter>a</parameter> and
     <parameter>p</parameter>. <parameter>p</parameter> should be odd
     and must be positive.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-jacobi">
   <refnamediv>
    <refname>gmp_jacobi</refname>
    <refpurpose>Jacobi symbol</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gmp_jacobi</function></funcdef>
      <paramdef>resource <parameter>a</parameter></paramdef>
      <paramdef>resource <parameter>p</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Computes
     <ulink url="http://www.utm.edu/research/primes/glossary/JacobiSymbol.html">
     Jacobi symbol</ulink> of <parameter>a</parameter> and
     <parameter>p</parameter>. <parameter>p</parameter> should be odd
     and must be positive.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-random">
   <refnamediv>
    <refname>gmp_random</refname>
    <refpurpose>Random number</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_random</function></funcdef>
      <paramdef>int <parameter>limiter</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Generate a random number. The number will be up to
     <parameter>limiter</parameter> words long. If
     <parameter>limiter</parameter> is negative, negative numbers are
     generated.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-and">
   <refnamediv>
    <refname>gmp_and</refname>
    <refpurpose>Logical AND</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_and</function></funcdef>
      <paramdef>resource <parameter>a</parameter></paramdef>
      <paramdef>resource <parameter>b</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Calculates logical AND of two GMP numbers.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-or">
   <refnamediv>
    <refname>gmp_or</refname>
    <refpurpose>Logical OR</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_or</function></funcdef>
      <paramdef>resource <parameter>a</parameter></paramdef>
      <paramdef>resource <parameter>b</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Calculates logical inclusive OR of two GMP numbers.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-xor">
   <refnamediv>
    <refname>gmp_xor</refname>
    <refpurpose>Logical XOR</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_xor</function></funcdef>
      <paramdef>resource <parameter>a</parameter></paramdef>
      <paramdef>resource <parameter>b</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Calculates logical exclusive OR (XOR) of two GMP numbers.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-setbit">
   <refnamediv>
    <refname>gmp_setbit</refname>
    <refpurpose>Set bit</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_setbit</function></funcdef>
      <paramdef>resource <parameter>&amp;a</parameter></paramdef>
      <paramdef>int <parameter>index</parameter></paramdef>
      <paramdef>bool 
       <parameter><optional>set_clear</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets bit <parameter>index</parameter> in
     <parameter>a</parameter>. <parameter>set_clear</parameter>
     defines if the bit is set to 0 or 1. By default the bit is set to
     1.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-clrbit">
   <refnamediv>
    <refname>gmp_clrbit</refname>
    <refpurpose>Clear bit</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>gmp_clrbit</function></funcdef>
      <paramdef>resource <parameter>&amp;a</parameter></paramdef>
      <paramdef>int <parameter>index</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Clears (sets to 0) bit <parameter>index</parameter> in
     <parameter>a</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-scan0">
   <refnamediv>
    <refname>gmp_scan0</refname>
    <refpurpose>Scan for 0</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gmp_scan0</function></funcdef>
      <paramdef>resource <parameter>a</parameter></paramdef>
      <paramdef>int <parameter>start</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Scans <parameter>a</parameter>, starting with bit
     <parameter>start</parameter>, towards more significant bits,
     until the first clear bit is found. Returns the index of the
     found bit.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-scan1">
   <refnamediv>
    <refname>gmp_scan1</refname>
    <refpurpose>Scan for 1</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gmp_scan1</function></funcdef>
      <paramdef>resource <parameter>a</parameter></paramdef>
      <paramdef>int <parameter>start</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Scans <parameter>a</parameter>, starting with bit
     <parameter>start</parameter>, towards more significant bits,
     until the first set bit is found. Returns the index of the found
     bit.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-popcount">
   <refnamediv>
    <refname>gmp_popcount</refname>
    <refpurpose>Population count</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gmp_popcount</function></funcdef>
      <paramdef>resource <parameter>a</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Return the population count of <parameter>a</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gmp-hamdist">
   <refnamediv>
    <refname>gmp_hamdist</refname>
    <refpurpose>Hamming distance</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gmp_hamdist</function></funcdef>
      <paramdef>resource <parameter>a</parameter></paramdef>
      <paramdef>resource <parameter>b</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the hamming distance between <parameter>a</parameter> and
     <parameter>b</parameter>. Both operands should be non-negative.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->


Index: phpdoc/kr/functions/http.xml
+++ phpdoc/kr/functions/http.xml
 <reference id="ref.http">
  <title>HTTP functions</title>
  <titleabbrev>HTTP</titleabbrev>

  <partintro>
   <simpara>
    These functions let you manipulate the output sent back to the
    remote browser right down to the HTTP protocol level.
   </simpara>
  </partintro>

  <refentry id="function.header">
   <refnamediv>
    <refname>header</refname>
    <refpurpose>Send a raw HTTP header</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>header</function></funcdef>
      <paramdef>string <parameter>string</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>Header</function> function is used at the top of an
     <acronym>HTML</acronym> file to send raw <acronym>HTTP</acronym>
     header strings.  See the <ulink url="&spec.http1.1;">HTTP 1.1
     Specification</ulink> for more information on raw http headers.
     <emphasis>Note:</emphasis> Remember that the
     <function>Header</function> function must be called before any
     actual output is sent either by normal HTML tags or from PHP. It
     is a very common error to read code with
     <function>include</function> or with auto_prepend and have spaces
     or empty lines in this code that force output before
     <function>header</function> is called.
    </para>
    <para>
     There are two special-case header calls.  The first is the
     &quot;Location&quot; header.  Not only does it send this header
     back to the browser, it also returns a REDIRECT status code to
     Apache.  From a script writer's point of view this should not be
     important, but for people who understand Apache internals it is
     important to understand.
     <informalexample>
      <programlisting role="php">
header ("Location: http://www.php.net"); /* Redirect browser 
                                            to PHP web site */
exit;                 /* Make sure that code below does 
                         not get executed when we redirect. */
      </programlisting>
     </informalexample>
    </para>
    <para>
     The second special-case is any header that starts with the
     string, &quot;HTTP/&quot; (case is not significant).  For
     example, if you have your ErrorDocument 404 Apache directive
     pointed to a PHP script, it would be a good idea to make sure
     that your PHP script is actually generating a 404.  The first
     thing you do in your script should then be:
     <informalexample>
      <programlisting role="php">
header ("HTTP/1.0 404 Not Found");
      </programlisting>
     </informalexample>
    </para>
    <para>
     PHP scripts often generate dynamic HTML that must not be cached
     by the client browser or any proxy caches between the server and the
     client browser. Many proxies and clients can be forced to disable
     caching with
     <informalexample>
      <programlisting role="php">
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    // Date in the past
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 
                                                      // always modified
header ("Cache-Control: no-cache, must-revalidate");  // HTTP/1.1
header ("Pragma: no-cache");                          // HTTP/1.0
      </programlisting>
     </informalexample>
    </para>
    <para>
     See also <function>headers_sent</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.headers-sent">
   <refnamediv>
    <refname>headers_sent</refname>
    <refpurpose>Returns true if headers have been sent</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>headers_sent</function></funcdef>
      <paramdef><parameter>void</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns true if the HTTP headers have already been
     sent, false otherwise.
    </para>
    <para>
     See also <function>header</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.setcookie">
   <refnamediv>
    <refname>setcookie</refname>
    <refpurpose>Send a cookie</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>setcookie</function></funcdef>
      <paramdef>string <parameter>name</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>value</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>expire</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>path</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>domain</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>secure</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Setcookie</function> defines a cookie to be sent along
     with the rest of the header information.  Cookies must be sent
     <emphasis>before</emphasis> any other headers are sent (this is a
     restriction of cookies, not PHP). This requires you to place
     calls to this function before any <literal>&lt;html></literal> or
     <literal>&lt;head></literal> tags.
    </para>
    <para>
     All the arguments except the <parameter>name</parameter> argument
     are optional.  If only the name argument is present, the cookie
     by that name will be deleted from the remote client.  You may
     also replace any argument with an empty string
     (<emphasis>&quot;&quot;</emphasis>) in order to skip that
     argument.  The <parameter>expire</parameter> and
     <parameter>secure</parameter> arguments are integers and cannot
     be skipped with an empty string.  Use a zero
     (<emphasis>0</emphasis>) instead.  The
     <parameter>expire</parameter> argument is a regular Unix time
     integer as returned by the <function>time</function> or
     <function>mktime</function> functions.  The
     <parameter>secure</parameter> indicates that the cookie should
     only be transmitted over a secure HTTPS connection.
    </para>
    <para>
     Common Pitfalls:
     <itemizedlist>
      <listitem>
       <simpara>
        Cookies will not become visible until the next loading of a page that 
        the cookie should be visible for.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        Cookies must be deleted with the same parameters as they were set with.
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <simpara>
     In PHP 3, multiple calls to <function>setcookie</function> in the same
     script will be performed in reverse order. If you are trying to
     delete one cookie before inserting another you should put the
     insert before the delete. In PHP 4, multiple calls to
     <function>setcookie</function> are performed in the order called.
    </simpara>
    <para>
     Some examples follow how to send cookies:
     <example>
      <title><function>Setcookie</function> send examples</title>
      <programlisting role="php">
setcookie ("TestCookie", "Test Value");
setcookie ("TestCookie", $value,time()+3600);  /* expire in 1 hour */
setcookie ("TestCookie", $value,time()+3600, "/~rasmus/", ".utoronto.ca", 1);
      </programlisting>
     </example>
    </para>
    <para>
     Examples follow how to delete cookies send in previous example:
     <example>
      <title><function>setcookie</function> delete examples</title>
      <programlisting role="php">
setcookie ("TestCookie");
// set the expiration date to one hour ago
setcookie ("TestCookie", "", time() - 3600);
setcookie ("TestCookie", "", time() - 3600, "/~rasmus/", ".utoronto.ca", 1);
      </programlisting>
     </example>
         When deleting a cookie you should assure that the expiration date
         is in the past, to trigger the removal mechanism in your browser.
        </para>
    <para>
     Note that the value portion of the cookie will automatically be
     urlencoded when you send the cookie, and when it is received, it
     is automatically decoded and assigned to a variable by the same
     name as the cookie name.  To see the contents of our test
     cookie in a script, simply use one of the following examples:
     <informalexample>
      <programlisting role="php">
echo $TestCookie;
echo $HTTP_COOKIE_VARS["TestCookie"];
      </programlisting>
     </informalexample>
    </para>
    <para>
     You may also set array cookies by using array notation in the
     cookie name. This has the effect of setting as many cookies as
     you have array elements, but when the cookie is received by your
     script, the values are all placed in an array with the cookie's
     name:
     <informalexample>
      <programlisting role="php">
setcookie ("cookie[three]", "cookiethree");
setcookie ("cookie[two]", "cookietwo");
setcookie ("cookie[one]", "cookieone");
if (isset ($cookie)) {
    while (list ($name, $value) = each ($cookie)) {
        echo "$name == $value&lt;br>\n";
    }
}
      </programlisting>
     </informalexample>
    </para>
    <para>
     For more information on cookies, see Netscape's cookie
     specification at <ulink
     url="&spec.cookies;">&spec.cookies;</ulink>.
    </para>
    <simpara>
     Microsoft Internet Explorer 4 with Service Pack 1 applied does
     not correctly deal with cookies that have their path parameter
     set.
    </simpara>
    <simpara>
     Netscape Communicator 4.05 and Microsoft Internet Explorer 3.x
     appear to handle cookies incorrectly when the path and time
     are not set.
    </simpara>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/hw.xml
+++ phpdoc/kr/functions/hw.xml
 <reference id="ref.hyperwave">
  <title>Hyperwave functions</title>
  <titleabbrev>Hyperwave</titleabbrev>

  <partintro>

   <sect1 id="hw-intro">
    <title>Introduction</title>
    <para>
     <productname>Hyperwave</productname> has been developed at <ulink 
url="&url.iicm;">IICM</ulink> in Graz. It started with
     the name <acronym>Hyper-G</acronym> and changed to Hyperwave when
     it was commercialised (If I remember properly it was in 1996).
    </para>
    <para>
     Hyperwave is not free software. The current version, 4.1, is
     available at <ulink url="&url.hyperwave;">www.hyperwave.com</ulink>.  
     A time limited version can be ordered for free (30 days).
    </para>
    <para>
     Hyperwave is an information system similar to a database
     (<acronym>HIS</acronym>, Hyperwave Information Server). Its focus
     is the storage and management of documents. A document can be any
     possible piece of data that may as well be stored in file. Each
     document is accompanied by its object record. The object record
     contains meta data for the document. The meta data is a list of
     attributes which can be extended by the user. Certain attributes
     are always set by the Hyperwave server, other may be modified by
     the user. An attribute is a name/value pair of the form name=value.
     The complete object record contains as many of those pairs as the
     user likes. The name of an attribute does not have to be unique,
     e.g. a title may appear several times within an object record.
     This makes sense if you want to specify a title in several languages.
     In such a case there is a convention, that each title value is
     preceded by the two letter language abbreviation followed by a colon,
     e.g. 'en:Title in English' or 'ge:Titel in deutsch'. Other attributes
     like a description or keywords are potential candidates. You may
     also replace the language abbreviation by any other string as long
     as it separated by colon from the rest of the attribute value.
    </para>
    <para>
     Each object record has native a string representation with each
     name/value
     pair separated by a newline. The Hyperwave extension also knows
     a second representation which is an associated array with the
     attribute name being the key. Multilingual attribute values itself
     form another associated array with the key being the language
     abbreviation. Actually any multiple attribute forms an associated
     array with the string left to the colon in the attribute value
     being the key. (This is not fully implemented. Only the attributes
     Title, Description and Keyword are treated properly yet.)
    </para>
    <para>
     Besides the documents, all hyper links contained in a document
     are stored as object records as well. Hyper links which
     are in a document will be removed from it and stored as individual
     objects, when the document is inserted into the database.
     The object record of the link contains information
     about where it starts and where it ends.
     In order to gain the original document you will have
     to retrieve the plain document without the links and the list
     of links and reinsert them (The functions
     <function>hw_pipedocument</function> and <function>hw_gettext</function>
     do this for you. The advantage of separating links
     from the document is obvious. Once a document to which a link
     is pointing to changes its name, the link can easily be modified
     accordingly. The document containing the link is not affected
     at all. You may even add a link to a document without modifying
     the document itself.
    </para>
    <para>
     Saying that <function>hw_pipedocument</function> and
     <function>hw_gettext</function> do the link insertion automatically
     is not as simple as it sounds. Inserting links implies a certain
     hierarchy of the documents. On a web server this is given by the
     file system, but Hyperwave has its own hierarchy and names do not
     reflect the position of an object in that hierarchy. Therefore
     creation of links first of all requires a mapping from the Hyperwave
     hierarchy and namespace into a web hierarchy respective web namespace.
     The fundamental difference between Hyperwave and the web is the clear
     distinction between names and hierarchy in Hyperwave. The name does
     not contain any information about the objects position in the hierarchy.
     In the web the
     name also contains the information on where the object is located
     in the hierarchy. This leads to two possibles ways of mapping. Either
     the Hyperwave hierarchy and name of the Hyperwave object is reflected
     in the URL or the name only.
     To make things simple the second approach is used.
     Hyperwave object with name 'my_object' is mapped to
     'http://host/my_object' disregarding where it resides in the
     Hyperwave hierarchy.
     An object with name 'parent/my_object' could be the child of
     'my_object' in the Hyperwave hierarchy, though in a web namespace it
     appears to be just the opposite and the user might get confused. 
     This can only be prevented by selecting reasonable object names.
    </para>
    <para>
     Having made this decision a second problem arises. How do you
     involve PHP? The URL http://host/my_object will not call any
     PHP script unless you tell your web server to rewrite it to
     e.g. 'http://host/php3_script/my_object' and the script 'php3_script'
     evaluates the $PATH_INFO variable and retrieves the object with
     name 'my_object' from the Hyperwave server. Their is just one little
     drawback which can be fixed easily. Rewriting any URL would not allow
     any access to other document on the web server. A PHP script for
     searching in the Hyperwave server would be impossible. Therefore
     you will need at least a second rewriting rule to exclude certain
     URLS like all e.g. starting with http://host/Hyperwave. This is
     basically sharing of a namespace by the web and Hyperwave server.
    </para>
    <para>
     Based on the above mechanism links are insert into documents.
    </para>
    <para>
     It gets more complicated if PHP is not run as a server module or CGI
     script but as a standalone application e.g. to dump the content of
     the Hyperwave server on a CD-ROM. In such a case it makes sense to
     retain the Hyperwave hierarchy and map in onto the file system. This
     conflicts with the object names if they reflect its own hierarchy
     (e.g. by choosing names including '/'). Therefore '/' has to be
     replaced by another character, e.g. '_'. to be continued.
    </para>
    <para>
     The network protocol to communicate
     with the Hyperwave server is called <ulink url="&spec.hyperwave;">HG-CSP</ulink> 
                 (Hyper-G Client/Server Protocol). It is based on messages to initiate
     certain actions, e.g. get object record.  In early versions of
     the Hyperwave Server two native clients (Harmony, Amadeus) were
     provided for communication with the server. Those two disappeared
     when Hyperwave was commercialised.  As a replacement a so called
     wavemaster was provided. The wavemaster is like a protocol converter
     from <abbrev>HTTP</abbrev> to <abbrev>HG-CSP</abbrev>.  The idea is
     to do all the administration of the database and visualisation of
     documents by a web interface.  The wavemaster implements a set of
     placeholders for certain actions to customise the interface. This
     set of placeholders is called the <abbrev>PLACE</abbrev> Language.
     <abbrev>PLACE</abbrev> lacks a lot of features of a real programming
     language and any extension to it only enlarges the list of
     placeholders. This has led to the use of JavaScript which IMO does
     not make life easier.
    </para>
    <para>
     Adding Hyperwave support to PHP should fill in the gap of a
     missing programming language for interface customisation.  It
     implements all the messages as defined by the
     <abbrev>HG-CSP</abbrev> but also provides more powerful commands
     to e.g. retrieve complete documents.
    </para>
    <para>
     Hyperwave has its own terminology to name certain pieces of
     information. This has widely been taken over and extended.
     Almost all functions operate on one of the following data types.

     <itemizedlist>
      <listitem>
       <simpara>
        object ID: An unique integer value for each object in the
        Hyperwave server. It is also one of the attributes of the
        object record (ObjectID). Object ids are often used as an
        input parameter to specify an object.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        object record: A string with attribute-value pairs of the form
        attribute=value. The pairs are separated by a carriage return
        from each other. An object record can easily be converted into
        an object array with <function>hw_object2array</function>.
        Several functions return object records.  The names of those
        functions end with obj.
       </simpara>
      </listitem> 
      <listitem>
       <simpara>
        object array: An associated array with all attributes of an
        object. The key is the attribute name. If an attribute occurs
        more than once in an object record it will result in another
        indexed or associated array. Attributes which are language
        depended (like the title, keyword, description) will form an
        associated array with the key set to the language
        abbreviation. All other multiple attributes will form an
        indexed array. PHP functions never return object arrays.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        hw_document: This is a complete new data type which holds the
        actual document, e.g. HTML, PDF etc. It is somewhat optimised
        for HTML documents but may be used for any format.
       </simpara>
      </listitem>
     </itemizedlist>
    </para> 
    <para>
     Several functions which return an array of object records do also
     return an associated array with statistical information about
     them. The array is the last element of the object record
     array. The statistical array contains the following entries:
     <variablelist>
      <varlistentry>
       <term>Hidden</term>
       <listitem>
        <simpara>
         Number of object records with attribute PresentationHints
         set to Hidden.
            </simpara>
           </listitem>
      </varlistentry>
      <varlistentry>
       <term>CollectionHead</term>
       <listitem>
        <simpara>
         Number of object records with attribute
         PresentationHints set to CollectionHead.
            </simpara>
           </listitem>
      </varlistentry>
      <varlistentry>
       <term>FullCollectionHead</term>
       <listitem>
        <simpara>
         Number of object records with attribute
         PresentationHints set to FullCollectionHead.
            </simpara>
           </listitem>
      </varlistentry>
      <varlistentry>
       <term>CollectionHeadNr</term>
       <listitem>
        <simpara>
         Index in array of object records with
         attribute PresentationHints set to CollectionHead.
            </simpara>
           </listitem>
      </varlistentry>
      <varlistentry>
       <term>FullCollectionHeadNr</term>
       <listitem>
        <simpara>
         Index in array of object records with
         attribute PresentationHints set to FullCollectionHead.
            </simpara>
           </listitem>
      </varlistentry>
      <varlistentry>
       <term>Total</term>
       <listitem>
        <simpara>
         Total: Number of object records.
            </simpara>
           </listitem>
      </varlistentry>
     </variablelist>
    </para>
   </sect1>

   <sect1 id="hw-apache">
    <title>Integration with Apache</title>
    <para>
     The Hyperwave extension is best used when PHP is compiled as an
     Apache module. In such a case the underlying Hyperwave server can
     be hidden from users almost completely if Apache uses its rewriting
     engine. The following instructions will explain this.
    </para>
    <para>
     Since PHP with Hyperwave support built into Apache is intended
     to replace the native Hyperwave solution based on Wavemaster I
     will assume that the Apache server will only serve as a Hyperwave
     web interface. This is not necessary but it simplifies the
     configuration.  The concept is quite simple. First of all you
     need a PHP script which evaluates the <envar>PATH_INFO</envar>
     variable and treats its value as the name of a Hyperwave
     object. Let's call this script 'Hyperwave'.  The URL
     <systemitem role="url">http://your.hostname/Hyperwave/name_of_object</systemitem>
     would than return the Hyperwave object with the name
     'name_of_object'. Depending on the type of the object the script
     has to react accordingly. If it is a collection, it will probably
     return a list of children. If it is a document it will return the
     mime type and the content. A slight improvement can be achieved
     if the Apache rewriting engine is used.  From the users point of
     view it would be more straight forward if the URL
     <systemitem role="url">http://your.hostname/name_of_object</systemitem> would
     return the object.  The rewriting rule is quite easy:

     <informalexample><programlisting role="apache-conf">
RewriteRule ^/(.*) /usr/local/apache/htdocs/HyperWave/$1 [L]
</programlisting></informalexample>

     Now every URL relates to an object in the Hyperwave server. This
     causes a simple to solve problem. There is no way to execute a
     different script, e.g. for searching, than the 'Hyperwave'
     script.  This can be fixed with another rewriting rule like the
     following:

     <informalexample><programlisting role="apache-conf">
RewriteRule ^/hw/(.*) /usr/local/apache/htdocs/hw/$1 [L]
</programlisting></informalexample>

     This will reserve the directory <filename 
class="directory">/usr/local/apache/htdocs/hw</filename> for
     additional scripts and other files. Just make sure this rule is
     evaluated before the one above. There is just a little drawback:
     all Hyperwave objects whose name starts with 'hw/' will be
     shadowed. So, make sure you don't use such names. If you need
     more directories, e.g. for images just add more rules or place
     them all in one directory.  Finally, don't forget to turn on the
     rewriting engine with

     <informalexample><programlisting role="apache-conf">
RewriteEngine on
</programlisting></informalexample>

     My experiences have shown that you will need the following
     scripts:

     <itemizedlist>
       <listitem>
        <simpara>
        to return the object itself
            </simpara>
           </listitem>
       <listitem>
        <simpara>
        to allow searching
            </simpara>
           </listitem>
       <listitem>
        <simpara>
        to identify yourself
            </simpara>
           </listitem>
       <listitem>
        <simpara>
        to set your profile
            </simpara>
           </listitem>
       <listitem>
        <simpara>
        one for each additional function like to show
        the object attributes, to show information about users,
        to show the status of the server, etc.
            </simpara>
           </listitem>
     </itemizedlist>
    </para>
   </sect1>

   <sect1 id="hw-todo">
    <title>Todo</title>
    <para>
     There are still some things todo:
     <itemizedlist>
      <listitem><simpara>The hw_InsertDocument has to be split into
        <function>hw_InsertObject</function> and
        <function>hw_PutDocument</function>.</simpara></listitem>
      <listitem><simpara>The names of several functions are not fixed, yet.
       </simpara></listitem>
      <listitem><simpara>Most functions require the current connection
        as its first parameter. This leads to a lot of typing, which
        is quite often not necessary if there is just one open
        connection. A default connection will
        improve this.</simpara></listitem>
      <listitem><simpara>Conversion form object record into object array
        needs to handle any multiple attribute.
       </simpara></listitem>
     </itemizedlist>
    </para>
   </sect1>
  </partintro>

  <refentry id="function.hw-array2objrec">
   <refnamediv>
    <refname>hw_Array2Objrec</refname>
    <refpurpose>convert attributes from object array to object record</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>strin <function>hw_array2objrec</function></funcdef>
      <paramdef>array <parameter>object_array</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Converts an <parameter>object_array</parameter> into an object record.
     Multiple attributes like 'Title' in different languages are treated
     properly.
    </para>
    <para>
     See also <function>hw_objrec2array</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-children">
   <refnamediv>
    <refname>hw_Children</refname>
    <refpurpose>object ids of children</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>hw_children</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>objectID</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of object ids. Each id
     belongs to a child of the collection with ID
     <parameter>objectID</parameter>.
     The array contains all children both documents and collections.</para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-childrenobj">
   <refnamediv>
    <refname>hw_ChildrenObj</refname>
    <refpurpose>object records of children</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>hw_childrenobj</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>objectID</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of object records. Each object record
     belongs to a child of the collection with ID
     <parameter>objectID</parameter>.
     The array contains all children both documents and collections.</para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-close">
   <refnamediv>
    <refname>hw_Close</refname>
    <refpurpose>closes the Hyperwave connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_close</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns false if connection is not a valid connection index,
     otherwise true.  Closes down the connection to a Hyperwave server
     with the given connection index.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-connect">
   <refnamediv>
    <refname>hw_Connect</refname>
    <refpurpose>opens a connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_connect</function></funcdef>
      <paramdef>string <parameter>host</parameter></paramdef>
      <paramdef>int <parameter>port</parameter></paramdef>
      <paramdef>string <parameter>username</parameter></paramdef>
      <paramdef>string <parameter>password</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Opens a connection to a Hyperwave server and returns a connection
     index on success, or false if the connection
     could not be made. Each of the arguments should be a quoted string,
     except for the port number. The <parameter>username</parameter> and
     <parameter>password</parameter> arguments are
     optional and can be left out. In such a case no identification with
     the server will be done. It is similar to identify as user anonymous.
     This function returns a connection
     index that is needed by other Hyperwave functions. You can have
     multiple connections open at once. Keep in mind, that the password
     is not encrypted.
    </para>
    <para>
     See also <function>hw_pConnect</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-cp">
   <refnamediv>
    <refname>hw_Cp</refname>
    <refpurpose>copies objects</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_cp</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>array <parameter>object_id_array</parameter></paramdef>
      <paramdef>int <parameter>destination id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Copies the objects with object ids as specified in the second
     parameter to the collection
     with the id <parameter>destination id</parameter>.
    </para>
    <para>
     The value return is the number of copied objects.
    </para>
    <para>
     See also <function>hw_mv</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-deleteobject">
   <refnamediv>
    <refname>hw_Deleteobject</refname>
    <refpurpose>deletes object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_deleteobject</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>object_to_delete</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Deletes the object with the given object id in the second
     parameter. It will delete all instances of the object.
    </para>
    <para>
     Returns TRUE if no error occurs otherwise FALSE.
    </para>
    <para>
     See also <function>hw_mv</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-docbyanchor">
   <refnamediv>
    <refname>hw_DocByAnchor</refname>
    <refpurpose>object id object belonging to anchor</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_docbyanchor</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>anchorID</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an th object id of the document to
     which <parameter>anchorID</parameter> belongs.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-docbyanchorobj">
   <refnamediv>
    <refname>hw_DocByAnchorObj</refname>
    <refpurpose>object record object belonging to anchor</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>hw_docbyanchorobj</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>anchorID</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an th object record of the document to
     which <parameter>anchorID</parameter> belongs.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-document-attributes">
   <refnamediv>
    <refname>hw_Document_Attributes</refname>
    <refpurpose>object record of hw_document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>hw_document_attributes</function></funcdef>
      <paramdef>int <parameter>hw_document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the object record of the document.
    </para>
    <para>
     For backward compatibility, <function>hw_DocumentAttributes</function>
     is also accepted. This is deprecated, however.
    </para>
    <para>
     See also <function>hw_Document_BodyTag</function>,
     and <function>hw_Document_Size</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-document-bodytag">
   <refnamediv>
    <refname>hw_Document_BodyTag</refname>
    <refpurpose>body tag of hw_document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>hw_document_bodytag</function></funcdef>
      <paramdef>int <parameter>hw_document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the BODY tag of the document. If the document is an HTML
     document the BODY tag should be printed before the document.
    </para>
    <para>
     See also <function>hw_Document_Attributes</function>,
     and <function>hw_Document_Size</function>.
    </para>
    <para>
     For backward compatibility, <function>hw_DocumentBodyTag</function>
     is also accepted. This is deprecated, however.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-document-content">
   <refnamediv>
    <refname>hw_Document_Content</refname>
    <refpurpose>returns content of hw_document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>hw_document_content</function></funcdef>
      <paramdef>int <parameter>hw_document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the content of the document. If the document is an HTML
     document the content is everything after the BODY tag. Information
     from the HEAD and BODY tag is in the stored in the object record.
    </para>
    <para>
     See also <function>hw_Document_Attributes</function>,
     <function>hw_Document_Size</function>,
     and <function>hw_DocumentSetContent</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-document-setcontent">
   <refnamediv>
    <refname>hw_Document_SetContent</refname>
    <refpurpose>sets/replaces content of hw_document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>hw_document_setcontent</function></funcdef>
      <paramdef>int <parameter>hw_document</parameter></paramdef>
      <paramdef>string <parameter>content</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets or replaces the content of the document. If the document is an HTML
     document the content is everything after the BODY tag. Information
     from the HEAD and BODY tag is in the stored in the object record.
     If you provide this information in the content of the document too,
     the Hyperwave server will change the object record accordingly when
     the document is inserted. Probably not a very good idea.
     If this functions fails the document will retain its old content.
    </para>
    <para>
     See also <function>hw_Document_Attributes</function>,
     <function>hw_Document_Size</function>,
     and <function>hw_Document_Content</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-document-size">
   <refnamediv>
    <refname>hw_Document_Size</refname>
    <refpurpose>size of hw_document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_document_size</function></funcdef>
      <paramdef>int <parameter>hw_document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the size in bytes of the document.</para>
    <para>
     See also <function>hw_Document_BodyTag</function>,
     and <function>hw_Document_Attributes</function>.
    </para>
    <para>
     For backward compatibility, <function>hw_DocumentSize</function>
     is also accepted. This is deprecated, however.
    </para>    
   </refsect1>
  </refentry>

  <refentry id="function.hw-errormsg">
   <refnamediv>
    <refname>hw_ErrorMsg</refname>
    <refpurpose>returns error message</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>hw_errormsg</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string containing the last error message or 'No Error'. If false
     is returned, this function failed.
     The message relates to the last command.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-edittext">
   <refnamediv>
    <refname>hw_EditText</refname>
    <refpurpose>retrieve text document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_edittext</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>hw_document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Uploads the text document to the server. The object record
     of the document may not be modified while the document
     is edited. 
     This function will only works for pure text documents. It will
     not open a special data connection and therefore blocks the
     control connection during the transfer.
    </para>
    <para>
     See also <function>hw_PipeDocument</function>,
     <function>hw_FreeDocument</function>,
     <function>hw_Document_BodyTag</function>,
     <function>hw_Document_Size</function>,
     <function>hw_Output_Document</function>,
     <function>hw_GetText</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-error">
   <refnamediv>
    <refname>hw_Error</refname>
    <refpurpose>error number</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_error</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the last error number. If the return value is 0 no error has
     occurred. The error relates to the last command.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-free-document">
   <refnamediv>
    <refname>hw_Free_Document</refname>
    <refpurpose>frees hw_document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_free_document</function></funcdef>
      <paramdef>int <parameter>hw_document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Frees the memory occupied by the Hyperwave document.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-getparents">
   <refnamediv>
    <refname>hw_GetParents</refname>
    <refpurpose>object ids of parents</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>hw_getparents</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>objectID</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an indexed array of object ids. Each object id belongs to
     a parent of the object with ID <parameter>objectID</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-getparentsobj">
   <refnamediv>
    <refname>hw_GetParentsObj</refname>
    <refpurpose>object records of parents</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>hw_getparentsobj</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>objectID</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an indexed array of object records plus an associated array with 
statistical
     information about the object records. The associated array is the
     last entry of the returned array. Each object record belongs to
     a parent of the object with ID <parameter>objectID</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-getchildcoll">
   <refnamediv>
    <refname>hw_GetChildColl</refname>
    <refpurpose>object ids of child collections</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>hw_getchildcoll</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>objectID</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of object ids. Each object ID
     belongs to a child collection of the collection with ID
     <parameter>objectID</parameter>. The function will not
     return child documents.</para>
    <para>
     See also <function>hw_GetChildren</function>,
     and <function>hw_GetChildDocColl</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-getchildcollobj">
   <refnamediv>
    <refname>hw_GetChildCollObj</refname>
    <refpurpose>object records of child collections</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>hw_getchildcollobj</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>objectID</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of object records. Each object records
     belongs to a child collection of the collection with ID
     <parameter>objectID</parameter>. The function will not return
     child documents.
    </para>
    <para>
     See also <function>hw_ChildrenObj</function>,
     and <function>hw_GetChildDocCollObj</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-getremote">
   <refnamediv>
    <refname>hw_GetRemote</refname>
    <refpurpose>Gets a remote document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_getremote</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>objectID</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a remote document. Remote documents in Hyperwave notation
     are documents retrieved from an external source. Common remote
     documents are for example external web pages or queries in
     a database.  In order to be able to access external sources
     throught remote documents Hyperwave introduces the HGI (Hyperwave
     Gateway Interface) which is similar to the CGI. Currently, only
     ftp, http-servers and some databases can be accessed by the HGI.
     Calling <function>hw_GetRemote</function> returns the document from
     the external source.  If you want to use this function you should be
     very familiar with HGIs.  You should also consider to use PHP instead
     of Hyperwave to access external sources. Adding database support
     by a Hyperwave gateway should be more difficult than doing it in PHP.
    </para>
    <para>
     See also <function>hw_GetRemoteChildren</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-getremotechildren">
   <refnamediv>
    <refname>hw_GetRemoteChildren</refname>
    <refpurpose>Gets children of remote document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_getremotechildren</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>string <parameter>object record</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the children of a remote document. Children of a remote
     document are remote documents itself.
     This makes sense
     if a database query has to be narrowed and is explained in
     Hyperwave Programmers' Guide. If the number of children is 1 the
     function will return the document itself formated by the Hyperwave
     Gateway Interface (HGI). If the number of children
     is greater than 1 it will return an array of object record with
     each maybe the input value for another call to
     <function>hw_GetRemoteChildren</function>. Those object records are
     virtual and do not exist in the Hyperwave server, therefore they
     do not have a valid object ID. How exactely such an object record
     looks like is up to the HGI.
     If you want to use this function you should be very familiar with HGIs.
     You should also consider to use PHP instead of Hyperwave to access
     external
     sources. Adding database support by a Hyperwave gateway should be more
     difficult than doing it in PHP.
    </para> 
    <para>
     See also <function>hw_GetRemote</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-getsrcbydestobj">
   <refnamediv>
    <refname>hw_GetSrcByDestObj</refname>
    <refpurpose>Returns anchors pointing at object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>hw_getsrcbydestobj</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>objectID</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the object records of all anchors pointing to the object with ID
     <parameter>objectID</parameter>. The object can either be a document
     or an anchor of type destination.</para>
    <para>
     See also <function>hw_GetAnchors</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-getobject">
   <refnamediv>
    <refname>hw_GetObject</refname>
    <refpurpose>object record</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>hw_getobject</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>[int|array] <parameter>objectID</parameter></paramdef>
      <paramdef>string <parameter>query</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the object record for the object with ID
     <parameter>objectID</parameter> if the second parameter is an integer.
     If the second parameter is an array of integer the function will
     return an array of object records. In such a case the last
     parameter is also evaluated which is a query string.
    </para>
    <para>
     The query string has the following syntax:</para>
    <simpara>
     &lt;expr> ::= "(" &lt;expr> ")" |</simpara>  <simpara>
             "!" &lt;expr> |          /* NOT */</simpara><simpara>
             &lt;expr> "||" &lt;expr> |  /* OR */</simpara><simpara>
             &lt;expr> "&amp;&amp;" &lt;expr> |  /* AND */</simpara><simpara>
             &lt;attribute> &lt;operator> &lt;value></simpara><simpara>

  &lt;attribute> ::= /* any attribute name (Title, Author, DocumentType ...) 
*/</simpara><simpara>

  &lt;operator> ::= "=" |    /* equal */</simpara><simpara>
                 "&lt;" |    /* less than (string compare) */</simpara><simpara>
                 ">" |    /* greater than (string compare) */</simpara><simpara>
                 "~"      /* regular expression matching 
*/</simpara><simpara></simpara>
    <para>
     The query allows to further select certain objects from the list
     of given objects. Unlike the other
     query functions, this query may use not indexed attributes. How many
     object records are returned depends on the query and if access to
     the object is allowed.
    </para>
    <para>
     See also <function>hw_GetAndLock</function>,
     and <function>hw_GetObjectByQuery</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-getandlock">
   <refnamediv>
    <refname>hw_GetAndLock</refname>
    <refpurpose>return bject record and lock object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>hw_getandlock</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>objectID</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the object record for the object with ID
     <parameter>objectID</parameter>.
     It will also lock the object, so other users cannot access
     it until it is unlocked.
    </para>
    <para>
     See also <function>hw_Unlock</function>,
     and <function>hw_GetObject</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-gettext">
   <refnamediv>
    <refname>hw_GetText</refname>
    <refpurpose>retrieve text document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_gettext</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>objectID</parameter></paramdef>
      <paramdef>mixed 
       <parameter>
        <optional>rootID/prefix</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the document with object ID
     <parameter>objectID</parameter>. If the document
     has anchors which can be inserted, they will be inserted already.
     The optional parameter <parameter>rootID/prefix</parameter> can
     be a string or an integer. If it is an integer it determines
     how links are inserted
     into the document. The default is 0 and will result in links that
     are constructed from the name of the link's destination object. This
     is useful for web applications. If a link points to an object with
     name 'internet_movie' the HTML link will be
     &lt;A HREF="/internet_movie">. The actual location of the source and
     destination object in the document hierachy is disregarded. You
     will have to set up your web browser, to rewrite that URL to for
     example '/my_script.php3/internet_movie'. 'my_script.php3' will
     have to evaluate $PATH_INFO and retrieve the document.
     All links will have the prefix '/my_script.php3/'. If you do not
     want this you can set the optional parameter
     <parameter>rootID/prefix</parameter> to any prefix which
     is used instead. Is this case it has to be a string.
    </para>
    <para>
     If <parameter>rootID/prefix</parameter> is an integer and
     unequal to 0 the link is constructed from all the names
     starting at the object with the id <parameter>rootID/prefix</parameter>
     separated by a slash relative to the current object.
     If for example the above document 'internet_movie' is located
     at 'a-b-c-internet_movie' with '-' being the seperator between
     hierachy levels on the Hyperwave server and the source document is
     located at 'a-b-d-source' the resulting HTML link would be:
     &lt;A HREF="../c/internet_movie">. This is useful if you want
     to download the whole server content onto disk and map
     the document hierachy onto the file system.
    </para>
    <para>
     This function will only work for pure text documents. It will
     not open a special data connection and therefore blocks the
     control connection during the transfer.
    </para>
    <para>
     See also <function>hw_PipeDocument</function>,
     <function>hw_FreeDocument</function>,
     <function>hw_Document_BodyTag</function>,
     <function>hw_Document_Size</function>,
     and <function>hw_Output_Document</function>.
     </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-getobjectbyquery">
   <refnamediv>
    <refname>hw_GetObjectByQuery</refname>
    <refpurpose>search object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>hw_getobjectbyquery</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>string <parameter>query</parameter></paramdef>
      <paramdef>int <parameter>max_hits</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Searches for objects on the whole server and returns an array of
     object ids. The maximum number of matches is limited to 
     <parameter>max_hits</parameter>. If <parameter>max_hits</parameter>
     is set to -1 the maximum number of matches is unlimited.
    </para>
    <para>
     The query will only work with indexed attributes.
    </para>
    <para>
     See also <function>hw_GetObjectByQueryObj</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-getobjectbyqueryobj">
   <refnamediv>
    <refname>hw_GetObjectByQueryObj</refname>
    <refpurpose>search object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>hw_getobjectbyqueryobj</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>string <parameter>query</parameter></paramdef>
      <paramdef>int <parameter>max_hits</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Searches for objects on the whole server and returns an array of
     object records. The maximum number of matches is limited to
     <parameter>max_hits</parameter>. If <parameter>max_hits</parameter>
     is set to -1 the maximum number of matches is unlimited.
    </para>
    <para>
     The query will only work with indexed attributes.
    </para>
    <para>
     See also <function>hw_GetObjectByQuery</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-getobjectbyquerycoll">
   <refnamediv>
    <refname>hw_GetObjectByQueryColl</refname>
    <refpurpose>search object in collection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>hw_getobjectbyquerycoll</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>objectID</parameter></paramdef>
      <paramdef>string <parameter>query</parameter></paramdef>
      <paramdef>int <parameter>max_hits</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Searches for objects in collection with ID
     <parameter>objectID</parameter> and returns an array of
     object ids. The maximum number of matches is limited to
     <parameter>max_hits</parameter>.
     If <parameter>max_hits</parameter>
     is set to -1 the maximum number of matches is unlimited.
    </para>
    <para>
     The query will only work with indexed attributes.</para>
    <para>
     See also <function>hw_GetObjectByQueryCollObj</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-getobjectbyquerycollobj">
   <refnamediv>
    <refname>hw_GetObjectByQueryCollObj</refname>
    <refpurpose>search object in collection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>hw_getobjectbyquerycollobj</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>objectID</parameter></paramdef>
      <paramdef>string <parameter>query</parameter></paramdef>
      <paramdef>int <parameter>max_hits</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Searches for objects in collection with ID
     <parameter>objectID</parameter> and returns an array of
     object records. The maximum number of matches is limited to
     <parameter>max_hits</parameter>.
     If <parameter>max_hits</parameter>
     is set to -1 the maximum number of matches is unlimited.
    </para>
    <para>
     The query will only work with indexed attributes.
    </para>
    <para>
     See also <function>hw_GetObjectByQueryColl</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-getchilddoccoll">
   <refnamediv>
    <refname>hw_GetChildDocColl</refname>
    <refpurpose>object ids of child documents of collection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>hw_getchilddoccoll</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>objectID</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns array of object ids for child documents of a collection.
    </para>
    <para>
     See also <function>hw_GetChildren</function>,
     and <function>hw_GetChildColl</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-getchilddoccollobj">
   <refnamediv>
    <refname>hw_GetChildDocCollObj</refname>
    <refpurpose>object records of child documents of collection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>hw_getchilddoccollobj</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>objectID</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of object records for child documents of a collection.</para>
    <para>
     See also <function>hw_ChildrenObj</function>,
     and <function>hw_GetChildCollObj</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-getanchors">
   <refnamediv>
    <refname>hw_GetAnchors</refname>
    <refpurpose>object ids of anchors of document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>hw_getanchors</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>objectID</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of object ids with anchors of the document
     with object ID <parameter>objectID</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-getanchorsobj">
   <refnamediv>
    <refname>hw_GetAnchorsObj</refname>
    <refpurpose>object records of anchors of document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>hw_getanchorsobj</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>objectID</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of object records with anchors of the document
     with object ID <parameter>objectID</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-mv">
   <refnamediv>
    <refname>hw_Mv</refname>
    <refpurpose>moves objects</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_mv</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>array <parameter>object id array</parameter></paramdef>
      <paramdef>int <parameter>source id</parameter></paramdef>
      <paramdef>int <parameter>destination id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Moves the objects with object ids as specified in the second
     parameter from the collection with id <parameter>source id</parameter>
     to the collection with the id <parameter>destination id</parameter>.
     If the destination id is 0 the objects will
     be unlinked from the source collection. If this is the last instance
     of that object it will be deleted. If you want to delete all instances
     at once, use <function>hw_deleteobject</function>.
    </para>
    <para>
     The value return is the number of moved objects.
    </para>
    <para>
     See also <function>hw_cp</function>,
     and <function>hw_deleteobject</function>.
     </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-identify">
   <refnamediv>
    <refname>hw_Identify</refname>
    <refpurpose>identifies as user</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_identify</function></funcdef>
      <paramdef>string <parameter>username</parameter></paramdef>
      <paramdef>string <parameter>password</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Identifies as user with <parameter>username</parameter> and
     <parameter>password</parameter>. Identification
     is only valid for the current session. I do not thing this
     function will be needed very often. In most cases it will
     be easier to identify with the opening of the connection.
    </para>
    <para>
     See also <function>hw_Connect</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-incollections">
   <refnamediv>
    <refname>hw_InCollections</refname>
    <refpurpose>check if object ids in collections</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>hw_incollections</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>array <parameter>object_id_array</parameter></paramdef>
      <paramdef>array <parameter>collection_id_array</parameter></paramdef>
      <paramdef>int <parameter>return_collections</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Checks whether a set of objects (documents or collections)
     specified by the <parameter>object_id_array</parameter> is part of
     the collections listed in <parameter>collection_id_array</parameter>.
     When the fourth parameter <parameter>return_collections</parameter> is 0,
     the subset of object ids that is part of the collections (i.e.,
     the documents or collections that are children of one or more
     collections of collection ids or their subcollections, recursively)
     is returned as an array. When the fourth parameter is 1, however, the
     set of collections that have one or more objects of this subset as
     children are returned as an array. This option allows a client to,
     e.g., highlight the part of the collection hierarchy that contains
     the matches of a previous query, in a graphical overview.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-info">
   <refnamediv>
    <refname>hw_Info</refname>
    <refpurpose>info about connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>hw_info</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns information about the current connection. The returned string
     has the following format: &lt;Serverstring&gt;, &lt;Host&gt;,
     &lt;Port&gt;, &lt;Username&gt;, &lt;Port of Client&gt;,
     &lt;Byte swapping&gt;
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-inscoll">
   <refnamediv>
    <refname>hw_InsColl</refname>
    <refpurpose>insert collection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_inscoll</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>objectID</parameter></paramdef>
      <paramdef>array <parameter>object_array</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Inserts a new collection with attributes as in
     <parameter>object_array</parameter> into
     collection with object ID <parameter>objectID</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-insdoc">
   <refnamediv>
    <refname>hw_InsDoc</refname>
    <refpurpose>insert document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_insdoc</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>parentID</parameter></paramdef>
      <paramdef>string <parameter>object_record</parameter></paramdef>
      <paramdef>string <parameter>text</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Inserts a new document with attributes as in
     <parameter>object_record</parameter> into collection with object ID
     <parameter>parentID</parameter>. This function inserts either 
     an object record only or an object record and a pure ascii text in
     <parameter>text</parameter> if <parameter>text</parameter> is given.
     If you want to insert a general document of any kind use
     <function>hw_insertdocument</function> instead.
    </para>
    <para>
     See also <function>hw_InsertDocument</function>,
     and <function>hw_InsColl</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-insertdocument">
   <refnamediv>
    <refname>hw_InsertDocument</refname>
    <refpurpose>upload any document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_insertdocument</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>parent_id</parameter></paramdef>
      <paramdef>int <parameter>hw_document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
      Uploads a document into the collection with
      <parameter>parent_id</parameter>.
      The document has to be created before with
      <function>hw_NewDocument</function>. Make sure that
      the object record of the new document contains at least
      the attributes: Type, DocumentType, Title and Name. Possibly
      you also want to set the MimeType. The functions returns the
      object id of the new document or false.
    </para>
    <para>
     See also <function>hw_PipeDocument</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-insertobject">
   <refnamediv>
    <refname>hw_InsertObject</refname>
    <refpurpose>inserts an object record</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_insertobject</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>string <parameter>object rec</parameter></paramdef>
      <paramdef>string <parameter>parameter</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
      Inserts an object into the server. The object can be
      any valid hyperwave object. See the HG-CSP documentation
      for a detailed information on how the parameters have to be.
    </para>
    <para>
      Note: If you want to insert an Anchor, the attribute Position
      has always been set either to a start/end value or to
      'invisible'. Invisible positions are needed if the annotation
      has no correspondig link in the annotation text.
    </para> 
    <para>
     See also <function>hw_PipeDocument</function>,
     <function>hw_InsertDocument</function>,
     <function>hw_InsDoc</function>,
     and <function>hw_InsColl</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-mapid">
   <refnamediv>
    <refname>hw_mapid</refname>
    <refpurpose>Maps global id on virtual local id</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_mapid</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>server id</parameter></paramdef>
      <paramdef>int <parameter>object id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
      Maps a global object id on any hyperwave server, even those
      you did not connect to with <function>hw_connect</function>,
      onto a virtual object id. This virtual object id can then be
      used as any other object id, e.g. to obtain the object record
      with <function>hw_getobject</function>. The server id is the
      first part of the global object id (GOid) of the object which
      is actually the IP number as an integer.
    </para>
    <para>
      Note: In order to use this function you will have to set
      the F_DISTRIBUTED flag, which can currently only be set at
      compile time in hg_comm.c. It is not set by default. Read
      the comment at the beginning of hg_comm.c
    </para> 
   </refsect1>
  </refentry>


  <refentry id="function.hw-modifyobject">
   <refnamediv>
    <refname>hw_Modifyobject</refname>
    <refpurpose>modifies object record</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_modifyobject</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>object_to_change</parameter></paramdef>
      <paramdef>array <parameter>remove</parameter></paramdef>
      <paramdef>array <parameter>add</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This command allows to remove, add, or modify individual attributes
     of an object record.  The object is specified by the Object ID
     <parameter>object_to_change</parameter>. The first array
     <parameter>remove</parameter> is a list of attributes to remove.
     The second array <parameter>add</parameter> is a list of attributes
     to add. In order to modify an attribute one will have to remove
     the old one and add a new one. <function>hw_modifyobject</function>
     will always remove the attributes before it adds attributes unless
     the value of the attribute to remove is not a string or array.
    </para>
    <para>
     The last parameter determines if the modification is performed
     recursively. 1 means recurive modification. If some of the objects
     cannot be modified they will be skiped without notice.
     <function>hw_error</function> may not indicate an error though
     some of the objects could not be modified.
    </para>
    <para>
     The keys of both arrays are the attributes name. The value of each
     array element can either be an array, a string or anything else.
     If it is an array
     each attribute value is constructed by the key of each element plus
     a colon and the value of each element. If it is a string it is taken
     as the attribute value. An empty string will result in a complete
     removal of that attribute. If the value is neither a string nor an
     array but something else, e.g. an integer, no operation at all will
     be performed on the attribute. This is neccessary if you want to
     to add a completely new attribute not just a new value for an existing
     attribute. If the remove array contained
     an empty string for that attribute, the attribute would be tried to be
     removed which would fail since it doesn't exist. The following addition of
     a new value for that attribute would also fail. Setting the value
     for that attribute to e.g. 0 would not even try to remove it and
     the addition will work.
    </para>
    <para>
     If you would like to change the attribute 'Name' with the current
     value 'books' into 'articles' you will have to create two arrays
     and call <function>hw_modifyobject</function>.
     <example>
      <title>modifying an attribute</title>
      <programlisting role="php">
       // $connect is an existing connection to the Hyperwave server
       // $objid is the ID of the object to modify
       $remarr = array("Name" => "books");
       $addarr = array("Name" => "articles");
       $hw_modifyobject($connect, $objid, $remarr, $addarr);
      </programlisting>
     </example>
     In order to delete/add a name=value pair from/to the object record just
     pass the remove/add array and set the last/third parameter to an empty
     array. If the attribute is the first one with that name to add, set
     attribute value in the remove array to an integer.
     <example>
      <title>adding a completely new attribute</title>
      <programlisting role="php">
       // $connect is an existing connection to the Hyperwave server
       // $objid is the ID of the object to modify
       $remarr = array("Name" => 0);
       $addarr = array("Name" => "articles");
       $hw_modifyobject($connect, $objid, $remarr, $addarr);
      </programlisting>
     </example>
    </para>
    <para>
     <note>
      <simpara>
       Multilingual attributes, e.g. 'Title', can be modified in two
       ways. Either by providing the attributes value in its native
       form 'language':'title' or by providing an array with elements
       for each language as described above. The above example would
       than be:
      </simpara>
     </note>
     <example>
      <title>modifying Title attribute</title>
      <programlisting role="php">
       $remarr = array("Title" => "en:Books");
       $addarr = array("Title" => "en:Articles");
       $hw_modifyobject($connect, $objid, $remarr, $addarr);
      </programlisting>
     </example>
      or
     <example>
      <title>modifying Title attribute</title>
      <programlisting role="php">
       $remarr = array("Title" => array("en" => "Books"));
       $addarr = array("Title" => array("en" => "Articles", "ge"=>"Artikel"));
       $hw_modifyobject($connect, $objid, $remarr, $addarr);
      </programlisting>
     </example>
     This removes the english title 'Books' and adds the english title
     'Articles' and the german title 'Artikel'.
     <example>
      <title>removing attribute</title>
      <programlisting role="php">
       $remarr = array("Title" => "");
       $addarr = array("Title" => "en:Articles");
       $hw_modifyobject($connect, $objid, $remarr, $addarr);
      </programlisting>
     </example>
     <note>
      <simpara> 
       This will remove all attributes with the name 'Title' and adds
       a new 'Title' attribute. This comes in handy if you want to
       remove attributes recursively.  
      </simpara>
     </note>
     <note>
      <simpara>
       If you need to delete all attributes with a certain name you
       will have to pass an empty string as the attribute value.
      </simpara>
     </note>
     <note>
      <simpara>
       Only the attributes 'Title', 'Description' and 'Keyword' will
       properly handle the language prefix. If those attributes don't carry
       a language prefix, the prefix 'xx' will be assigned.
      </simpara>
     </note>
     <note>
      <simpara>
       The 'Name' attribute is somewhat special. In some cases it cannot 
       be complete removed. You will get an error message 'Change of base
       attribute' (not clear when this happens). Therefore you will always
       have to add a new Name first and than remove the old one.
      </simpara>
     </note>
     <note>
      <simpara>
       You may not suround this function by calls to
       <function>hw_getandlock</function> and <function>hw_unlock</function>.
       <function>hw_modifyobject</function> does this internally.
      </simpara>
     </note>
    </para>
    <para>
      Returns TRUE if no error occurs otherwise FALSE.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-new-document">
   <refnamediv>
    <refname>hw_New_Document</refname>
    <refpurpose>create new document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_new_document</function></funcdef>
      <paramdef>string <parameter>object_record</parameter></paramdef>
      <paramdef>string <parameter>document_data</parameter></paramdef>
      <paramdef>int <parameter>document_size</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a new Hyperwave document with document data set to
     <parameter>document_data</parameter> and object record set to
     <parameter>object_record</parameter>. The length of the 
     <parameter>document_data</parameter> has to passed in
     <parameter>document_size</parameter>This function does not
     insert the document into the Hyperwave server.
    </para>
    <para>
     See also <function>hw_FreeDocument</function>,
     <function>hw_Document_Size</function>,
     <function>hw_Document_BodyTag</function>,
     <function>hw_Output_Document</function>,
     and <function>hw_InsertDocument</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-objrec2array">
   <refnamediv>
    <refname>hw_Objrec2Array</refname>
    <refpurpose>convert attributes from object record to object array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>hw_objrec2array</function></funcdef>
      <paramdef>string <parameter>object_record</parameter></paramdef>
      <paramdef>array
       <parameter>
        <optional>format</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Converts an <parameter>object_record</parameter> into an object array.
     The keys of the resulting array are the attributes names.
     Multi-value attributes like 'Title' in different languages form its own
     array. The keys of this array are the left part to the colon of the
     attribute value. This left part must be two characters long.
     Other multi-value attributes without a prefix form an indexed array.
     If the optional parameter is missing the 
     attributes 'Title', 'Description'
     and 'Keyword' are treated as language attributes and the attributes
     'Group', 'Parent' and 'HtmlAttr' as non-prefixed multi-value attributes.
     By passing an array holding the type for each attribute you can
     alter this behaviour. The array is an associated array with the attribute
     name as its key and the value being one of
     <literal>HW_ATTR_LANG</literal> or <literal>HW_ATTR_NONE</literal>
    </para>
    <para>
     See also <function>hw_array2objrec</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-output-document">
   <refnamediv>
    <refname>hw_Output_Document</refname>
    <refpurpose>prints hw_document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_output_document</function></funcdef>
      <paramdef>int <parameter>hw_document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Prints the document without the BODY tag.
    </para>
    <para>
     For backward compatibility, <function>hw_OutputDocument</function> is
     also accepted. This is deprecated, however.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-pconnect">
   <refnamediv>
    <refname>hw_pConnect</refname>
    <refpurpose>make a persistent database connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_pconnect</function></funcdef>
      <paramdef>string <parameter>host</parameter></paramdef>
      <paramdef>int <parameter>port</parameter></paramdef>
      <paramdef>string <parameter>username</parameter></paramdef>
      <paramdef>string <parameter>password</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a connection index on success, or false if the connection
     could not be made.  Opens a persistent connection to a Hyperwave
     server. Each of the arguments should be a quoted string,
     except for the port number. The <parameter>username</parameter>
     and <parameter>password</parameter> arguments are
     optional and can be left out. In such a case no identification with
     the server will be done. It is similar to identify as user anonymous.
     This function returns a connection
     index that is needed by other Hyperwave functions. You can have
     multiple persistent connections open at once.</para>
    <para>
     See also <function>hw_Connect</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-pipedocument">
   <refnamediv>
    <refname>hw_PipeDocument</refname>
    <refpurpose>retrieve any document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_pipedocument</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>objectID</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the Hyperwave document with object ID
     <parameter>objectID</parameter>. If the document
     has anchors which can be inserted, they will have been inserted already.
     The document will be transfered via a special data connection which
     does not block the control connection.</para>
    <para>
     See also <function>hw_GetText</function> for more on link insertion,
     <function>hw_FreeDocument</function>,
     <function>hw_Document_Size</function>,
     <function>hw_Document_BodyTag</function>,
     and <function>hw_Output_Document</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-root">
   <refnamediv>
    <refname>hw_Root</refname>
    <refpurpose>root object id</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_root</function></funcdef>
      <paramdef><parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the object ID of the hyperroot collection. Currently this
     is always 0. The child collection of the hyperroot is the root
     collection of the connected server.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-unlock">
   <refnamediv>
    <refname>hw_Unlock</refname>
    <refpurpose>unlock object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_unlock</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int <parameter>objectID</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Unlocks a document, so other users regain access.
    </para>
    <para>
     See also <function>hw_GetAndLock</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-who">
   <refnamediv>
    <refname>hw_Who</refname>
    <refpurpose>List of currently logged in users</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hw_who</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of users currently logged into the Hyperwave server.
     Each entry in this array is an array itself containing the elements id,
     name, system, onSinceDate, onSinceTime, TotalTime and self. 'self'
     is 1 if this entry belongs to the user who initianted the request.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hw-getusername">
   <refnamediv>
    <refname>hw_getusername</refname>
    <refpurpose>name of currently logged in user</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>hw_getusername</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the username of the connection.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/ibase.xml
+++ phpdoc/kr/functions/ibase.xml
 <reference id="ref.ibase">
  <title>InterBase functions</title>
  <titleabbrev>InterBase</titleabbrev>

  <partintro>
   <para>
    InterBase is a popular database put out by Borland/Inprise.  More
    information about InterBase is available at <ulink
    url="&url.ibase;">&url.ibase;</ulink>.  Oh, by the way, InterBase
    just joined the open source movement!
   </para>
   <note>
    <para>
     Full support for InterBase 6 was added in PHP 4.0. 
    </para>
        <para>
         This database uses a single quote (') character for escaping, a
         behavior similar to the Sybase database, add to your
         <filename>php.ini</filename> the following directive:
         <informalexample>
          <programlisting>
magic_quotes_sybase = On
          </programlisting>
         </informalexample>
        </para>
   </note>
  </partintro>

  <refentry id="function.ibase-connect">
   <refnamediv>
    <refname>ibase_connect</refname>
    <refpurpose>
     Open a connection to an InterBase database
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ibase_connect</function></funcdef>
      <paramdef>string <parameter>database</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>username</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>password</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>charset</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>buffers</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>dialect</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>role</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Establishes a connection to an InterBase server.
     The <parameter>database</parameter> argument
     has to be a valid path to database file on the server it resides on.
     If the server is not local, it must be prefixed with either
     'hostname:' (TCP/IP), '//hostname/' (NetBEUI) or 'hostname@' (IPX/SPX),
     depending on the connection protocol used. <parameter>username</parameter>
     and <parameter>password</parameter> can also
     be specified with PHP configuration directives ibase.default_user and
     ibase.default_password. <parameter>charset</parameter> is the default
     character set for a database. <parameter>buffers</parameter> is the number
     of database buffers to allocate for the server-side cache. If 0 or omitted,
     server chooses its own default. <parameter>dialect</parameter> selects
     the default SQL dialect for any statement executed within a connection,
     and it defaults to the highest one supported by client libraries.
    </para>
    <para>
     In case a second call is made to
     <function>ibase_connect</function> with the same arguments, no new link
     will be established, but instead, the link identifier of the already opened
     link will be returned. The link to the server will be closed as soon as the
     execution of the script ends, unless it's closed earlier by explicitly calling
     <function>ibase_close</function>. 
     <example>
      <title><function>Ibase_connect</function> example</title>
      <programlisting role="php">
&lt;?php
    $dbh = ibase_connect ($host, $username, $password);
    $stmt = 'SELECT * FROM tblname';
    $sth = ibase_query ($dbh, $stmt);
    while ($row = ibase_fetch_object ($sth)) {
        print $row->email . "\n";
    }
    ibase_close ($dbh);
?>
      </programlisting>
     </example>
    </para>
    <note>
     <para>
      <parameter>buffers</parameter> was added in PHP4-RC2.
     </para>
    </note>
    <note>
     <para>
      <parameter>dialect</parameter> was added in PHP4-RC2. It is functional
       only with InterBase 6 and versions higher than that.
     </para>
    </note>
    <note>
     <para>
      <parameter>role</parameter> was added in PHP4-RC2. It is functional
       only with InterBase 5 and versions higher than that.
     </para>
    </note>
    <para>
     See also: <function>ibase_pconnect</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ibase-pconnect">
   <refnamediv>
    <refname>ibase_pconnect</refname>
    <refpurpose>
     Creates an persistent connection to an InterBase database
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ibase_pconnect</function></funcdef>
      <paramdef>string <parameter>database</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>username</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>password</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>charset</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>buffers</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>dialect</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>role</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ibase_pconnect</function> acts very much like
     <function>ibase_connect</function> with two major differences.
     First, when connecting, the function will first try to find a
     (persistent) link that's already opened with the same parameters.
     If one is found, an identifier for it will be returned instead of
     opening a new connection. Second, the connection to the InterBase
     server will not be closed when the execution of the script ends.
     Instead, the link will remain open for future use
     (<function>ibase_close</function> will not close links established
     by <function>ibase_pconnect</function>). This type of link is
     therefore called 'persistent'.
    </para>
    <note>
     <para>
      <parameter>buffers</parameter> was added in PHP4-RC2.
     </para>
    </note>
    <note>
     <para>
      <parameter>dialect</parameter> was added in PHP4-RC2. It is functional
       only with InterBase 6 and versions higher than that.
     </para>
    </note>
    <note>
     <para>
      <parameter>role</parameter> was added in PHP4-RC2. It is functional
       only with InterBase 5 and versions higher than that.
     </para>
    </note>
    <para>
     See also <function>ibase_connect</function> for the meaning of
     parameters passed to this function. They are exactly the same.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ibase-close">
   <refnamediv>
    <refname>ibase_close</refname>
    <refpurpose>
     Close a connection to an InterBase database
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ibase_close</function></funcdef>
      <paramdef>int 
       <parameter><optional>connection_id</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Closes the link to an InterBase database that's associated with
     a connection id returned from <function>ibase_connect</function>.
     If the connection id is omitted, the last opened link is assumed.
     Default transaction on link is committed, other transactions are
     rolled back. 
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ibase-query">
   <refnamediv>
    <refname>ibase_query</refname>
    <refpurpose>Execute a query on an InterBase database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ibase_query</function></funcdef>
      <paramdef>int 
       <parameter><optional>link_identifier</optional></parameter>
      </paramdef>
      <paramdef>string
       <parameter>query</parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>bind_args</optional></parameter> 
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Performs a query on an InterBase database, returning a result
     identifier for use with <function>ibase_fetch_row</function>,
     <function>ibase_fetch_object</function>,
     <function>ibase_free_result</function> and
     <function>ibase_free_query</function>.
    </simpara>
    <note>
     <para>
      Although this function supports variable binding to parameter
      placeholders, there is not very much meaning using this capability
      with it. For real life use and an example, see
      <function>ibase_prepare</function> and
      <function>ibase_execute</function>.
     </para>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.ibase-fetch-row">
   <refnamediv>
    <refname>ibase_fetch_row</refname>
    <refpurpose>Fetch a row from an InterBase database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>ibase_fetch_row</function></funcdef>
      <paramdef>int
       <parameter>result_identifier</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns the next row specified by the result identifier obtained
     using the <function>ibase_query</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ibase-fetch-object">
   <refnamediv>
    <refname>ibase_fetch_object</refname>
    <refpurpose>Get an object from a InterBase database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>object <function>ibase_fetch_object</function></funcdef>
      <paramdef>int
       <parameter>result_id</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Fetches a row as a pseudo-object from a
     <parameter>result_id</parameter> obtained either by
     <function>ibase_query</function> or
     <function>ibase_execute</function>.
     <informalexample>
      <programlisting role="php">
&lt;php
    $dbh = ibase_connect ($host, $username, $password);
    $stmt = 'SELECT * FROM tblname';
    $sth = ibase_query ($dbh, $stmt);
    while ($row = ibase_fetch_object ($sth)) {
        print $row->email . "\n";
    }
    ibase_close ($dbh);
?>
      </programlisting>
     </informalexample>
    </para>
    <para>
     See also <function>ibase_fetch_row</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.ibase-field-info">
   <refnamediv>
    <refname>ibase_field_info</refname>
    <refpurpose>
     Get information about a field
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>ibase_field_info</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int <parameter>field number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array with information about a field after a select
     query has been run. The array is in the form of name, alias,
     relation, length, type.
     <informalexample>
      <programlisting role="php">
// [EMAIL PROTECTED]  08-Dec-2000 02:53

$rs=ibase_query("Select * from something"); 
$coln = ibase_num_fields($rs); 
for ($i=0 ; $i < $coln ; $i++) { 
    $col_info = ibase_field_info($rs, $i); 
    echo "name: ".$col_info['name']."\n"; 
    echo "alias: ".$col_info['alias']."\n"; 
    echo "relation: ".$col_info['relation']."\n"; 
    echo "length: ".$col_info['length']."\n"; 
    echo "type: ".$col_info['type']."\n"; 
    }
      </programlisting>
     </informalexample>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.ibase-free-result">
   <refnamediv>
    <refname>ibase_free_result</refname>
    <refpurpose>Free a result set</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ibase_free_result</function></funcdef>
      <paramdef>int
       <parameter>result_identifier</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Free's a result set the has been created by
     <function>ibase_query</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ibase-prepare">
   <refnamediv>
    <refname>ibase_prepare</refname>
    <refpurpose>
     Prepare a query for later binding of parameter placeholders and
     execution
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ibase_prepare</function></funcdef>
      <paramdef>int 
       <parameter><optional>link_identifier</optional></parameter>
      </paramdef>
      <paramdef>string <parameter>query</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Prepare a query for later binding of parameter placeholders and
     execution (via <function>ibase_execute</function>).
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ibase-execute">
   <refnamediv>
    <refname>ibase_execute</refname>
    <refpurpose>Execute a previously prepared query</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ibase_execute</function></funcdef>
      <paramdef>int 
       <parameter>query</parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>bind_args</optional></parameter> 
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Execute a query prepared by <function>ibase_prepare</function>.
     This is a lot more effective than using <function>ibase_query</function>
     if you are repeating a same kind of query several times with only
     some parameters changing.
     <informalexample>
      <programlisting role="php">
&lt;?php
    $updates = array(
        1 => 'Eric',
        5 => 'Filip',
        7 => 'Larry'
    );

    $query = ibase_prepare("UPDATE FOO SET BAR = ? WHERE BAZ = ?");

    while (list($baz, $bar) = each($updates)) {
        ibase_execute($query, $bar, $baz);
    }
?>
      </programlisting>
     </informalexample>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ibase-trans">
   <refnamediv>
    <refname>ibase_trans</refname>
    <refpurpose>Begin a transaction</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ibase_trans</function></funcdef>
      <paramdef>int 
       <parameter><optional>trans_args</optional></parameter> 
      </paramdef>
      <paramdef>int 
       <parameter><optional>link_identifier</optional></parameter> 
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Begins a transaction.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ibase-commit">
   <refnamediv>
    <refname>ibase_commit</refname>
    <refpurpose>Commit a transaction</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ibase_commit</function></funcdef>
      <paramdef>int 
       <parameter><optional>link_identifier</optional></parameter> 
      </paramdef>
      <paramdef>int <parameter>trans_number</parameter> 
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Commits transaction <parameter>trans_number</parameter> which was
     created with <function>ibase_trans</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ibase-rollback">
   <refnamediv>
    <refname>ibase_rollback</refname>
    <refpurpose>Rolls back a transaction</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ibase_rollback</function></funcdef>
      <paramdef>int 
       <parameter><optional>link_identifier</optional></parameter> 
      </paramdef>
      <paramdef>int <parameter>trans_number</parameter> 
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Rolls back transaction <parameter>trans_number</parameter> which was
     created with <function>ibase_trans</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ibase-free-query">
   <refnamediv>
    <refname>ibase_free_query</refname>
    <refpurpose>
     Free memory allocated by a prepared query
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ibase_free_query</function></funcdef>
      <paramdef>int
       <parameter>query</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Free a query prepared by <function>ibase_prepare</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ibase-timefmt">
   <refnamediv>
    <refname>ibase_timefmt</refname>
    <refpurpose>
     Sets the format of timestamp, date and time type columns returned from queries
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ibase_timefmt</function></funcdef>
      <paramdef>string
       <parameter>format</parameter>
      </paramdef>
      <paramdef>int
       <parameter><optional>columntype</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets the format of timestamp, date or time type columns returned
     from queries. Internally, the columns are formatted by c-function
     strftime(), so refer to it's documentation regarding to the format
     of the string. <parameter>columntype</parameter> is one of the
     constants IBASE_TIMESTAMP, IBASE_DATE and IBASE_TIME. If omitted,
     defaults to IBASE_TIMESTAMP for backwards compatibility.
     <informalexample>
      <programlisting role="php">
&lt;?php
    // InterBase 6 TIME-type columns will be returned in
    // the form '05 hours 37 minutes'. 
    ibase_timefmt("%H hours %M minutes", IBASE_TIME);
?>
      </programlisting>
     </informalexample>
    </para>
    <para>
     You can also set defaults for these formats with PHP configuration
     directives ibase.timestampformat, ibase.dateformat and ibase.timeformat.
    </para>
    <note>
     <para>
      <parameter>columntype</parameter> was added in PHP 4.0. It has any
      meaning only with InterBase version 6 and higher.
     </para>
    </note>
    <note>
     <para>
      A backwards incompatible change happened in PHP 4.0 when PHP
      configuration directive ibase.timeformat was renamed to
      ibase.timestampformat and directives ibase.dateformat and
      ibase.timeformat were added, so that the names would match better
      their functionality.
     </para>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.ibase-num-fields">
   <refnamediv>
    <refname>ibase_num_fields</refname>
    <refpurpose>
     Get the number of fields in a result set
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ibase_num_fields</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an integer containing the number of fields in a result
     set.
     <informalexample>
      <programlisting role="php">
&lt;?php
    $dbh = ibase_connect ($host, $username, $password);
    $stmt = 'SELECT * FROM tblname';
    $sth = ibase_query ($dbh, $stmt);

    if (ibase_num_fields($sth) > 0) {
        while ($row = ibase_fetch_object ($sth)) {
            print $row->email . "\n";
        }
    } else {
        die ("No Results were found for your query");
    }

    ibase_close ($dbh);
?>
      </programlisting>
     </informalexample>
    </para>
    <para>
     See also: <function>ibase_field_info</function>.
    </para>
    <note>
     <para>
      <function>Ibase_num_fields</function> is currently not functional
      in PHP 4.
     </para>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.ibase-errmsg">
   <refnamediv>
    <refname>ibase_errmsg</refname>
    <refpurpose>
     Returns error messages
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ibase_errmsg</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns a string containing an error message.
    </simpara>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/icap.xml
+++ phpdoc/kr/functions/icap.xml
 <reference id="ref.icap">
  <title>ICAP Functions</title>
  <titleabbrev>ICAP</titleabbrev>

  <partintro>
   <simpara>
    To get these functions to work, you have to compile PHP with
    <option role="configure">--with-icap</option>. That requires the
    icap library to be installed. Grab the latest version from <ulink
    url="&url.icap;">&url.icap;</ulink> and compile and install it.
   </simpara>
  </partintro>

  <refentry id="function.icap-open">
   <refnamediv>
    <refname>icap_open</refname>
    <refpurpose>Opens up an ICAP connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>stream <function>icap_open</function></funcdef>
      <paramdef>string <parameter>calendar</parameter></paramdef>
      <paramdef>string <parameter>username</parameter></paramdef>
      <paramdef>string <parameter>password</parameter></paramdef>
      <paramdef>string <parameter>options</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an ICAP stream on success, false on error.</para>  
    <para>
     <function>icap_open</function> opens up an ICAP connection to the
     specified <parameter>calendar</parameter> store. If the optional
     <parameter>options</parameter> is specified, passes the
     <parameter>options</parameter> to that mailbox also.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.icap-close">
   <refnamediv>
    <refname>icap_close</refname>
    <refpurpose>Close an ICAP stream</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>icap_close</function></funcdef>
      <paramdef>int <parameter>icap_stream</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>flags</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Closes the given icap stream.
    </para> 
   </refsect1>
  </refentry>

  <refentry id="function.icap-fetch-event">
   <refnamediv>
    <refname>icap_fetch_event</refname>
    <refpurpose>Fetches an event from the calendar stream/</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>icap_fetch_event</function></funcdef>
      <paramdef>int <parameter>stream_id</parameter></paramdef>
      <paramdef>int <parameter>event_id</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>options</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>Icap_fetch_event</function> fetches an event from the 
     calendar stream specified by <parameter>event_id</parameter>.
    </para>
    <para>
     Returns an event object consisting of:
     <itemizedlist>
      <listitem>
       <simpara>
        int id - ID of that event.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int public - TRUE if the event if public, FALSE if it is private.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        string category - Category string of the event.
       </simpara>
      </listitem> 
      <listitem>
       <simpara>
        string title - Title string of the event.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        string description - Description string of the event.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int alarm - number of minutes before the event to send an
        alarm/reminder.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        object start - Object containing a datetime entry.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        object end - Object containing a datetime entry.
       </simpara>
      </listitem>
     </itemizedlist>
     All datetime entries consist of an object that contains:
     <itemizedlist>
      <listitem>
       <simpara>
        int year - year
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int month - month
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int mday  - day of month
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int hour  - hour
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int min   - minutes
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int sec   - seconds
       </simpara></listitem>         
     </itemizedlist>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.icap-list-events">
   <refnamediv>
    <refname>icap_list_events</refname>
    <refpurpose>
     Return a list of events between two given datetimes
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>icap_list_events</function></funcdef>
      <paramdef>int <parameter>stream_id</parameter></paramdef>
      <paramdef>int <parameter>begin_date</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>end_date</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of event ID's that are between the two given
     datetimes.
    </para>
    <para> 
     <function>Icap_list_events</function> function takes in a
     beginning datetime and an end datetime for a calendar stream. An
     array of event id's that are between the given datetimes are
     returned.
    </para>
    <para>
     All datetime entries consist of an object that contains:
     <itemizedlist>
      <listitem>
       <simpara>
        int year - year
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int month - month
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int mday  - day of month
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int hour  - hour
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int min   - minutes
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int sec   - seconds
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.icap-store-event">
   <refnamediv>
    <refname>icap_store_event</refname>
    <refpurpose>Store an event into an ICAP calendar</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>icap_store_event</function></funcdef>
      <paramdef>int <parameter>stream_id</parameter></paramdef>
      <paramdef>object <parameter>event</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>Icap_store_event</function> Stores an event into
     an ICAP calendar.  An event object consists of:
     <itemizedlist>
      <listitem>
       <simpara>
        int public - 1 if public, 0 if private;
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        string caegory - Category string of the event.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        string title - Title string of the event.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        string description - Description string of the event.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int alarm - Number of minutes before the event to sned out an alarm.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        datetime start - datetime object of the start of the event.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        datetime end - datetime object of the end of the event.
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     All datetime entries consist of an object that contains:
     <itemizedlist>
      <listitem>
       <simpara>
        int year - year
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int month - month
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int mday  - day of month
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int hour  - hour
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int min   - minutes
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int sec   - seconds
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     Returns true on success and false on error.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.icap-delete-event">
   <refnamediv>
    <refname>icap_delete_event</refname>
    <refpurpose>Delete an event from an ICAP calendar</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>icap_delete_event</function></funcdef>
      <paramdef>int <parameter>sream_id</parameter></paramdef>
      <paramdef>int <parameter>uid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>Icap_delete_event</function> deletes the calendar event
     specified by the <parameter>uid</parameter>.
    </para>
    <para>
     Returns true.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.icap-snooze">
   <refnamediv>
    <refname>icap_snooze</refname>
    <refpurpose>Snooze an alarm</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>icap_snooze</function></funcdef>
      <paramdef>int <parameter>stream_id</parameter></paramdef>
      <paramdef>int <parameter>uid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>Icap_snooze</function> turns on an alarm for a
     calendar event specified by the <parameter>uid</parameter>.
    </para>
    <para>
     Returns true.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.icap-list-alarms">
   <refnamediv>
    <refname>icap_list_alarms</refname>
    <refpurpose>
     Return a list of events that has an alarm triggered at the given
     datetime
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>icap_list_alarms</function></funcdef>
      <paramdef>int <parameter>stream_id</parameter></paramdef>
      <paramdef>array <parameter>date</parameter></paramdef>
      <paramdef>array <parameter>time</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of event ID's that has an alarm going off at the
     given datetime.
    </para>  
    <para> 
     <function>Icap_list_alarms</function> function takes in a
     datetime for a calendar stream. An array of event id's that has
     an alarm should be going off at the datetime are returned.
    </para>
    <para>
     All datetime entries consist of an object that contains:
     <itemizedlist>
      <listitem>
       <simpara>
        int year - year
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int month - month
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int mday - day of month
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int hour - hour
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int min - minutes
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        int sec - seconds
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/ifx.xml
+++ phpdoc/kr/functions/ifx.xml
 <reference id="ref.ifx">
  <title>Informix functions</title>
  <titleabbrev>Informix</titleabbrev>

  <partintro>
   <para>
    The Informix driver for Informix (IDS) 7.x, SE 7.x, Universal
    Server (IUS) 9.x and IDS 2000 is implemented in "ifx.ec" and
    "php3_ifx.h" in the informix extension directory.  IDS 7.x support
    is fairly complete, with full support for BYTE and TEXT
    columns. IUS 9.x support is partly finished: the new data types
    are there, but SLOB and CLOB support is still under construction.
   </para>
   <note>
    <title>Configuration notes</title>
    <para>
     You need a version of ESQL/C to compile the PHP Informix driver.
     ESQL/C versions from 7.2x on should be OK. ESQL/C is now part of
     the Informix Client SDK.
    </para>
    <para>
     Make sure that the "INFORMIXDIR" variable has been set, and that
     $INFORMIXDIR/bin is in your PATH before you run the "configure"
     script.
    </para>
    <para> 
     The configure script will autodetect the libraries and include
     directories, if you run "configure --with_informix=yes".  You can
     overide this detection by specifying "IFX_LIBDIR", "IFX_LIBS" and
     "IFX_INCDIR" in the environment.  The configure script will also
     try to detect your Informix server version.  It will set the
     "HAVE_IFX_IUS" conditional compilation variable if your Informix
     version >= 9.00.
    </para>
   </note>
   <note>
    <title>Runtime considerations</title>
    <para>
     Make sure that the Informix environment variables INFORMIXDIR and
     INFORMIXSERVER are available to the PHP ifx driver, and that the
     INFORMIX bin directory is in the PATH. Check this by running a
     script that contains a call to <function>phpinfo()</function>
     before you start testing. The <function>phpinfo()</function>
     output should list these environment variables. This is true for
     both CGI php and Apache mod_php. You may have to set these
     environment variables in your Apache startup script.
    </para>
    <para>
     The Informix shared libraries should also be available to the
     loader (check LD_LINBRARY_PATH or ld.so.conf/ldconfig).
    </para>
   </note>
   <note>
    <title>
     Some notes on the use of BLOBs (TEXT and BYTE columns)
    </title>
    <para>
     BLOBs are normally addressed by BLOB identifiers.  Select queries
     return a "blob id" for every BYTE and TEXT column.  You can get
     at the contents with "string_var = ifx_get_blob($blob_id);" if
     you choose to get the BLOBs in memory (with :
     "ifx_blobinfile(0);").  If you prefer to receive the content of
     BLOB columns in a file, use "ifx_blobinfile(1);", and
     "ifx_get_blob($blob_id);" will get you the filename.  Use normal
     file I/O to get at the blob contents.
    </para>
    <para>
     For insert/update queries you must create these "blob id's"
     yourself with "<function>ifx_create_blob</function>;". You then
     plug the blob id's into an array, and replace the blob columns
     with a question mark (?) in the query string.  For
     updates/inserts, you are responsible for setting the blob
     contents with <function>ifx_update_blob</function>.
    </para>
    <para>
     The behaviour of BLOB columns can be altered by configuration
     variables that also can be set at runtime :
    </para>
    <para>
     configuration variable : ifx.textasvarchar
    </para>
    <para>
     configuration variable : ifx.byteasvarchar
    </para>
    <para>
     runtime functions :
    </para>
    <para>
     ifx_textasvarchar(0) : use blob id's for select queries with TEXT
     columns
    </para>
    <para>
     ifx_byteasvarchar(0) : use blob id's for select queries with BYTE
     columns
    </para>
    <para>
     ifx_textasvarchar(1) : return TEXT columns as if they were
     VARCHAR columns, so that you don't need to use blob id's for
     select queries.
    </para>
    <para>
     ifx_byteasvarchar(1) : return BYTE columns as if they were
     VARCHAR columns, so that you don't need to use blob id's for
     select queries.
    </para>
    <para>
     configuration variable : ifx.blobinfile
    </para>
    <para>
     runtime function :
    </para>
    <para>
     ifx_blobinfile_mode(0) : return BYTE columns in memory, the blob
     id lets you get at the contents.
    </para>
    <para>
     ifx_blobinfile_mode(1) : return BYTE columns in a file, the blob
     id lets you get at the file name.
    </para>
    <para>
     If you set ifx_text/byteasvarchar to 1, you can use TEXT and BYTE
     columns in select queries just like normal (but rather long)
     VARCHAR fields.  Since all strings are "counted" in PHP, this
     remains "binary safe".  It is up to you to handle this
     correctly. The returned data can contain anything, you are
     responsible for the contents.
    </para>
    <para>
     If you set ifx_blobinfile to 1, use the file name returned by
     ifx_get_blob(..) to get at the blob contents.  Note that in this
     case YOU ARE RESPONSIBLE FOR DELETING THE TEMPORARY FILES CREATED
     BY INFORMIX when fetching the row.  Every new row fetched will
     create new temporary files for every BYTE column.
    </para>
    <para>
     The location of the temporary files can be influenced by the
     environment variable "blobdir", default is "." (the current
     directory).  Something like : putenv(blobdir=tmpblob"); will ease
     the cleaning up of temp files accidentally left behind (their
     names all start with "blb").
    </para>
   </note>
   <note>
    <title>Automatically trimming "char" (SQLCHAR and SQLNCHAR) data</title>
    <para>
     This can be set with the configuration variable
    </para>
    <para>
     ifx.charasvarchar : if set to 1 trailing spaces will be
     automatically trimmed, to save you some "chopping".
    </para>
   </note>
   <note>
    <title>NULL values</title>
    <para>
     The configuration variable ifx.nullformat (and the runtime
     function <function>ifx_nullformat</function>) when set to true
     will return NULL columns as the string "NULL", when set to false
     they return the empty string. This allows you to discriminate
     between NULL columns and empty columns.
    </para>
   </note>
  </partintro>

  <refentry id="function.ifx-connect">
   <refnamediv>
    <refname>ifx_connect</refname>
    <refpurpose>Open Informix server connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifx_connect</function></funcdef>
      <paramdef>string <parameter><optional>database</optional>
                       </parameter></paramdef>
      <paramdef>string <parameter><optional>userid</optional>
                       </parameter></paramdef>
      <paramdef>string <parameter><optional>password</optional>
                       </parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns a connection identifier on success, or FALSE on
     error.
    </para>
    <para> 
     <function>ifx_connect</function> establishes a connection to an
     Informix server.  All of the arguments are optional, and if
     they're missing, defaults are taken from values supplied in <link
     linkend="configuration.file">configuration file</link>
     (ifx.default_host for the host (Informix libraries will use
     <envar>INFORMIXSERVER</envar> environment value if not defined),
     ifx.default_user for user, ifx.default_password for the password
     (none if not defined).
    </para>
    <para> 
     In case a second call is made to
     <function>ifx_connect</function> with the same arguments, no
     new link will be established, but instead, the link identifier of
     the already opened link will be returned.
    </para>
    <para> 
     The link to the server will be closed as soon as the execution of
     the script ends, unless it's closed earlier by explicitly calling
     <function>ifx_close</function>.
    </para>
    <para> 
     See also <function>ifx_pconnect</function>, and
     <function>ifx_close</function>.
     <example>
      <title>Connect to a Informix database</title>
      <programlisting role="php3">
$conn_id = ifx_connect ("mydb@ol_srv1", "imyself", "mypassword");
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-pconnect">
   <refnamediv>
    <refname>ifx_pconnect</refname>
    <refpurpose>Open persistent Informix connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifx_pconnect</function></funcdef>
      <paramdef>string 
       <parameter><optional>database</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>userid</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>password</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns: A positive Informix persistent link identifier on success,
     or false on error
    </para>
    <para>
     <function>ifx_pconnect</function> acts very much like
     <function>ifx_connect</function> with two major differences.
    </para>
    <para> 
     This function behaves exactly like <function>ifx_connect</function>
     when PHP is not running as an Apache module.
     First, when connecting, the function would first try to find a
     (persistent) link that's already open with the same host,
     username and password.  If one is found, an identifier for it
     will be returned instead of opening a new connection.
    </para>
    <para> 
     Second, the connection to the SQL server will not be closed when
     the execution of the script ends.  Instead, the link will remain
     open for future use (<function>ifx_close</function> will not
     close links established by <function>ifx_pconnect</function>).
    </para>
    <para> 
     This type of links is therefore called 'persistent'.
    </para>
    <para>
     See also: <function>ifx_connect</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-close">
   <refnamediv>
    <refname>ifx_close</refname>
    <refpurpose>Close Informix connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifx_close</function></funcdef>
      <paramdef>int 
       <parameter><optional>link_identifier</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns: always true.
    </para>
    <para> 
     <function>ifx_close</function> closes the link to an Informix
     database that's associated with the specified link identifier.
     If the link identifier isn't specified, the last opened link is
     assumed.
    </para>
    <para> 
     Note that this isn't usually necessary, as non-persistent open
     links are automatically closed at the end of the script's
     execution.
    </para>
    <para> 
     <function>ifx_close</function> will not close persistent links
     generated by <function>ifx_pconnect</function>.
    </para>
    <para> 
     See also: <function>ifx_connect</function>, and
     <function>ifx_pconnect</function>.
     <example>
      <title>Closing a Informix connection</title>
      <programlisting role="php3">
$conn_id = ifx_connect ("mydb@ol_srv", "itsme", "mypassword");
.. some queries and stuff ...
ifx_close($conn_id);
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-query">
   <refnamediv>
    <refname>ifx_query</refname>
    <refpurpose>Send Informix query</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifx_query</function></funcdef>
      <paramdef>string <parameter>query</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>link_identifier</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>cursor_type</optional></parameter>
      </paramdef>
      <paramdef>mixed 
       <parameter>
        <optional>blobidarray</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns: A positive Informix result identifier on success, or
     false on error.  
    </para>
    <para> 
     A "result_id" resource used by other functions to retrieve the
     query results.  Sets "affected_rows" for retrieval by the
     <function>ifx_affected_rows</function> function.
    </para>
    <para> 
     <function>ifx_query</function> sends a query to the currently
     active database on the server that's associated with the
     specified link identifier.  If the link identifier isn't
     specified, the last opened link is assumed.  If no link is open,
     the function tries to establish a link as if
     <function>ifx_connect</function> was called, and use it.
    </para>
    <para>
     Executes <parameter>query</parameter> on connection
     <parameter>conn_id</parameter>. For "select-type" queries a
     cursor is declared and opened. The optional
     <parameter>cursor_type</parameter> parameter allows you to make
     this a "scroll" and/or "hold" cursor.  It's a bitmask and can be
     either IFX_SCROLL, IFX_HOLD, or both or'ed together. Non-select
     queries are "execute immediate".  IFX_SCROLL and IFX_HOLD are
     symbolic constants and as such shouldn't be between quotes. I you
     omit this parameter the cursor is a normal sequential cursor.
    </para>
    <para>
     For either query type the number of (estimated or real) affected
     rows is saved for retrieval by
     <function>ifx_affected_rows</function>.
    </para>
    <para>
     If you have BLOB (BYTE or TEXT) columns in an update query, you
     can add a <parameter>blobidarray</parameter> parameter containing
     the corresponding "blob ids", and you should replace those
     columns with a "?" in the query text.
    </para>
    <para>
     If the contents of the TEXT (or BYTE) column allow it, you can
     also use "ifx_textasvarchar(1)" and "ifx_byteasvarchar(1)".  This
     allows you to treat TEXT (or BYTE) columns just as if they were
     ordinary (but long) VARCHAR columns for select queries, and you
     don't need to bother with blob id's.
    </para><para>
     With ifx_textasvarchar(0) or ifx_byteasvarchar(0) (the default
     situation), select queries will return BLOB columns as blob id's
     (integer value).  You can get the value of the blob as a string
     or file with the blob functions (see below).
    </para>
    <para>
     See also: <function>ifx_connect</function>.
     <example>
      <title>
       Show all rows of the "orders" table as a html table
      </title>
      <programlisting role="php3">
ifx_textasvarchar(1);      // use "text mode" for blobs
$res_id = ifx_query("select * from orders", $conn_id);
if (! $res_id) {
    printf("Can't select orders : %s\n&lt;br>%s&lt;br>\n", ifx_error());
    ifx_errormsg();
    die;
}
ifx_htmltbl_result($res_id, "border=\"1\"");
ifx_free_result($res_id);
      </programlisting>
     </example>
     <example>
      <title>Insert some values into the "catalog" table</title>
      <programlisting role="php3">
                      // create blob id's for a byte and text column
$textid = ifx_create_blob(0, 0, "Text column in memory");
$byteid = ifx_create_blob(1, 0, "Byte column in memory");
                      // store blob id's in a blobid array
$blobidarray[] = $textid;
$blobidarray[] = $byteid;
                      // launch query
$query = "insert into catalog (stock_num, manu_code, " .
         "cat_descr,cat_picture) values(1,'HRO',?,?)";
$res_id = ifx_query($query, $conn_id, $blobidarray);
if (! $res_id) {
  ... error ...
}
                     // free result id
ifx_free_result($res_id);
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-prepare">
   <refnamediv>
    <refname>ifx_prepare</refname>
    <refpurpose>Prepare an SQL-statement for execution</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifx_prepare</function></funcdef>
      <paramdef>string <parameter>query</parameter></paramdef>
      <paramdef>int <parameter>conn_id</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>cursor_def</optional></parameter>
      </paramdef>
      <paramdef>mixed <parameter>blobidarray</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a integer <parameter>result_id</parameter> for use by
     <function>ifx_do</function>.  Sets
     <parameter>affected_rows</parameter> for retrieval by the
     <function>ifx_affected_rows</function> function.  
    </para>
    <para>
     Prepares <parameter>query</parameter> on connection
     <parameter>conn_id</parameter>.  For "select-type" queries a
     cursor is declared and opened. The optional
     <parameter>cursor_type</parameter> parameter allows you to make
     this a "scroll" and/or "hold" cursor.  It's a bitmask and can be
     either IFX_SCROLL, IFX_HOLD, or both or'ed together.
    </para>
    <para> 
     For either query type the estimated number of affected rows is
     saved for retrieval by <function>ifx_affected_rows</function>.
    </para>
    <para>
     If you have BLOB (BYTE or TEXT) columns in the query, you can add
     a <parameter>blobidarray</parameter> parameter containing the
     corresponding "blob ids", and you should replace those columns
     with a "?" in the query text.
    </para>
    <para>
     If the contents of the TEXT (or BYTE) column allow it, you can
     also use "ifx_textasvarchar(1)" and "ifx_byteasvarchar(1)".  This
     allows you to treat TEXT (or BYTE) columns just as if they were
     ordinary (but long) VARCHAR columns for select queries, and you
     don't need to bother with blob id's.
    </para>
    <para>
     With ifx_textasvarchar(0) or ifx_byteasvarchar(0) (the default
     situation), select queries will return BLOB columns as blob id's
     (integer value).  You can get the value of the blob as a string
     or file with the blob functions (see below).
    </para>
    <para>
     See also: <function>ifx_do</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.ifx-do">
   <refnamediv>
    <refname>ifx_do</refname>
    <refpurpose>
     Execute a previously prepared SQL-statement
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifx_do</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns TRUE on success, FALSE on error.  
    </para>
    <para> 
     Executes a previously prepared query or opens a cursor for it.
    </para>
    <para> 
     Does NOT free <parameter>result_id</parameter> on error.
    </para>
    <para> 
     Also sets the real number of
     <function>ifx_affected_rows</function> for non-select statements
     for retrieval by <function>ifx_affected_rows</function>
    </para>
    <para>
     See also: <function>ifx_prepare</function>. There is a example.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-error">
   <refnamediv>
    <refname>ifx_error</refname>
    <refpurpose>Returns error code of last Informix call</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ifx_error</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     The Informix error codes (SQLSTATE &amp; SQLCODE) formatted as
     follows :
    </para>
    <para>
     x [SQLSTATE = aa bbb SQLCODE=cccc]
    </para>
    <para>
     where x = space : no error
    </para>
    <para> 
     E : error
    </para>
    <para> 
     N : no more data
    </para>
    <para>        
     W : warning
    </para>
    <para>        
     ? : undefined
    </para>
    <para>
     If the "x" character is anything other than space, SQLSTATE and
     SQLCODE describe the error in more detail.
    </para>
    <para>
     See the Informix manual for the description of SQLSTATE and
     SQLCODE
    </para>
    <para>
     Returns in a string one character describing the general results
     of a statement and both SQLSTATE and SQLCODE associated with the
     most recent SQL statement executed. The format of the string is
     "(char) [SQLSTATE=(two digits) (three digits) SQLCODE=(one
     digit)]". The first character can be '<literal> </literal>'
     (space) (success), '<literal>W</literal>' (the statement caused
     some warning), '<literal>E</literal>' (an error happened when
     executing the statement) or '<literal>N</literal>' (the statement
     didn't return any data).  
    </para>
    <para> 
     See also: <function>ifx_errormsg</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-errormsg">
   <refnamediv>
    <refname>ifx_errormsg</refname>
    <refpurpose>Returns error message of last Informix call</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ifx_errormsg</function></funcdef>
      <paramdef>int 
       <parameter><optional>errorcode</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the Informix error message associated with the most
     recent Informix error, or, when the optional
     "<parameter>errorcode</parameter>" param is present, the error
     message corresponding to "<parameter>errorcode</parameter>".
    </para>
    <para> 
     See also: <function>ifx_error</function>
    </para>
    <informalexample>
     <programlisting role="php3">
printf("%s\n&lt;br>", ifx_errormsg(-201));
     </programlisting>
    </informalexample>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-affected-rows">
   <refnamediv>
    <refname>ifx_affected_rows</refname>
    <refpurpose>Get number of rows affected by a query</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifx_affected_rows</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <parameter>result_id</parameter> is a valid result id returned by
     <function>ifx_query</function> or
     <function>ifx_prepare</function>. 
    </para>
    <para> 
     Returns the number of rows affected by a query associated with
     <parameter>result_id</parameter>.  
    </para>
    <para> 
     For inserts, updates and deletes the number is the real number
     (sqlerrd[2]) of affected rows. For selects it is an estimate
     (sqlerrd[0]). Don't rely on it. The database server can never
     return the actual number of rows that will be returned by a
     SELECT because it has not even begun fetching them at this stage
     (just after the "PREPARE" when the optimizer has determined the
     query plan).
    </para>
    <para> 
     Useful after <function>ifx_prepare</function> to limit queries to
     reasonable result sets.
    </para>
    <para>
     See also: <function>ifx_num_rows</function>
    </para>
     <example>
      <title>Informix affected rows</title>
      <programlisting role="php3">
$rid = ifx_prepare ("select * from emp 
                     where name like " . $name, $connid);
if (! $rid) {
    ... error ...
}
$rowcount = ifx_affected_rows ($rid);
if ($rowcount > 1000) {
    printf ("Too many rows in result set (%d)\n&lt;br>", $rowcount);
    die ("Please restrict your query&lt;br>\n");
}
     </programlisting>
    </example>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-getsqlca">
   <refnamediv>
    <refname>ifx_getsqlca</refname>
    <refpurpose>
     Get the contents of sqlca.sqlerrd[0..5] after a query
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>ifx_getsqlca</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <parameter>result_id</parameter> is a valid result id returned by
     <function>ifx_query</function> or
     <function>ifx_prepare</function>. 
    </para>
    <para> 
     Returns a pseudo-row (assiociative array) with sqlca.sqlerrd[0]
     ... sqlca.sqlerrd[5] after the query associated with
     <parameter>result_id</parameter>.
    </para>
    <para> 
     For inserts, updates and deletes the values returned are those as
     set by the server after executing the query. This gives access to
     the number of affected rows and the serial insert value. For
     SELECTs the values are those saved after the PREPARE
     statement. This gives access to the *estimated* number of
     affected rows. The use of this function saves the overhead of
     executing a "select dbinfo('sqlca.sqlerrdx')" query, as it
     retrieves the values that were saved by the ifx driver at the
     appropriate moment.
    </para>
    <example>
     <title>Retrieve Informix sqlca.sqlerrd[x] values</title>
     <programlisting role="php3">
/* assume the first column of 'sometable' is a serial */
$qid = ifx_query("insert into sometable 
                  values (0, '2nd column', 'another column') ", $connid);
if (! $qid) {
    ... error ...
}
$sqlca = ifx_getsqlca ($qid);
$serial_value = $sqlca["sqlerrd1"];
echo "The serial value of the inserted row is : " . $serial_value&lt;br>\n"; 
     </programlisting>
    </example>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-fetch-row">
   <refnamediv>
    <refname>ifx_fetch_row</refname>
    <refpurpose>Get row as enumerated array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>ifx_fetch_row</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>mixed 
       <parameter><optional>position</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns an associative array that corresponds to the fetched row,
     or false if there are no more rows.
    </para>
    <para>
     Blob columns are returned as integer blob id values for use in
     <function>ifx_get_blob</function> unless you have used
     ifx_textasvarchar(1) or ifx_byteasvarchar(1), in which case blobs
     are returned as string values.  Returns FALSE on error
    </para>
    <para>
     <parameter>result_id</parameter> is a valid resultid returned by
     <function>ifx_query</function> or
     <function>ifx_prepare</function> (select type queries only!).
    </para>
    <para>
     <parameter><optional>position</optional></parameter> is an
     optional parameter for a "fetch" operation on "scroll" cursors:
     "NEXT", "PREVIOUS", "CURRENT", "FIRST", "LAST" or a number.  If
     you specify a number, an "absolute" row fetch is executed.  This
     parameter is optional, and only valid for SCROLL cursors.
    </para>
    <para>
     <function>ifx_fetch_row</function> fetches one row of data from
     the result associated with the specified result identifier.  The
     row is returned as an array.  Each result column is stored in an
     array offset, starting at offset 0, with the column name as key.
    </para>
    <para>
     Subsequent calls to <function>ifx_fetch_row</function> would
     return the next row in the result set, or false if there are no
     more rows.
    </para>
    <example>
     <title>Informix fetch rows</title>
     <programlisting role="php3">
$rid = ifx_prepare ("select * from emp where name like " . $name,
                     $connid, IFX_SCROLL);
if (! $rid) {
    ... error ...
}
$rowcount = ifx_affected_rows($rid);
if ($rowcount > 1000) {
    printf ("Too many rows in result set (%d)\n&lt;br>", $rowcount);
    die ("Please restrict your query&lt;br>\n");
}
if (! ifx_do ($rid)) {
   ... error ...
}
$row = ifx_fetch_row ($rid, "NEXT");
while (is_array($row)) {
    for(reset($row); $fieldname=key($row); next($row)) {
        $fieldvalue = $row[$fieldname];
        printf ("%s = %s,", $fieldname, $fieldvalue);
    }
    printf("\n&lt;br>");
    $row = ifx_fetch_row ($rid, "NEXT");
}
ifx_free_result ($rid);
     </programlisting>
    </example>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-htmltbl-result">
   <refnamediv>
    <refname>ifx_htmltbl_result</refname>
    <refpurpose>
     Formats all rows of a query into a HTML table
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifx_htmltbl_result</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>html_table_options</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the number of rows fetched or FALSE on error.
    </para>
    <para>
     Formats all rows of the <parameter>result_id</parameter> query
     into a html table. The optional second argument is a string of
     &lt;table&gt; tag options
    </para>
    <example>
     <title>Informix results as HTML table</title>
     <programlisting role="php3">
$rid = ifx_prepare ("select * from emp where name like " . $name,
                     $connid, IFX_SCROLL);
if (! $rid) {
   ... error ...
}
$rowcount = ifx_affected_rows ($rid);
if ($rowcount > 1000) {
    printf ("Too many rows in result set (%d)\n&lt;br>", $rowcount);
    die ("Please restrict your query&lt;br>\n");
}
if (! ifx_do($rid) {
  ... error ...
}

ifx_htmltbl_result ($rid, "border=\"2\"");

ifx_free_result($rid);
     </programlisting>
    </example>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-fieldtypes">
   <refnamediv>
    <refname>ifx_fieldtypes</refname>
    <refpurpose>List of Informix SQL fields</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>ifx_fieldtypes</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an associative array with fieldnames as key and the SQL
     fieldtypes as data for query with
     <parameter>result_id</parameter>.  Returns FALSE on error.
    </para>
    <example>
     <title>Fielnames and SQL fieldtypes</title>
     <programlisting role="php3">
$types = ifx_fieldtypes ($resultid);
if (! isset ($types)) {
  ... error ...
}
for ($i = 0; $i &lt; count($types); $i++) {
    $fname = key($types);
    printf("%s :\t type =  %s\n", $fname, $types[$fname]);
    next($types);
}
     </programlisting>
    </example>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-fieldproperties">
   <refnamediv>
    <refname>ifx_fieldproperties</refname>
    <refpurpose>List of SQL fieldproperties</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>ifx_fieldproperties</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an associative array with fieldnames as key and the SQL
     fieldproperties as data for a query with
     <parameter>result_id</parameter>.  Returns FALSE on error.
    </para>
    <para>
     Returns the Informix SQL fieldproperies of every field in the
     query as an associative array.  Properties are encoded as:
     "SQLTYPE;length;precision;scale;ISNULLABLE" where SQLTYPE = the
     Informix type like "SQLVCHAR" etc. and ISNULLABLE = "Y" or "N".
    </para>
    <example>
     <title>Informix SQL fieldproperties</title>
     <programlisting role="php3">
$properties = ifx_fieldproperties ($resultid);
if (! isset($properties)) {
  ... error ...
}
for ($i = 0; $i &lt; count($properties); $i++) {
    $fname = key ($properties);
    printf ("%s:\t type =  %s\n", $fname, $properties[$fname]);
    next ($properties);
}
     </programlisting>
    </example>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-num-fields">
   <refnamediv>
    <refname>ifx_num_fields</refname>
    <refpurpose>Returns the number of columns in the query</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifx_num_fields</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the number of columns in query for
     <parameter>result_id</parameter> or FALSE on error
    </para>
    <para>
     After preparing or executing a query, this call gives you the
     number of columns in the query.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-num-rows">
   <refnamediv>
    <refname>ifx_num_rows</refname>
    <refpurpose>Count the rows already fetched a query</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifx_num_rows</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Gives the number of rows fetched so far for a query with
     <parameter>result_id</parameter> after a
     <function>ifx_query</function> or <function>ifx_do</function>
     query.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-free-result">
   <refnamediv>
    <refname>ifx_free_result</refname>
    <refpurpose>Releases resources for the query</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifx_free_result</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Releases resources for the query associated with
     <parameter>result_id</parameter>.  Returns FALSE on error.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-create-char">
   <refnamediv>
    <refname>ifx_create_char</refname>
    <refpurpose>Creates an char object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifx_create_char</function></funcdef>
      <paramdef>string <parameter>param</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Creates an char object. <parameter>param</parameter> should
     be the char content.
    </para> 
   </refsect1>
  </refentry>

  <refentry id="function.ifx-free-char">
   <refnamediv>
    <refname>ifx_free_char</refname>
    <refpurpose>Deletes the char object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifx_free_char</function></funcdef>
      <paramdef>int <parameter>bid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Deletes the charobject for the given char object-id
     <parameter>bid</parameter>. Returns FALSE on error otherwise
     TRUE.  
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-update-char">
   <refnamediv>
    <refname>ifx_update_char</refname>
    <refpurpose>Updates the content of the char object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifx_update_char</function></funcdef>
      <paramdef>int <parameter>bid</parameter></paramdef>
      <paramdef>string <parameter>content</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Updates the content of the char object for the given char object
     <parameter>bid</parameter>. <parameter>content</parameter> is a
     string with new data. Returns FALSE on error otherwise TRUE.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-get-char">
   <refnamediv>
    <refname>ifx_get_char</refname>
    <refpurpose>Return the content of the char object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifx_get_char</function></funcdef>
      <paramdef>int <parameter>bid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the content of the char object for the given char
     object-id <parameter>bid</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-create-blob">
   <refnamediv>
    <refname>ifx_create_blob</refname>
    <refpurpose>Creates an blob object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifx_create_blob</function></funcdef>
      <paramdef>int <parameter>type</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
      <paramdef>string <parameter>param</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Creates an blob object.
    </para>
    <para>
     type: 1 = TEXT, 0 = BYTE
    </para>
    <para>
     mode: 0 = blob-object holds the content in memory, 
           1 = blob-object holds the content in file.
    </para>
    <para>
     param: if mode = 0: pointer to the content,
            if mode = 1: pointer to the filestring.
    </para>
    <para>
     Return FALSE on error, otherwise the new blob object-id.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-copy-blob">
   <refnamediv>
    <refname>ifx_copy_blob</refname>
    <refpurpose>Duplicates the given blob object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifx_copy_blob</function></funcdef>
      <paramdef>int <parameter>bid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Duplicates the given blob object. <parameter>bid</parameter> is
     the ID of the blob object.
    </para>
    <para>
     Returns FALSE on error otherwise the new blob object-id.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-free-blob">
   <refnamediv>
    <refname>ifx_free_blob</refname>
    <refpurpose>Deletes the blob object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifx_free_blob</function></funcdef>
      <paramdef>int <parameter>bid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Deletes the blobobject for the given blob object-id
     <parameter>bid</parameter>.  Returns FALSE on error otherwise
     TRUE.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-get-blob">
   <refnamediv>
    <refname>ifx_get_blob</refname>
    <refpurpose>Return the content of a blob object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifx_get_blob</function></funcdef>
      <paramdef>int <parameter>bid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the content of the blob object for the given blob
     object-id <parameter>bid</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-update-blob">
   <refnamediv>
    <refname>ifx_update_blob</refname>
    <refpurpose>Updates the content of the blob object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef><function>ifx_update_blob</function></funcdef>
      <paramdef>int <parameter>bid</parameter></paramdef>
      <paramdef>string <parameter>content</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Updates the content of the blob object for the given blob object
     <parameter>bid</parameter>. <parameter>content</parameter> is a
     string with new data.  Returns FALSE on error otherwise TRUE.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-blobinfile-mode">
   <refnamediv>
    <refname>ifx_blobinfile_mode</refname>
    <refpurpose>Set the default blob mode for all select queries</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>ifx_blobinfile_mode</function></funcdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Set the default blob mode for all select queries. Mode "0" means
     save Byte-Blobs in memory, and mode "1" means save Byte-Blobs in
     a file.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-textasvarchar">
   <refnamediv>
    <refname>ifx_textasvarchar</refname>
    <refpurpose>Set the default text mode</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>ifx_textasvarchar</function></funcdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets the default text mode for all select-queries.  Mode "0" will
     return a blob id, and mode "1" will return a varchar with text
     content.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-byteasvarchar">
   <refnamediv>
    <refname>ifx_byteasvarchar</refname>
    <refpurpose>Set the default byte mode</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>ifx_byteasvarchar</function></funcdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets the default byte mode for all select-queries.  Mode "0" will
     return a blob id, and mode "1" will return a varchar with text
     content.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifx-nullformat">
   <refnamediv>
    <refname>ifx_nullformat</refname>
    <refpurpose>
     Sets the default return value on a fetch row
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>ifx_nullformat</function></funcdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets the default return value of a NULL-value on a fetch row.
     Mode "0" returns "", and mode "1" returns "NULL".
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifxus-create-slob">
   <refnamediv>
    <refname>ifxus_create_slob</refname>
    <refpurpose>Creates an slob object and opens it</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifxus_create_slob</function></funcdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Creates an slob object and opens it.  Modes: 1 = LO_RDONLY, 2 =
     LO_WRONLY, 4 = LO_APPEND, 8 = LO_RDWR, 16 = LO_BUFFER, 32 =
     LO_NOBUFFER -> or-mask. You can also use constants named
     IFX_LO_RDONLY, IFX_LO_WRONLY etc.  Return FALSE on error otherwise
     the new slob object-id.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifxus-free-slob">
   <refnamediv>
    <refname>ifxus_free_slob</refname>
    <refpurpose>Deletes the slob object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifxus_free_slob</function></funcdef>
      <paramdef>int <parameter>bid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Deletes the slob object. <parameter>bid</parameter> is the Id of
     the slob object.  Returns FALSE on error otherwise TRUE.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifxus-close-slob">
   <refnamediv>
    <refname>ifxus_close_slob</refname>
    <refpurpose>Deletes the slob object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifxus_close_slob</function></funcdef>
      <paramdef>int <parameter>bid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Deletes the slob object on the given slob object-id
     <parameter>bid</parameter>.  Return FALSE on error otherwise
     TRUE.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifxus-open-slob">
   <refnamediv>
    <refname>ifxus_open_slob</refname>
    <refpurpose>Opens an slob object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifxus_open_slob</function></funcdef>
      <paramdef>long <parameter>bid</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Opens an slob object. <parameter>bid</parameter> should be an
     existing slob id.  Modes: 1 = LO_RDONLY, 2 = LO_WRONLY, 4 =
     LO_APPEND, 8 = LO_RDWR, 16 = LO_BUFFER, 32 = LO_NOBUFFER ->
     or-mask.  Returns FALSE on error otherwise the new slob
     object-id.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifxus-tell-slob">
   <refnamediv>
    <refname>ifxus_tell_slob</refname>
    <refpurpose>Returns the current file or seek position</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifxus_tell_slob</function></funcdef>
      <paramdef>long <parameter>bid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the current file or seek position of an open slob object
     <parameter>bid</parameter> should be an existing slob id.  Return
     FALSE on error otherwise the seek position.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifxus-seek-slob">
   <refnamediv>
    <refname>ifxus_seek_slob</refname>
    <refpurpose>Sets the current file or seek position</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifxus_seek_blob</function></funcdef>
      <paramdef>long <parameter>bid</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
      <paramdef>long <parameter>offset</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets the current file or seek position of an open slob object.
     <parameter>bid</parameter> should be an existing slob id.  Modes:
     0 = LO_SEEK_SET, 1 = LO_SEEK_CUR, 2 = LO_SEEK_END and
     <parameter>offset</parameter> is an byte offset.  Return FALSE on
     error otherwise the seek position.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifxus-read-slob">
   <refnamediv>
    <refname>ifxus_read_slob</refname>
    <refpurpose>Reads nbytes of the slob object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifxus_read_slob</function></funcdef>
      <paramdef>long <parameter>bid</parameter></paramdef>
      <paramdef>long <parameter>nbytes</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Reads nbytes of the slob object.  <parameter>bid</parameter> is a
     existing slob id and <parameter>nbytes</parameter> is the number
     of bytes zu read.  Return FALSE on error otherwise the string.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ifxus-write-slob">
   <refnamediv>
    <refname>ifxus_write_slob</refname>
    <refpurpose>Writes a string into the slob object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ifxus_write_slob</function></funcdef>
      <paramdef>long <parameter>bid</parameter></paramdef>
      <paramdef>string <parameter>content</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Writes a string into the slob object.  <parameter>bid</parameter>
     is a existing slob id and <parameter>content</parameter> the
     content to write.  Return FALSE on error otherwise bytes written.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/image.xml
+++ phpdoc/kr/functions/image.xml
 <reference id="ref.image">
  <title>Image functions</title>
  <titleabbrev>Graphics</titleabbrev>

  <partintro>
   <simpara>
    You can use the image functions in PHP to get the size of
    <acronym>JPEG</acronym>, <acronym>GIF</acronym>,
    <acronym>PNG</acronym>, and <acronym>SWF</acronym> images, and if
    you have the <acronym>GD</acronym> library (available at <ulink
    url="&url.gd;">&url.gd;</ulink>) you will also be able to create
    and manipulate images.
   </simpara>
   <simpara>
    The format of images you are able to manipulate depend on the
    version of gd you install, and any other libraries gd might need
    to access those image formats. Versions of gd older than gd-1.6
    support gif format images, and do not support png, where versions
    greater than gd-1.6 support png, not gif.
   </simpara>
   <simpara>
    In order to read and write images in jpeg format, you will need to
    obtain and install jpeg-6b (available at 
    <ulink url="&url.jpeg;">&url.jpeg;</ulink>), and then recompile gd to
    make use of jpeg-6b. You will also have to compile PHP with 
    <option role="configure">--with-jpeg-dir=/path/to/jpeg-6b</option>.
   </simpara>
   <simpara>
    To add support for Type 1 fonts, you can install t1lib (available 
    at <ulink url="&url.t1lib;">&url.t1lib;</ulink>), and then add 
    <option role="configure">--with-t1lib[=dir]</option>.
   </simpara>
  </partintro>

  <refentry id="function.getimagesize">
   <refnamediv>
    <refname>GetImageSize</refname>
    <refpurpose>Get the size of a GIF, JPEG, PNG or SWF image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>getimagesize</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
      <paramdef>array 
       <parameter><optional>imageinfo</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>GetImageSize</function> function will determine the
     size of any <acronym>GIF</acronym>, <acronym>JPG</acronym>,
     <acronym>PNG</acronym> or <acronym>SWF</acronym> image file and
     return the dimensions along with the file type and a height/width
     text string to be used inside a normal <acronym>HTML</acronym>
     <sgmltag>IMG</sgmltag> tag.
    </para>
    <para>
     Returns an array with 4 elements.  Index 0 contains the width of
     the image in pixels.  Index 1 contains the height.  Index 2 a
     flag indicating the type of the image.  1 = GIF, 2 = JPG, 3 =
     PNG, 4 = SWF.  Index 3 is a text string with the correct
     "height=xxx width=xxx" string that can be used directly in an IMG
     tag.
     <example>
      <title>GetImageSize</title>
      <programlisting role="php">
&lt;?php $size = GetImageSize ("img/flag.jpg"); ?>
&lt;IMG SRC="img/flag.jpg" &lt;?php echo $size[3]; ?>
      </programlisting>
     </example>
    </para>
    <para>
     The optional <parameter>imageinfo</parameter> parameter allows
     you to extract some extended information from the image
     file. Currently this will return the diffrent
     <acronym>JPG</acronym> APP markers in an associative Array. Some
     Programs use these APP markers to embedd text information in
     images. A very common one in to embed <acronym>IPTC</acronym>
     <ulink url="&url.iptc;">&url.iptc;</ulink> information in the
     APP13 marker. You can use the <function>iptcparse</function>
     function to parse the binary APP13 marker into something
     readable.
     <example>
      <title>GetImageSize returning IPTC</title>
      <programlisting>
&lt;?php 
    $size = GetImageSize ("testimg.jpg",&amp;$info);
    if (isset ($info["APP13"])) {
        $iptc = iptcparse ($info["APP13"]);
        var_dump ($iptc);
    }
?&gt;
      </programlisting>
     </example>
     <note>
      <simpara>
       This function does not require the GD image library.
      </simpara>
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagearc">
   <refnamediv>
    <refname>ImageArc</refname>
    <refpurpose>Draw a partial ellipse</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagearc</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int <parameter>cx</parameter></paramdef>
      <paramdef>int <parameter>cy</parameter></paramdef>
      <paramdef>int <parameter>w</parameter></paramdef>
      <paramdef>int <parameter>h</parameter></paramdef>
      <paramdef>int <parameter>s</parameter></paramdef>
      <paramdef>int <parameter>e</parameter></paramdef>
      <paramdef>int <parameter>col</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ImageArc</function> draws a partial ellipse centered at
     <parameter>cx</parameter>, <parameter>cy</parameter> (top left is
     0, 0) in the image represented by im.  <parameter>W</parameter>
     and <parameter>h</parameter> specifies the ellipse's width and
     height respectively while the start and end points are specified
     in degrees indicated by the <parameter>s</parameter> and
     <parameter>e</parameter>.  arguments.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagechar">
   <refnamediv>
    <refname>ImageChar</refname>
    <refpurpose>Draw a character horizontally</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagechar</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int <parameter>font</parameter></paramdef>
      <paramdef>int <parameter>x</parameter></paramdef>
      <paramdef>int <parameter>y</parameter></paramdef>
      <paramdef>string <parameter>c</parameter></paramdef>
      <paramdef>int <parameter>col</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ImageChar</function> draws the first character of
     <parameter>c</parameter> in the image identified by
     <parameter>id</parameter> with its upper-left at
     <parameter>x</parameter>,<parameter>y</parameter> (top left is 0,
     0) with the color <parameter>col</parameter>. If font is 1, 2, 3,
     4 or 5, a built-in font is used (with higher numbers
     corresponding to larger fonts).
    </para>
    <para>
     See also <function>imageloadfont</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecharup">
   <refnamediv>
    <refname>ImageCharUp</refname>
    <refpurpose>Draw a character vertically</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagecharup</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int <parameter>font</parameter></paramdef>
      <paramdef>int <parameter>x</parameter></paramdef>
      <paramdef>int <parameter>y</parameter></paramdef>
      <paramdef>string <parameter>c</parameter></paramdef>
      <paramdef>int <parameter>col</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>ImageCharUp</function> draws the character
     <parameter>c</parameter> vertically in the image identified by
     <parameter>im</parameter> at coordinates
     <parameter>x</parameter>, <parameter>y</parameter> (top left is
     0, 0) with the color <parameter>col</parameter>.  If font is 1,
     2, 3, 4 or 5, a built-in font is used.
    </para>
    <para>    
     See also <function>imageloadfont</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecolorallocate">
   <refnamediv>
    <refname>ImageColorAllocate</refname>
    <refpurpose>Allocate a color for an image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagecolorallocate</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int <parameter>red</parameter></paramdef>
      <paramdef>int <parameter>green</parameter></paramdef>
      <paramdef>int <parameter>blue</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ImageColorAllocate</function> returns a color
     identifier representing the color composed of the given
     <acronym>RGB</acronym> components.  The <parameter>im</parameter>
     argument is the return from the <function>imagecreate</function>
     function.  <function>ImageColorAllocate</function> must be called
     to create each color that is to be used in the image represented
     by <parameter>im</parameter>.
     <informalexample>
      <programlisting role="php">
$white = ImageColorAllocate ($im, 255, 255, 255);
$black = ImageColorAllocate ($im, 0, 0, 0);
      </programlisting>
     </informalexample>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.imagecolordeallocate">
   <refnamediv>
    <refname>ImageColorDeAllocate</refname>
    <refpurpose>
     De-allocate a color for an image
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>imagecolordeallocate</function>
      </funcdef>
      <paramdef>int 
       <parameter>im</parameter>
      </paramdef>
      <paramdef>int 
       <parameter>index</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>ImageColorDeAllocate</function> function
     de-allocates a color previously allocated with the
     <function>ImageColorAllocate</function> function.
     <informalexample>
      <programlisting role="php">
$white = ImageColorAllocate($im, 255, 255, 255);
ImageColorDeAllocate($im, $white);
      </programlisting>
     </informalexample>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecolorat">
   <refnamediv>
    <refname>ImageColorAt</refname>
    <refpurpose>Get the index of the color of a pixel</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagecolorat</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int <parameter>x</parameter></paramdef>
      <paramdef>int <parameter>y</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the index of the color of the pixel at the
     specified location in the image.
    </para>
    <para>
     See also <function>imagecolorset</function> and
     <function>imagecolorsforindex</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecolorclosest">
   <refnamediv>
    <refname>ImageColorClosest</refname>
    <refpurpose>
     Get the index of the closest color to the specified color
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagecolorclosest</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int <parameter>red</parameter></paramdef>
      <paramdef>int <parameter>green</parameter></paramdef>
      <paramdef>int <parameter>blue</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the index of the color in the palette of the image which
     is "closest" to the specified <acronym>RGB</acronym> value.
    </para>
    <para>
     The "distance" between the desired color and each color in the
     palette is calculated as if the <acronym>RGB</acronym> values
     represented points in three-dimensional space.
    </para>
    <para>
     See also <function>imagecolorexact</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecolorexact">
   <refnamediv>
    <refname>ImageColorExact</refname>
    <refpurpose>Get the index of the specified color</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagecolorexact</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int <parameter>red</parameter></paramdef>
      <paramdef>int <parameter>green</parameter></paramdef>
      <paramdef>int <parameter>blue</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the index of the specified color in the palette of the
     image.
    </para>
    <para>
     If the color does not exist in the image's palette, -1 is
     returned.
    </para>
    <para>
     See also <function>imagecolorclosest</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecolorresolve">
   <refnamediv>
    <refname>ImageColorResolve</refname>
    <refpurpose>
     Get the index of the specified color or its closest possible
     alternative
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagecolorresolve</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int <parameter>red</parameter></paramdef>
      <paramdef>int <parameter>green</parameter></paramdef>
      <paramdef>int <parameter>blue</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function is guaranteed to return a color index for a
     requested color, either the exact color or the closest possible
     alternative.
    </para>
    <para>
     See also <function>imagecolorclosest</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagegammacorrect">
   <refnamediv>
    <refname>ImageGammaCorrect</refname>
    <refpurpose>
     Apply a gamma correction to a GD image
    </refpurpose>
    </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>imagegammacorrect</function>
      </funcdef>
      <paramdef>int 
       <parameter>im</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>inputgamma</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>outputgamma</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>ImageGammaCorrect</function> function applies gamma
     correction to a gd image stream (<parameter>im</parameter>) given
     an input gamma, the parameter <parameter>inputgamma</parameter>
     and an output gamma, the parameter
     <parameter>outputgamma</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecolorset">
   <refnamediv>
    <refname>ImageColorSet</refname>
    <refpurpose>
     Set the color for the specified palette index
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>imagecolorset</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int <parameter>index</parameter></paramdef>
      <paramdef>int <parameter>red</parameter></paramdef>
      <paramdef>int <parameter>green</parameter></paramdef>
      <paramdef>int <parameter>blue</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This sets the specified index in the palette to the specified
     color. This is useful for creating flood-fill-like effects in
     paletted images without the overhead of performing the actual
     flood-fill.
    </para>
    <para>
     See also <function>imagecolorat</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecolorsforindex">
   <refnamediv>
    <refname>ImageColorsForIndex</refname>
    <refpurpose>Get the colors for an index</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>imagecolorsforindex</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int <parameter>index</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This returns an associative array with red, green, and blue keys
     that contain the appropriate values for the specified color
     index.
    </para>
    <para>
     See also <function>imagecolorat</function> and
     <function>imagecolorexact</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecolorstotal">
   <refnamediv>
    <refname>ImageColorsTotal</refname>
    <refpurpose>
     Find out the number of colors in an image's palette
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagecolorstotal</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This returns the number of colors in the specified image's
     palette.
    </para>
    <para>
     See also <function>imagecolorat</function> and
     <function>imagecolorsforindex</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecolortransparent">
   <refnamediv>
    <refname>ImageColorTransparent</refname>
    <refpurpose>Define a color as transparent</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagecolortransparent</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>col</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ImageColorTransparent</function> sets the transparent
     color in the <parameter>im</parameter> image to
     <parameter>col</parameter>.  <parameter>Im</parameter> is the
     image identifier returned by <function>ImageCreate</function> and
     <parameter>col</parameter> is a color identifier returned by
     <function>ImageColorAllocate</function>.
    </para>
    <para>
     The identifier of the new (or current, if none is specified)
     transparent color is returned.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecopy">
   <refnamediv>
    <refname>ImageCopy</refname>
    <refpurpose>
     Copy part of an image
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>ImageCopy</function>
      </funcdef>
      <paramdef>int 
       <parameter>dst_im</parameter>
      </paramdef>
      <paramdef>int
       <parameter>src_im</parameter>
      </paramdef>
      <paramdef>int
       <parameter>dst_x</parameter>
      </paramdef>
      <paramdef>int 
       <parameter>dst_y</parameter>
      </paramdef>
      <paramdef>int 
       <parameter>src_x</parameter>
      </paramdef>
      <paramdef>int 
       <parameter>src_y</parameter>
      </paramdef>
      <paramdef>int 
       <parameter>src_w</parameter>
      </paramdef>
      <paramdef>int 
       <parameter>src_h</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Copy a part of <parameter>src_im</parameter> onto
     <parameter>dst_im</parameter> starting at the x,y coordinates
     <parameter>src_x</parameter>, <parameter>src_y </parameter> with
     a width of <parameter>src_w</parameter> and a height of
     <parameter>src_h</parameter>.  The portion defined will be copied
     onto the x,y coordinates, <parameter>dst_x</parameter> and
     <parameter>dst_y</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecopyresized">
   <refnamediv>
    <refname>ImageCopyResized</refname>
    <refpurpose>Copy and resize part of an image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagecopyresized</function></funcdef>
      <paramdef>int <parameter>dst_im</parameter></paramdef>
      <paramdef>int <parameter>src_im</parameter></paramdef>
      <paramdef>int <parameter>dstX</parameter></paramdef>
      <paramdef>int <parameter>dstY</parameter></paramdef>
      <paramdef>int <parameter>srcX</parameter></paramdef>
      <paramdef>int <parameter>srcY</parameter></paramdef>
      <paramdef>int <parameter>dstW</parameter></paramdef>
      <paramdef>int <parameter>dstH</parameter></paramdef>
      <paramdef>int <parameter>srcW</parameter></paramdef>
      <paramdef>int <parameter>srcH</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ImageCopyResized</function> copies a rectangular
     portion of one image to another image.
     <parameter>Dst_im</parameter> is the destination image,
     <parameter>src_im</parameter> is the source image identifier.  If
     the source and destination coordinates and width and heights
     differ, appropriate stretching or shrinking of the image fragment
     will be performed.  The coordinates refer to the upper left
     corner.  This function can be used to copy regions within the
     same image (if <parameter>dst_im</parameter> is the same as
     <parameter>src_im</parameter>) but if the regions overlap the
     results will be unpredictable.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecreate">
   <refnamediv>
    <refname>ImageCreate</refname>
    <refpurpose>Create a new image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagecreate</function></funcdef>
      <paramdef>int <parameter>x_size</parameter></paramdef>
      <paramdef>int <parameter>y_size</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>ImageCreate</function> returns an image identifier
     representing a blank image of size <parameter>x_size</parameter>
     by <parameter>y_size</parameter>.
     <example>
      <title>
       Creating a new GD image stream and outputting an image.
      </title>
      <programlisting role="php">
&lt;?php
header ("Content-type: image/png");
$im = @ImageCreate (50, 100)
    or die ("Cannot Initialize new GD image stream");
$background_color = ImageColorAllocate ($im, 255, 255, 255);
$text_color = ImageColorAllocate ($im, 233, 14, 91);
ImageString ($im, 1, 5, 5,  "A Simple Text String", $text_color);
ImagePng ($im);
?>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecreatefromgif">
   <refnamediv>
    <refname>ImageCreateFromGIF</refname>
    <refpurpose>Create a new image from file or URL</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagecreatefromgif</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ImageCreateFromGif</function> returns an image identifier
     representing the image obtained from the given filename.
    </para>
    <para> 
     <function>ImageCreateFromGif</function> returns an empty string
     on failure. It also outputs an error message, which unfortunately
     displays as a broken link in a browser.  To ease debugging the
     following example will produce an error GIF:
    <example>
     <title>
      Example to handle an error during creation (courtesy
      [EMAIL PROTECTED])
     </title>
      <programlisting role="php">
function LoadGif ($imgname) {
    $im = @ImageCreateFromGIF ($imgname); /* Attempt to open */
    if (!$im) { /* See if it failed */
        $im = ImageCreate (150, 30); /* Create a blank image */
        $bgc = ImageColorAllocate ($im, 255, 255, 255);
        $tc  = ImageColorAllocate ($im, 0, 0, 0);
        ImageFilledRectangle ($im, 0, 0, 150, 30, $bgc); 
        /* Output an errmsg */
        ImageString($im, 1, 5, 5, "Error loading $imgname", $tc); 
    }
    return $im;
}
      </programlisting>
     </example>
     <note>
      <para>
       Since all GIF support was removed from the GD library in
       version 1.6, this function is not available if you are using
       that version of the GD library.
      </para>
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecreatefromjpeg">
   <refnamediv>
    <refname>ImageCreateFromJPEG</refname>
    <refpurpose>Create a new image from file or URL</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagecreatefromjpeg</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ImageCreateFromJPEG</function> returns an image identifier
     representing the image obtained from the given filename.
    </para>
    <para> 
     <function>ImagecreateFromJPEG</function> returns an empty string
     on failure. It also outputs an error message, which unfortunately
     displays as a broken link in a browser.  To ease debugging the
     following example will produce an error <acronym>JPEG</acronym>:
    <example>
     <title>
       Example to handle an error during creation (courtesy
       [EMAIL PROTECTED] )
      </title>
      <programlisting role="php">
function LoadJpeg ($imgname) {
    $im = @ImageCreateFromJPEG ($imgname); /* Attempt to open */
    if (!$im) { /* See if it failed */
        $im = ImageCreate (150, 30); /* Create a blank image */
        $bgc = ImageColorAllocate ($im, 255, 255, 255);
        $tc  = ImageColorAllocate ($im, 0, 0, 0);
        ImageFilledRectangle ($im, 0, 0, 150, 30, $bgc);
        /* Output an errmsg */
        ImageString ($im, 1, 5, 5, "Error loading $imgname", $tc); 
    }
    return $im;
}
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecreatefrompng">
   <refnamediv>
    <refname>ImageCreateFromPNG</refname>
    <refpurpose>Create a new image from file or URL</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagecreatefrompng</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ImageCreateFromPNG</function> returns an image identifier
     representing the image obtained from the given filename.
    </para>
    <para> 
     <function>ImageCreateFromPNG</function> returns an empty string
     on failure. It also outputs an error message, which unfortunately
     displays as a broken link in a browser.  To ease debugging the
     following example will produce an error <acronym>PNG</acronym>:
     <example>
      <title>
       Example to handle an error during creation (courtesy
       [EMAIL PROTECTED])
      </title>
      <programlisting role="php">
function LoadPNG ($imgname) {
    $im = @ImageCreateFromPNG ($imgname); /* Attempt to open */
    if (!$im) { /* See if it failed */
        $im  = ImageCreate (150, 30); /* Create a blank image */
        $bgc = ImageColorAllocate ($im, 255, 255, 255);
        $tc  = ImageColorAllocate ($im, 0, 0, 0);
        ImageFilledRectangle ($im, 0, 0, 150, 30, $bgc);
        /* Output an errmsg */
        ImageString ($im, 1, 5, 5, "Error loading $imgname", $tc); 
    }
    return $im;
}
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecreatefromwbmp">
   <refnamediv>
    <refname>ImageCreateFromWBMP</refname>
    <refpurpose>Create a new image from file or URL</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagecreatefromwbmp</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ImageCreateFromWBMP</function> returns an image identifier
     representing the image obtained from the given filename.
    </para>
    <para> 
     <function>ImageCreateFromWBMP</function> returns an empty string
     on failure. It also outputs an error message, which unfortunately
     displays as a broken link in a browser.  To ease debugging the
     following example will produce an error <acronym>WBMP</acronym>:
     <example>
      <title>
       Example to handle an error during creation (courtesy
       [EMAIL PROTECTED])
      </title>
      <programlisting role="php">
function LoadWBMP ($imgname) {
    $im = @ImageCreateFromWBMP ($imgname); /* Attempt to open */
    if (!$im) { /* See if it failed */
        $im  = ImageCreate (20, 20); /* Create a blank image */
        $bgc = ImageColorAllocate ($im, 255, 255, 255);
        $tc  = ImageColorAllocate ($im, 0, 0, 0);
        ImageFilledRectangle ($im, 0, 0, 10, 10, $bgc);
        /* Output an errmsg */
        ImageString ($im, 1, 5, 5, "Error loading $imgname", $tc); 
    }
    return $im;
}
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagecreatefromstring">
   <refnamediv>
    <refname>ImageCreateFromString</refname>
    <refpurpose>Create a new image from the image stream in the string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagecreatefromstring</function></funcdef>
      <paramdef>string <parameter>image</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ImageCreateFromString</function> returns an image identifier
     representing the image obtained from the given string.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagedashedline">
   <refnamediv>
    <refname>ImageDashedLine</refname>
    <refpurpose>Draw a dashed line</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagedashedline</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int <parameter>x1</parameter></paramdef>
      <paramdef>int <parameter>y1</parameter></paramdef>
      <paramdef>int <parameter>x2</parameter></paramdef>
      <paramdef>int <parameter>y2</parameter></paramdef>
      <paramdef>int <parameter>col</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>    
     <function>ImageDashedLine</function> draws a dashed line from
     <parameter>x1</parameter>, <parameter>y1</parameter> to
     <parameter>x2</parameter>, <parameter>y2</parameter> (top left is
     0, 0) in image <parameter>im</parameter> of color
     <parameter>col</parameter>.
    </para>
    <para>    
     See also <function>ImageLine</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagedestroy">
   <refnamediv>
    <refname>ImageDestroy</refname>
    <refpurpose>Destroy an image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagedestroy</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>    
     <function>ImageDestroy</function> frees any memory associated
     with image <parameter>im</parameter>.  <parameter>Im</parameter>
     is the image identifier returned by the
     <function>ImageCreate</function> function.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagefill">
   <refnamediv>
    <refname>ImageFill</refname>
    <refpurpose>Flood fill</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagefill</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int <parameter>x</parameter></paramdef>
      <paramdef>int <parameter>y</parameter></paramdef>
      <paramdef>int <parameter>col</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>    
     <function>ImageFill</function> performs a flood fill starting at
     coordinate <parameter>x</parameter>, <parameter>y</parameter>
     (top left is 0, 0) with color <parameter>col</parameter> in the
     image <parameter>im</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagefilledpolygon">
   <refnamediv>
    <refname>ImageFilledPolygon</refname>
    <refpurpose>Draw a filled polygon</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagefilledpolygon</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>array <parameter>points</parameter></paramdef>
      <paramdef>int <parameter>num_points</parameter></paramdef>
      <paramdef>int <parameter>col</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>ImageFilledPolygon</function> creates a filled polygon
     in image <parameter>im</parameter>.
     <parameter>Points</parameter> is a PHP array containing the
     polygon's vertices, ie. points[0] = x0, points[1] = y0, points[2]
     = x1, points[3] = y1, etc.  <parameter>Num_points</parameter> is
     the total number of vertices.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagefilledrectangle">
   <refnamediv>
    <refname>ImageFilledRectangle</refname>
    <refpurpose>Draw a filled rectangle</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagefilledrectangle</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int <parameter>x1</parameter></paramdef>
      <paramdef>int <parameter>y1</parameter></paramdef>
      <paramdef>int <parameter>x2</parameter></paramdef>
      <paramdef>int <parameter>y2</parameter></paramdef>
      <paramdef>int <parameter>col</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>ImageFilledRectangle</function> creates a filled
     rectangle of color <function>col</function> in image
     <parameter>im</parameter> starting at upper left coordinates
     <parameter>x1</parameter>, <parameter>y1</parameter> and ending
     at bottom right coordinates <parameter>x2</parameter>,
     <parameter>y2</parameter>.  0, 0 is the top left corner of the
     image.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagefilltoborder">
   <refnamediv>
    <refname>ImageFillToBorder</refname>
    <refpurpose>Flood fill to specific color</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagefilltoborder</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int <parameter>x</parameter></paramdef>
      <paramdef>int <parameter>y</parameter></paramdef>
      <paramdef>int <parameter>border</parameter></paramdef>
      <paramdef>int <parameter>col</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>    
     <function>ImageFillToBorder</function> performs a flood fill
     whose border color is defined by <parameter>border</parameter>.
     The starting point for the fill is <parameter>x</parameter>,
     <parameter>y</parameter> (top left is 0, 0) and the region is
     filled with color <parameter>col</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagefontheight">
   <refnamediv>
    <refname>ImageFontHeight</refname>
    <refpurpose>Get font height</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagefontheight</function></funcdef>
      <paramdef>int <parameter>font</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the pixel height of a character in the specified font.
    </para>
    <para>
     See also <function>ImageFontWidth</function> and
     <function>ImageLoadFont</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagefontwidth">
   <refnamediv>
    <refname>ImageFontWidth</refname>
    <refpurpose>Get font width</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagefontwidth</function></funcdef>
      <paramdef>int <parameter>font</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>    
     Returns the pixel width of a character in font.
    </para>
    <para> 
     See also <function>ImageFontHeight</function> and
     <function>ImageLoadFont</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagegif">
   <refnamediv>
    <refname>ImageGIF</refname>
    <refpurpose>Output image to browser or file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagegif</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>filename</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ImageGIF</function> creates the <acronym>GIF</acronym>
     file in filename from the image <parameter>im</parameter>. The
     <parameter>im</parameter> argument is the return from the
     <function>imagecreate</function> function.
    </para>
    <para>
     The image format will be <acronym>GIF87a</acronym> unless the
     image has been made transparent with
     <function>ImageColorTransparent</function>, in which case the
     image format will be <acronym>GIF89a</acronym>.
    </para>
    <para>
     The filename argument is optional, and if left off, the raw image
     stream will be output directly.  By sending an image/gif
     content-type using <function>header</function>, you can create a
     PHP script that outputs <acronym>GIF</acronym> images directly.
     <note>
      <para>
       Since all <acronym>GIF</acronym> support was removed from the
       <acronym>GD</acronym> library in version 1.6, this function is
       not available if you are using that version of the GD library.
      </para>
      <para>
       The following code snippet allows you to write more
       portable PHP applications by auto-detecting the
       type of GD support which is available. Replace
       the sequence <literal>Header("Content-type: image/gif");
       ImageGIF($im);</literal> by the more flexible sequence:
       <informalexample>
        <programlisting role="php">
&lt;?php
  if (function_exists("imagegif")) {
    Header("Content-type: image/gif");
    ImageGIF($im);
  }
  elseif (function_exists("imagejpeg")) {
    Header("Content-type: image/jpeg");
    ImageJPEG($im, "", 0.5);
  }
  elseif (function_exists("imagepng")) {
    Header("Content-type: image/png");
    ImagePNG($im);
  }
  elseif (function_exists("imagewbmp")) {
    Header("Content-type: image/vnd.wap.wbmp");
    ImageWBMP($im);
  }
  else
    die("No image support in this PHP server");
?&gt;
        </programlisting>
       </informalexample>
      </para>
     </note>
     <note>
      <para>
       As of version 3.0.18 and 4.0.2 you can use the function
       <function>imagetypes</function> in place of
       <function>function_exists</function> for checking
       the presence of the various supported image formats:
       <informalexample>
        <programlisting role="php">
if (ImageTypes() &amp; IMG_GIF) {
    Header("Content-type: image/gif");
    ImageGif($im);
}
elseif (ImageTypes() &amp; IMG_JPG) {
.. etc.</programlisting>
       </informalexample>
      </para>
     </note>
    </para>
    <para>
     See also <function>ImagePNG</function>, <function>ImageWBMP</function>, 
     <function>ImageJPEG</function>, <function>ImageTypes</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagepng">
   <refnamediv>
    <refname>ImagePNG</refname>
    <refpurpose>
     Output a PNG image to either the browser or a file
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>imagepng</function>
      </funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>string <parameter><optional>filename</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>ImagePNG</function> outputs a GD image stream
     (<parameter>im</parameter>) in PNG format to standard output
     (usually the browser) or, if a filename is given by the
     <parameter>filename</parameter> it outputs the image to the file.
     <informalexample>
      <programlisting role="php">
&lt;?php
$im = ImageCreateFromPng("test.png");
ImagePng($im);
?>
      </programlisting>
     </informalexample>
    </para>
    <para>
     See also <function>ImageGIF</function>, <function>ImageWBMP</function>, 
     <function>ImageJPEG</function>, <function>ImageTypes</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagejpeg">
   <refnamediv>
    <refname>ImageJPEG</refname>
    <refpurpose>Output image to browser or file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagejpeg</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>filename</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>quality</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ImageJPEG</function> creates the
     <acronym>JPEG</acronym> file in filename from the image
     <parameter>im</parameter>. The <parameter>im</parameter> argument
     is the return from the <function>ImageCreate</function> function.
    </para>
    <para>
     The filename argument is optional, and if left off, the raw image
     stream will be output directly.  To skip the filename argument in
     order to provide a quality argument just use an empty string
     ('').  By sending an image/jpeg content-type using
     <function>header</function>, you can create a PHP script that
     outputs JPEG images directly.
     <note>
      <para>
       JPEG support is only available in PHP if PHP was compiled
       against GD-1.8 or later.
      </para> 
     </note>
    </para>
    <para>
     See also <function>ImagePNG</function>, <function>ImageGIF</function>, 
     <function>ImageWBMP</function>, <function>ImageTypes</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagewbmp">
   <refnamediv>
    <refname>ImageWBMP</refname>
    <refpurpose>Output image to browser or file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imageWBMP</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>filename</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ImageWBMP</function> creates the
     <acronym>WBMP</acronym> file in filename from the image
     <parameter>im</parameter>. The <parameter>im</parameter> argument
     is the return from the <function>ImageCreate</function> function.
    </para>
    <para>
     The filename argument is optional, and if left off, the raw image
     stream will be output directly. 
     By sending an <acronym>image/vnd.wap.wbmp</acronym> content-type 
     using <function>header</function>, you can create 
     a PHP script that outputs WBMP images directly.
     <note>
      <para>
       WBMP support is only available in PHP if PHP was compiled
       against GD-1.8 or later.
      </para> 
     </note>
    </para>
    <para>
     See also <function>ImagePNG</function>, <function>ImageGIF</function>, 
     <function>ImageJPEG</function>, <function>ImageTypes</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imageinterlace">
   <refnamediv>
    <refname>ImageInterlace</refname>
    <refpurpose>Enable or disable interlace</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imageinterlace</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>interlace</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ImageInterlace</function> turns the interlace bit on or off.
     If interlace is 1 the im image will be interlaced, and if interlace
     is 0 the interlace bit is turned off.
    </para>
    <para>
     This functions returns whether the interlace bit is set for the
     image.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imageline">
   <refnamediv>
    <refname>ImageLine</refname>
    <refpurpose>Draw a line</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imageline</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int <parameter>x1</parameter></paramdef>
      <paramdef>int <parameter>y1</parameter></paramdef>
      <paramdef>int <parameter>x2</parameter></paramdef>
      <paramdef>int <parameter>y2</parameter></paramdef>
      <paramdef>int <parameter>col</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>    
     <function>ImageLine</function> draws a line from
     <parameter>x1</parameter>, <parameter>y1</parameter> to
     <parameter>x2</parameter>, <parameter>y2</parameter> (top left is
     0, 0) in image im of color <parameter>col</parameter>.  
    </para>
    <para> 
     See also <function>ImageCreate</function> and
     <function>ImageColorAllocate</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imageloadfont">
   <refnamediv>
    <refname>ImageLoadFont</refname>
    <refpurpose>Load a new font</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imageloadfont</function></funcdef>
      <paramdef>string <parameter>file</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ImageLoadFont</function> loads a user-defined bitmap
     font and returns an identifier for the font (that is always
     greater than 5, so it will not conflict with the built-in fonts).
    </para>
    <para>
     The font file format is currently binary and architecture
     dependent.  This means you should generate the font files on the
     same type of CPU as the machine you are running PHP on.
    </para>
    <para>
     <table>
      <title>Font file format</title>
      <tgroup cols="3">
       <thead>
        <row>
         <entry>byte position</entry>
         <entry>C data type</entry>
         <entry>description</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>byte 0-3</entry>
         <entry>int</entry>
         <entry>number of characters in the font</entry>
        </row>
        <row>
         <entry>byte 4-7</entry>
         <entry>int</entry>
         <entry>
          value of first character in the font (often 32 for space)
         </entry>
        </row>
        <row>
         <entry>byte 8-11</entry>
         <entry>int</entry>
         <entry>pixel width of each character</entry>
        </row>
        <row>
         <entry>byte 12-15</entry>
         <entry>int</entry>
         <entry>pixel height of each character</entry>
        </row>
        <row>
         <entry>byte 16-</entry>
         <entry>char</entry>
         <entry>
          array with character data, one byte per pixel in each
          character, for a total of (nchars*width*height) bytes.
         </entry>
        </row>
       </tbody>
      </tgroup>
     </table>
    </para>
    <para>
     See also <function>ImageFontWidth</function> and
     <function>ImageFontHeight</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagepolygon">
   <refnamediv>
    <refname>ImagePolygon</refname>
    <refpurpose>Draw a polygon</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagepolygon</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>array <parameter>points</parameter></paramdef>
      <paramdef>int <parameter>num_points</parameter></paramdef>
      <paramdef>int <parameter>col</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>ImagePolygon</function> creates a polygon in image id.
     <parameter>Points</parameter> is a PHP array containing the
     polygon's vertices, ie. points[0] = x0, points[1] = y0, points[2]
     = x1, points[3] = y1, etc.  <parameter>Num_points</parameter> is
     the total number of vertices.
    </para>
    <para> 
     See also <function>imagecreate</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagepsbbox">
   <refnamediv>
    <refname>ImagePSBBox</refname>
    <refpurpose>
     Give the bounding box of a text rectangle using PostScript Type1
     fonts
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>imagepsbbox</function></funcdef>
      <paramdef>string <parameter>text</parameter></paramdef>
      <paramdef>int <parameter>font</parameter></paramdef>
      <paramdef>int <parameter>size</parameter></paramdef>
      <paramdef>int <parameter><optional>space</optional></parameter></paramdef>
      <paramdef>int <parameter><optional>tightness</optional></parameter></paramdef>
      <paramdef>float <parameter><optional>angle</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <parameter>Size</parameter> is expressed in pixels.
    </para>
    <para>
     <parameter>Space</parameter> allows you to change the default
     value of a space in a font.  This amount is added to the normal
     value and can also be negative.
    </para>
    <para>
     <parameter>Tightness</parameter> allows you to control the amount
     of white space between characters. This amount is added to the
     normal character width and can also be negative.
    </para>
    <para>
     <parameter>Angle</parameter> is in degrees.
    </para>
    <para>
     Parameters <parameter>space</parameter> and
     <parameter>tightness</parameter> are expressed in character space
     units, where 1 unit is 1/1000th of an em-square.
    </para>
    <para>
     Parameters <parameter>space</parameter>,
     <parameter>tightness</parameter>, and <parameter>angle</parameter>
     are optional.
    </para>
    <para>
     The bounding box is calculated using information available from
     character metrics, and unfortunately tends to differ slightly
     from the results achieved by actually rasterizing the text. If
     the angle is 0 degrees, you can expect the text to need 1 pixel
     more to every direction.
    </para>
    <para>
     This function returns an array containing the following elements:
     <informaltable>
      <tgroup cols="2">
       <tbody>
        <row>
         <entry>0</entry>
         <entry>lower left x-coordinate</entry>
        </row>
        <row>
         <entry>1</entry>
         <entry>lower left y-coordinate</entry>
        </row>
        <row>
         <entry>2</entry>
         <entry>upper right x-coordinate</entry>
        </row>
        <row>
         <entry>3</entry>
         <entry>upper right y-coordinate</entry>
        </row>
       </tbody>
      </tgroup>
     </informaltable>
    </para>
    <para>
     See also <function>imagepstext</function>.
    </para>
   </refsect1>
  </refentry>

<!-- The function in t1lib which this function uses seems to be buggy...
Currently, just comment out everywhere in the docs and source until time
permits to find a solution.

  <refentry id="function.imagepscopyfont">
   <refnamediv>
    <refname>ImagePSCopyFont</refname>
    <refpurpose>
     Make a copy of an already loaded font for further modification
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagepscopyfont</function></funcdef>
      <paramdef>int <parameter>fontindex</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Use this function if you need make further modifications to the
     font, for example extending/condensing, slanting it or changing
     it's character encoding vector, but need to keep the original
     along as well. Note that the font you want to copy must be one
     obtained using <function>ImagePSLoadFont</function>, not a font
     that is itself a copied one. You can although make modifications
     to it before copying.
    </para>
    <para>
     If you use this function, you <emphasis>must</emphasis> free the
     fonts obtained this way yourself and in reverse order. Otherwise
     your script <emphasis>will</emphasis> hang.
    </para>
    <para>
     In the case everything went right, a valid font index will be
     returned and can be used for further purposes. Otherwise the
     function returns false and prints a message describing what went
     wrong.
    </para>
    <para>
     See also <function>ImagePSLoadFont</function>.
    </para>
   </refsect1>
  </refentry>
-->

  <refentry id="function.imagepsencodefont">
   <refnamediv>
    <refname>ImagePSEncodeFont</refname>
    <refpurpose>
     Change the character encoding vector of a font
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagepsencodefont</function></funcdef>
      <paramdef>int <parameter>font_index</parameter></paramdef>
      <paramdef>string <parameter>encodingfile</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Loads a character encoding vector from from a file and changes
     the fonts encoding vector to it. As a PostScript fonts default
     vector lacks most of the character positions above 127, you'll
     definitely want to change this if you use an other language than
     english. The exact format of this file is described in T1libs
     documentation. T1lib comes with two ready-to-use files,
     IsoLatin1.enc and IsoLatin2.enc.
    </para>
    <para>
     If you find yourself using this function all the time, a much
     better way to define the encoding is to set ps.default_encoding in
     the <link linkend="configuration.file">configuration file</link>
     to point to the right encoding file and all fonts you load will
     automatically have the right encoding.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagepsfreefont">
   <refnamediv>
    <refname>ImagePSFreeFont</refname>
    <refpurpose>Free memory used by a PostScript Type 1 font</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>imagepsfreefont</function></funcdef>
      <paramdef>int <parameter>fontindex</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     See also <function>ImagePSLoadFont</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagepsloadfont">
   <refnamediv>
    <refname>ImagePSLoadFont</refname>
    <refpurpose>Load a PostScript Type 1 font from file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagepsloadfont</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     In the case everything went right, a valid font index will be
     returned and can be used for further purposes. Otherwise the
     function returns false and prints a message describing what went
     wrong.
    </para>
    <para>
     See also <function>ImagePSFreeFont</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagepsextendfont">
   <refnamediv>
    <refname>ImagePsExtendFont</refname>
    <refpurpose>
     Extend or condense a font
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool
       <function>imagepsextendfont</function>
      </funcdef>
      <paramdef>int 
       <parameter>font_index</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>extend</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Extend or condense a font (<parameter>font_index</parameter>), if
     the value of the <parameter>extend</parameter> parameter is less
     than one you will be condensing the font.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.imagepsslantfont">
   <refnamediv>
    <refname>ImagePsSlantFont</refname>
    <refpurpose>
     Slant a font
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool 
       <function>imagepsslantfont</function>
      </funcdef>
      <paramdef>int 
       <parameter>font_index</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>slant</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Slant a font given by the <parameter>font_index</parameter>
     parameter with a slant of the value of the
     <parameter>slant</parameter> parameter.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagepstext">
   <refnamediv>
    <refname>ImagePSText</refname>
    <refpurpose>
     To draw a text string over an image using PostScript Type1 fonts
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>imagepstext</function></funcdef>
      <paramdef>int <parameter>image</parameter></paramdef>
      <paramdef>string <parameter>text</parameter></paramdef>
      <paramdef>int <parameter>font</parameter></paramdef>
      <paramdef>int <parameter>size</parameter></paramdef>
      <paramdef>int <parameter>foreground</parameter></paramdef>
      <paramdef>int <parameter>background</parameter></paramdef>
      <paramdef>int <parameter>x</parameter></paramdef>
      <paramdef>int <parameter>y</parameter></paramdef>
      <paramdef>int 
       <parameter>
        <optional>space</optional>
       </parameter>
      </paramdef>
      <paramdef>int 
       <parameter>
        <optional>tightness</optional>
       </parameter>
      </paramdef>
      <paramdef>float 
       <parameter>
        <optional>angle</optional>
       </parameter>
      </paramdef>
      <paramdef>int 
       <parameter>
        <optional>antialias_steps</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <parameter>Size</parameter> is expressed in pixels.
    </para>
    <para>
     <parameter>Foreground</parameter> is the color in which the text
     will be painted.  <parameter>Background</parameter> is the color
     to which the text will try to fade in with antialiasing. No
     pixels with the color <parameter>background</parameter> are
     actually painted, so the background image does not need to be of
     solid color.
    </para>
    <para>
     The coordinates given by <parameter>x</parameter>,
     <parameter>y</parameter> will define the origin (or reference
     point) of the first character (roughly the lower-left corner of
     the character).  This is different from the
     <function>ImageString</function>, where <parameter>x</parameter>,
     <parameter>y</parameter> define the upper-right corner of the
     first character. Refer to PostScipt documentation about fonts and
     their measuring system if you have trouble understanding how this
     works.
    </para>
    <para>
     <parameter>Space</parameter> allows you to change the default
     value of a space in a font.  This amount is added to the normal
     value and can also be negative.
    </para>
    <para>
     <parameter>Tightness</parameter> allows you to control the amount
     of white space between characters. This amount is added to the
     normal character width and can also be negative.
    </para>
    <para>
     <parameter>Angle</parameter> is in degrees.
    </para>
    <para>
     <parameter>Antialias_steps</parameter> allows you to control the
     number of colours used for antialiasing text. Allowed values are
     4 and 16. The higher value is recommended for text sizes lower
     than 20, where the effect in text quality is quite visible.  With
     bigger sizes, use 4. It's less computationally intensive.
    </para>
    <para>
     Parameters <parameter>space</parameter> and
     <parameter>tightness</parameter> are expressed in character space
     units, where 1 unit is 1/1000th of an em-square.
    </para>
    <para>
     Parameters <parameter>space</parameter>,
     <parameter>tightness</parameter>, <parameter>angle</parameter>
     and <parameter>antialias</parameter> are optional.
    </para>
    <para>
     This function returns an array containing the following elements:
     <informaltable>
      <tgroup cols="2">
       <tbody>
        <row>
         <entry>0</entry>
         <entry>lower left x-coordinate</entry>
        </row>
        <row>
         <entry>1</entry>
         <entry>lower left y-coordinate</entry>
        </row>
        <row>
         <entry>2</entry>
         <entry>upper right x-coordinate</entry>
        </row>
        <row>
         <entry>3</entry>
         <entry>upper right y-coordinate</entry>
        </row>
       </tbody>
      </tgroup>
     </informaltable></para>
    <para>
     See also <function>imagepsbbox</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagerectangle">
   <refnamediv>
    <refname>ImageRectangle</refname>
    <refpurpose>Draw a rectangle</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagerectangle</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int <parameter>x1</parameter></paramdef>
      <paramdef>int <parameter>y1</parameter></paramdef>
      <paramdef>int <parameter>x2</parameter></paramdef>
      <paramdef>int <parameter>y2</parameter></paramdef>
      <paramdef>int <parameter>col</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>    
     <function>ImageRectangle</function> creates a rectangle of color
     col in image im starting at upper left coordinate x1, y1 and
     ending at bottom right coordinate x2, y2.  0, 0 is the top left
     corner of the image.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagesetpixel">
   <refnamediv>
    <refname>ImageSetPixel</refname>
    <refpurpose>Set a single pixel</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagesetpixel</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int <parameter>x</parameter></paramdef>
      <paramdef>int <parameter>y</parameter></paramdef>
      <paramdef>int <parameter>col</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>ImageSetPixel</function> draws a pixel at
     <parameter>x</parameter>, <parameter>y</parameter> (top left is
     0, 0) in image <parameter>im</parameter> of color
     <parameter>col</parameter>.
    </para> 
    <para> 
     See also <function>ImageCreate</function> and
     <function>ImageColorAllocate</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagestring">
   <refnamediv>
    <refname>ImageString</refname>
    <refpurpose>Draw a string horizontally</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagestring</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int <parameter>font</parameter></paramdef>
      <paramdef>int <parameter>x</parameter></paramdef>
      <paramdef>int <parameter>y</parameter></paramdef>
      <paramdef>string <parameter>s</parameter></paramdef>
      <paramdef>int <parameter>col</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>    
     <function>ImageString</function> draws the string
     <parameter>s</parameter> in the image identified by
     <parameter>im</parameter> at coordinates
     <parameter>x</parameter>, <parameter>y</parameter> (top left is
     0, 0) in color <parameter>col</parameter>.  If font is 1, 2, 3, 4
     or 5, a built-in font is used.  
    </para> 
    <para> 
     See also <function>ImageLoadFont</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagestringup">
   <refnamediv>
    <refname>ImageStringUp</refname>
    <refpurpose>Draw a string vertically</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagestringup</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int <parameter>font</parameter></paramdef>
      <paramdef>int <parameter>x</parameter></paramdef>
      <paramdef>int <parameter>y</parameter></paramdef>
      <paramdef>string <parameter>s</parameter></paramdef>
      <paramdef>int <parameter>col</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>    
     <function>ImageStringUp</function> draws the string
     <parameter>s</parameter> vertically in the image identified by
     <parameter>im</parameter> at coordinates
     <parameter>x</parameter>, <parameter>y</parameter> (top left is
     0, 0) in color <parameter>col</parameter>.  If font is 1, 2, 3, 4
     or 5, a built-in font is used.  
    </para> 
    <para> 
     See also <function>ImageLoadFont</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagesx">
   <refnamediv>
    <refname>ImageSX</refname>
    <refpurpose>Get image width</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagesx</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>ImageSX</function> returns the width of the image
     identified by <parameter>im</parameter>.
    </para>
    <para> 
     See also <function>ImageCreate</function> and
     <function>ImageSY</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagesy">
   <refnamediv>
    <refname>ImageSY</refname>
    <refpurpose>Get image height</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagesy</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ImageSY</function> returns the height of the image
     identified by <parameter>im</parameter>.
    </para> 
    <para>
     See also <function>ImageCreate</function> and
     <function>ImageSX</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagettfbbox">
   <refnamediv>
    <refname>ImageTTFBBox</refname>
    <refpurpose>
     Give the bounding box of a text using TypeType fonts
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>imagettfbbox</function></funcdef>
      <paramdef>int <parameter>size</parameter></paramdef>
      <paramdef>int <parameter>angle</parameter></paramdef>
      <paramdef>string <parameter>fontfile</parameter></paramdef>
      <paramdef>string <parameter>text</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function calculates and returns the bounding box in pixels
     for a TrueType text.
     <variablelist>
      <varlistentry>
       <term>
        <parameter>text</parameter>
       </term>
       <listitem>
        <simpara>The string to be measured.</simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term>
        <parameter>size</parameter>
       </term>
       <listitem>
        <simpara>The font size in pixels.</simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term>
        <parameter>fontfile</parameter>
       </term>
       <listitem>
        <simpara>
         The name of the TrueType font file.  (Can also be an URL.)
        </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term>
        <parameter>angle</parameter>
       </term>
       <listitem>
        <simpara>
         Angle in degrees in which <parameter>text</parameter> will be
         measured.
        </simpara>
       </listitem>
      </varlistentry>
     </variablelist>
     <function>ImageTTFBBox</function> returns an array with 8
     elements representing four points making the bounding box of the
     text:
     <informaltable>
      <tgroup cols="2">
       <tbody>
        <row>
         <entry>0</entry>
         <entry>lower left corner, X position</entry>
        </row>
        <row>
         <entry>1</entry>
         <entry>lower left corner, Y position</entry>
        </row>
        <row>
         <entry>2</entry>
         <entry>lower right corner, X position</entry>
        </row>
        <row>
         <entry>3</entry>
         <entry>lower right corner, Y position</entry>
        </row>
        <row>
         <entry>4</entry>
         <entry>upper right corner, X position</entry>
        </row>
        <row>
         <entry>5</entry>
         <entry>upper right corner, Y position</entry>
        </row>
        <row>
         <entry>6</entry>
         <entry>upper left corner, X position</entry>
        </row>
        <row>
         <entry>7</entry>
         <entry>upper left corner, Y position</entry>
        </row>
       </tbody>
      </tgroup>
     </informaltable>
     The points are relative to the <emphasis>text</emphasis>
     regardless of the angle, so "upper left" means in the top
     left-hand corner seeing the text horizontallty.
    </para>
    <para>
     This function requires both the GD library and the FreeType
     library.
    </para>
    <para>
     See also <function>ImageTTFText</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagettftext">
   <refnamediv>
    <refname>ImageTTFText</refname>
    <refpurpose>
     Write text to the image using TrueType fonts
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>imagettftext</function></funcdef>
      <paramdef>int <parameter>im</parameter></paramdef>
      <paramdef>int <parameter>size</parameter></paramdef>
      <paramdef>int <parameter>angle</parameter></paramdef>
      <paramdef>int <parameter>x</parameter></paramdef>
      <paramdef>int <parameter>y</parameter></paramdef>
      <paramdef>int <parameter>col</parameter></paramdef>
      <paramdef>string <parameter>fontfile</parameter></paramdef>
      <paramdef>string <parameter>text</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ImageTTFText</function> draws the string
     <parameter>text</parameter> in the image identified by
     <parameter>im</parameter>, starting at coordinates
     <parameter>x</parameter>, <parameter>y</parameter> (top left is
     0, 0), at an angle of <parameter>angle</parameter> in color
     <parameter>col</parameter>, using the TrueType font file
     identified by <parameter>fontfile</parameter>.
    </para>
    <para>
     The coordinates given by <parameter>x</parameter>,
     <parameter>y</parameter> will define the basepoint of the first
     character (roughly the lower-left corner of the character).  This
     is different from the <function>ImageString</function>, where x,
     y define the upper-right corner of the first character.
    </para>
    <para>
     <parameter>Angle</parameter> is in degrees, with 0 degrees being
     left-to-right reading text (3 o'clock direction), and higher
     values representing a counter-clockwise rotation.  (i.e., a value
     of 90 would result in bottom-to-top reading text).
    </para>
    <para>
     <parameter>Fontfile</parameter> is the path to the TrueType font
     you wish to use.
    </para>
    <para>
     <parameter>Text</parameter> is the text string which may include
     UTF-8 character sequences (of the form: &amp;#123;) to access
     characters in a font beyond the first 255.
    </para>
    <para>
     <parameter>Col</parameter> is the color index.  Using the
     negative of a color index has the effect of turning off
     antialiasing.
    </para>
    <para>
     <function>ImageTTFText</function> returns an array with 8
     elements representing four points making the bounding box of the
     text.  The order of the points is upper left, upper right, lower
     right, lower left.  The points are relative to the text
     regardless of the angle, so "upper left" means in the top
     left-hand corner when you see the text horizontallty.
    </para>
    <para>
     This example script will produce a black GIF 400x30 pixels, with
     the words "Testing..."  in white in the font Arial.
     <example>
      <title>ImageTTFText</title>
      <programlisting role="php">
&lt;?php
Header ("Content-type: image/gif");
$im = imagecreate (400, 30);
$black = ImageColorAllocate ($im, 0, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);
ImageTTFText ($im, 20, 0, 10, 20, $white, "/path/arial.ttf", 
              "Testing... Omega: &amp;#937;");
ImageGif ($im);
ImageDestroy ($im);
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     This function requires both the GD library and the <ulink
     url="&url.freetype;">FreeType</ulink> library.
    </para>
    <para>
     See also <function>ImageTTFBBox</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imagetypes">
   <refnamediv>
    <refname>ImageTypes</refname>
    <refpurpose>
     Return the image types supported by this PHP build
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imagetypes</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns a bit-field corresponding to the image
     formats supported by the version of GD linked into PHP.  The
     following bits are returned, IMG_GIF | IMG_JPG | IMG_PNG |
     IMG_WBMP.  To check for PNG support, for example, do this:
     <example>
      <title>ImageTypes</title>
      <programlisting role="php">
&lt;?php
if (ImageTypes() &amp; IMG_PNG) {
    echo "PNG Support is enabled";
}
?&gt;
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.read-exif-data">
   <refnamediv>
    <refname>read_exif_data</refname>
    <refpurpose>Read the EXIF headers from a JPEG</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>read_exif_data</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>read_exif_data</function> function reads the
         EXIF headers from a JPEG image file.  It returns an associative
         array where the indexes are the Exif header names and the values
         are the values associated with those Exif headers.  Exif headers
         tend to be present in JPEG images generated by digital cameras, but
         unfortunately each digital camera maker has a different idea of how
         to actually tag their images, so you can't always rely on a specific
         Exif header being present.
     <example>
      <title>read_exif_data</title>
      <programlisting role="php">
&lt;?php
 $exif = read_exif_data ('p0001807.jpg');
 while(list($k,$v)=each($exif)) {
   echo "$k: $v&lt;br>\n";
 }
?>

Output:
FileName: p0001807.jpg
FileDateTime: 929353056
FileSize: 378599
CameraMake: Eastman Kodak Company
CameraModel: KODAK DC265 ZOOM DIGITAL CAMERA (V01.00)
DateTime: 1999:06:14 01:37:36
Height: 1024
Width: 1536
IsColor: 1
FlashUsed: 0
FocalLength:  8.0mm
RawFocalLength: 8
ExposureTime:  0.004 s (1/250)
RawExposureTime: 0.0040000001899898
ApertureFNumber: f/ 9.5
RawApertureFNumber: 9.5100002288818
FocusDistance: 16.66m
RawFocusDistance: 16.659999847412
Orientation: 1
ExifVersion: 0200
      </programlisting>
     </example>
    </para>
    <para>
     <note>
      <simpara>
       This function is only available in PHP 4 compiled using --enable-exif
      </simpara>
      <simpara>
       This function does not require the GD image library.
      </simpara>
     </note>
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/imap.xml
+++ phpdoc/kr/functions/imap.xml
 <reference id="ref.imap">
  <title>IMAP, POP3 and NNTP functions</title>
  <titleabbrev>IMAP</titleabbrev>

  <partintro>
   <simpara>
    To get these functions to work, you have to compile PHP with
    <option role="configure">--with-imap</option>. That requires the
    c-client library to be installed. Grab the latest version from
    <ulink url="&url.imap;">&url.imap;</ulink> and compile it. Then
    copy <filename>c-client/c-client.a</filename> to
    <filename>/usr/local/lib/libc-client.a</filename> or some other 
    directory on your link path and copy 
    <filename>c-client/rfc822.h</filename>,
    <filename>mail.h</filename> and <filename>linkage.h</filename> to
    <filename>/usr/local/include</filename> or some other directory in
    your include path.
   </simpara>
   <simpara>
    Note that these functions are not limited to the
    <acronym>IMAP</acronym> protocol, despite their name.  The
    underlying c-client library also supports <acronym>NNTP</acronym>,
    <acronym>POP3</acronym> and local mailbox access methods. 
   </simpara>
   <para>
    This document can't go into detail on all the topics touched by
                the provided functions. Further information is provided by the
                documentation of the c-client library source
                (<filename>docs/internal.txt</filename>). and the following RFC
                documents:
    <itemizedlist>
     <listitem>
      <simpara>
       <ulink url="&url.rfc;rfc821.html">RFC821</ulink>: Simple Mail
                         Transfer Protocol (SMTP).
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       <ulink url="&url.rfc;rfc822.html">RFC822</ulink>: Standard for
                         ARPA internet text messages.
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       <ulink url="&url.rfc;rfc2060.html">RFC2060</ulink>: Internet
                         Message Access Protocol (IMAP) Version 4rev1. 
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       <ulink url="&url.rfc;rfc1939.html">RFC1939</ulink>:  Post
                         Office Protocol Version 3 (POP3).
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       <ulink url="&url.rfc;rfc977.html">RFC977</ulink>: Network News
                         Transfer Protocol (NNTP).
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       <ulink url="&url.rfc;rfc2076.html">RFC2076</ulink>: Common
                         Internet Message Headers.
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       <ulink url="&url.rfc;rfc2045.html">RFC2045</ulink> , <ulink
                                url="&url.rfc;rfc2046.html">RFC2046</ulink> , <ulink
                                url="&url.rfc;rfc2047.html">RFC2047</ulink> , <ulink
                                url="&url.rfc;rfc2048.html">RFC2048</ulink> &amp; 
<ulink
                                url="&url.rfc;rfc2049.html">RFC2049</ulink>: 
Multipurpose
                         Internet Mail Extensions (MIME).
      </simpara>
     </listitem>
    </itemizedlist> 
                A detailed overview is also available in the books
                <ulink url="&url.email.book;">Programming Internet Email</ulink>
                by David Wood and  <ulink url="&url.imap.book;">Managing
                 IMAP</ulink> by Dianna Mullet & Kevin Mullet.
   </para>
  </partintro>

  <refentry id="function.imap-append">
   <refnamediv>
    <refname>imap_append</refname> 
    <refpurpose>
     Append a string message to a specified mailbox
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imap_append</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>string <parameter>mbox</parameter></paramdef>
      <paramdef>string <parameter>message</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>flags</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on sucess, false on error.
    </para>  
    <para>
     <function>imap_append</function> appends a string message to the
     specified mailbox <parameter>mbox</parameter>. If the optional
     <parameter>flags</parameter> is specified, writes the
     <parameter>flags</parameter> to that mailbox also.
    </para>
    <para>
     When talking to the Cyrus IMAP server, you must use "\r\n" as
     your end-of-line terminator instead of "\n" or the operation will
     fail.
    </para>
    <para>     
     <example>
      <title><function>imap_append</function> example</title>
      <programlisting role="php">
$stream = imap_open("{your.imap.host}INBOX.Drafts","username", "password");

$check = imap_check($stream);
print "Msg Count before append: ". $check->Nmsgs."\n";

imap_append($stream,"{your.imap.host}INBOX.Drafts"
                   ,"From: [EMAIL PROTECTED]\r\n"
                   ."To: [EMAIL PROTECTED]\r\n"
                   ."Subject: test\r\n"
                   ."\r\n"
                   ."this is a test message, please ignore\r\n"
                   );

$check = imap_check($stream);
print "Msg Count after append : ". $check->Nmsgs."\n";

imap_close($stream);
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-base64">
   <refnamediv>
    <refname>imap_base64</refname>
    <refpurpose>Decode BASE64 encoded text</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>imap_base64</function></funcdef>
      <paramdef>string <parameter>text</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>imap_base64</function> function decodes BASE-64 encoded
     text (see <ulink url="&url.rfc;rfc2045.html">RFC2045</ulink>, 
     Section 6.8). The decoded message is returned as a string.
    </para>
    <para>
     See also <function>imap_binary</function>.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.imap-body">
   <refnamediv>
    <refname>imap_body</refname>
    <refpurpose>Read the message body</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>imap_body</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>int <parameter>msg_number</parameter></paramdef>
      <paramdef>int <parameter><optional>flags</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>imap_body</function> returns the body of the message,
     numbered <parameter> msg_number</parameter> in the current
     mailbox. The optional <parameter>flags</parameter> are a bit mask
     with one or more of the following:
     <itemizedlist>
      <listitem>
       <simpara>
        FT_UID - The <parameter>msgno</parameter> is a UID
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        FT_PEEK - Do not set the \Seen flag if not already set
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        FT_INTERNAL - The return string is in internal format, will
        not canonicalize to CRLF.
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
          <para>
     <function>imap_body</function> will only return a verbatim copy of the 
     message body. To extract single parts of a multipart MIME-encoded 
     message you have to use <function>imap_fetchstructure</function> to
     analyze its structure and <function>imap_fetchbody</function> to
                 extract a copy of a single body component.     
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-check">
   <refnamediv>
    <refname>imap_check</refname>
    <refpurpose>Check current mailbox</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>object <function>imap_check</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns information about the current mailbox. Returns FALSE on
     failure.
    </para>  
    <para> 
     The <function>imap_check</function> function checks the current
     mailbox status on the server and returns the information in an
     object with following properties:
    </para>
    <para>
     <itemizedlist>
      <listitem>
       <simpara>
        Date - last change of mailbox contents
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        Driver - protocol used to access this mailbox: POP3, IMAP, NNTP
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        Mailbox - the mailbox name
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        Nmsgs - number of messages in the mailbox
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        Recent - number of recent messages in the mailbox
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-close">
   <refnamediv>
    <refname>imap_close</refname>
    <refpurpose>Close an IMAP stream</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imap_close</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>flags</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Close the imap stream. Takes an optional
     <parameter>flag</parameter> CL_EXPUNGE, which will silently
     expunge the mailbox before closing, removing all messages marked for
     deletion.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-createmailbox">
   <refnamediv>
    <refname>imap_createmailbox</refname>
    <refpurpose>Create a new mailbox</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imap_createmailbox</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>string <parameter>mbox</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>imap_createmailbox</function> creates a new mailbox
     specified by <parameter>mbox</parameter>. Names containing 
     international characters should be encoded by 
<function>imap_utf7_encode</function>
    </para> 
    <para>
     Returns true on success and false on error.
    </para>
    <para>
     See also <function>imap_renamemailbox</function>,
     <function>imap_deletemailbox</function> and
     <function>imap_open</function> for the format 
     of <parameter>mbox</parameter> names. 
    </para>
    <para>     
     <example>
      <title><function>imap_createmailbox</function> example</title>
      <programlisting>
$mbox = imap_open("{your.imap.host}","username","password",OP_HALFOPEN)
     || die("can't connect: ".imap_last_error());

$name1 = "phpnewbox";
$name2 = imap_utf7_encode("phpnewb&ouml;x");

$newname = $name1;

echo "Newname will be '$name1'&lt;br>\n";

# we will now create a new mailbox "phptestbox" in your inbox folder,
# check its status after creation and finaly remove it to restore
# your inbox to its initial state 
if(@imap_createmailbox($mbox,imap_utf7_encode("{your.imap.host}INBOX.$newname"))) {
  $status = @imap_status($mbox,"{your.imap.host}INBOX.$newname",SA_ALL);
  if($status) {
    print("your new mailbox '$name1' has the following status:&lt;br>\n");
    print("Messages:   ". $status->messages   )."&lt;br>\n";
    print("Recent:     ". $status->recent     )."&lt;br>\n";
    print("Unseen:     ". $status->unseen     )."&lt;br>\n";
    print("UIDnext:    ". $status->uidnext    )."&lt;br>\n";
    print("UIDvalidity:". $status->uidvalidity)."&lt;br>\n";
    
    
if(imap_renamemailbox($mbox,"{your.imap.host}INBOX.$newname","{your.imap.host}INBOX.$name2"))
 {
      echo "renamed new mailbox from '$name1' to '$name2'&lt;br>\n";
      $newname=$name2;
    } else {
      print "imap_renamemailbox on new mailbox failed: ".imap_last_error()."&lt;br>\n";
    }
  } else {
    print  "imap_status on new mailbox failed: ".imap_last_error()."&lt;br>\n";
  }
  if(@imap_deletemailbox($mbox,"{your.imap.host}INBOX.$newname")) {
    print "new mailbox removed to restore initial state&lt;br>\n";
  } else {
    print  "imap_deletemailbox on new mailbox failed: 
".implode("&lt;br>\n",imap_errors())."&lt;br>\n";
  }
  
} else {
  print  "could not create new mailbox: 
".implode("&lt;br>\n",imap_errors())."&lt;br>\n";
}

imap_close($mbox);
      </programlisting>
     </example>
    </para>     
   </refsect1>
  </refentry>

  <refentry id="function.imap-delete">
   <refnamediv>
    <refname>imap_delete</refname>
    <refpurpose>
     Mark a messge for deletion from current mailbox
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imap_delete</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>int <parameter>msg_number</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>flags</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true.
    </para> 
    <para> 
     <function>imap_delete</function> function marks message pointed
     by <parameter>msg_number</parameter> for deletion.  The optional
     <parameter>flags</parameter> parameter only has a single option,
     <parameter>FT_UID</parameter>, which tells the function to treat
     the <parameter>msg_number</parameter> argument as a
     <parameter>UID</parameter>.  Messages marked for deletion will
     stay in the mailbox until either
     <function>imap_expunge</function> is called or
     <function>imap_close</function> is called with the optional
     parameter CL_EXPUNGE.
    </para>
    <para>     
     <example>
      <title><function>Imap_delete</function> Beispiel</title>
      <programlisting role="php">
$mbox = imap_open ("{your.imap.host}INBOX", "username", "password")
    || die ("can't connect: " . imap_last_error());

$check = imap_mailboxmsginfo ($mbox);
print "Messages before delete: " . $check->Nmsgs . "&lt;br>\n" ;
imap_delete ($mbox, 1);
$check = imap_mailboxmsginfo ($mbox);
print "Messages after  delete: " . $check->Nmsgs . "&lt;br>\n" ;
imap_expunge ($mbox);
$check = imap_mailboxmsginfo ($mbox);
print "Messages after expunge: " . $check->Nmsgs . "&lt;br>\n" ;
imap_close ($mbox);
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-deletemailbox">
   <refnamediv>
    <refname>imap_deletemailbox</refname>
    <refpurpose>Delete a mailbox</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imap_deletemailbox</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>string <parameter>mbox</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>imap_deletemailbox</function> deletes the specified
     mailbox (see <function>imap_open</function> for the format 
     of <parameter>mbox</parameter> names).
    </para>  
    <para>
     Returns true on success and false on error.
    </para>
    <para>
     See also <function>imap_createmailbox</function>, 
     <function>imap_renamemailbox</function>, and 
     <function>imap_open</function> for the format of
     <parameter>mbox</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-expunge">
   <refnamediv>
    <refname>imap_expunge</refname>
    <refpurpose>Delete all messages marked for deletion</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imap_expunge</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>imap_expunge</function> deletes all the messages marked
     for deletion by <function>imap_delete</function>, 
     <function>imap_mail_move</function>, or 
     <function>imap_setflag_full</function>.
    </para>
    <para>
     Returns true.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-fetchbody">
   <refnamediv>
    <refname>imap_fetchbody</refname>
    <refpurpose>
     Fetch a particular section of the body of the message
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>imap_fetchbody</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>int <parameter>msg_number</parameter></paramdef>
      <paramdef>string <parameter>part_number</parameter></paramdef>
      <paramdef>flags 
       <parameter><optional>flags</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function causes a fetch of a particular section of the body
     of the specified messages as a text string and returns that text
     string. The section specification is a string of integers
     delimited by period which index into a body part list as per the
     IMAP4 specification. Body parts are not decoded by this function.
    </para>
    <para>
     The options for <function>imap_fetchbody</function> is a bitmask
     with one or more of the following:
     <itemizedlist>
      <listitem>
       <simpara>
        FT_UID - The <parameter>msg_number</parameter> is a UID
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        FT_PEEK - Do not set the \Seen flag if not already set
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        FT_INTERNAL - The return string is in "internal" format,
        without any attempt to canonicalize CRLF.
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-fetchstructure">
   <refnamediv>
    <refname>imap_fetchstructure</refname> 
    <refpurpose>
     Read the structure of a particular message
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>object
       <function>imap_fetchstructure</function>
      </funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>int <parameter>msg_number</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>flags</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function fetches all the structured information for a given
     message. The optional <parameter>flags</parameter> parameter only
     has a single option, <parameter>FT_UID</parameter>, which tells
     the function to treat the <parameter>msg_number</parameter>
     argument as a <parameter>UID</parameter>. The returned object
     includes the envelope, internal date, size, flags and body
     structure along with a similar object for each mime
     attachement. The structure of the returned objects is as follows:
    </para>
    <para>
     <table>
      <title>
       Returned Objects for <function>imap_fetchstructure</function>
      </title>
      <tgroup cols="2">
       <tbody>
        <row>
         <entry>type</entry>
         <entry>Primary body type</entry>
        </row>
        <row>
         <entry>encoding</entry>
         <entry>Body transfer encoding</entry>
        </row>
        <row>
         <entry>ifsubtype</entry>
         <entry>True if there is a subtype string</entry>
        </row>
        <row>
         <entry>subtype</entry>
         <entry><acronym>MIME</acronym> subtype</entry>
        </row>
        <row>
         <entry>ifdescription</entry>
         <entry>True if there is a description string</entry>
        </row>
        <row>
         <entry>description</entry>
         <entry>Content description string</entry>
        </row>
        <row>
         <entry>ifid</entry>
         <entry>True if there is an identification string</entry>
        </row>
        <row>
         <entry>id</entry>
         <entry>Identification string</entry>
        </row>
        <row>
         <entry>lines</entry>
         <entry>Number of lines</entry>
        </row>
        <row>
         <entry>bytes</entry>
         <entry>Number of bytes</entry>
        </row>
        <row>
         <entry>ifdisposition</entry>
         <entry>True if there is a disposition string</entry>
        </row>
        <row>
         <entry>disposition</entry>
         <entry>Disposition string</entry>
        </row>
        <row>
         <entry>ifdparameters</entry>
         <entry>True if the dparameters array exists</entry>
        </row>
        <row>
         <entry>dparameters</entry>
         <entry>Disposition parameter array</entry>
        </row>
        <row>
         <entry>ifparameters</entry>
         <entry>True if the parameters array exists</entry>
        </row>
        <row>
         <entry>parameters</entry>
         <entry><acronym>MIME</acronym> parameters array</entry>
        </row>
        <row>
         <entry>parts</entry>
         <entry>Array of objects describing each message part</entry>
        </row>
       </tbody>
      </tgroup>
     </table>
    </para>
    <note>
     <orderedlist>
      <listitem>
       <para>
        dparameters is an array of objects where each object has an
        "attribute" and a "value" property.
       </para>
      </listitem>
      <listitem>
       <para>
        Parameter is an array of objects where each object has an
        "attributte" and a "value" property.
       </para>
      </listitem>
      <listitem>
       <para>
        Parts is an array of objects identical in structure to the
        top-level object, with the limitation that it cannot contain
        further 'parts' objects.
       </para>
      </listitem>
     </orderedlist>
    </note>
    <para>
     <table>
       <title>Primary body type</title>
       <tgroup cols="2">
        <tbody>
        <row><entry>0</entry><entry>text</entry></row>
        <row><entry>1</entry><entry>multipart</entry></row>
        <row><entry>2</entry><entry>message</entry></row>
        <row><entry>3</entry><entry>application</entry></row>
        <row><entry>4</entry><entry>audio</entry></row>
        <row><entry>5</entry><entry>image</entry></row>
        <row><entry>6</entry><entry>video</entry></row>
        <row><entry>7</entry><entry>other</entry></row>
        </tbody>
       </tgroup>
     </table>
    </para>
    <para>
     <table>
       <title>Transfer encodings</title>
       <tgroup cols="2">
        <tbody>
        <row><entry>0</entry><entry>7BIT</entry></row>
        <row><entry>1</entry><entry>8BIT</entry></row>
        <row><entry>2</entry><entry>BINARY</entry></row>
        <row><entry>3</entry><entry>BASE64</entry></row>
        <row><entry>4</entry><entry>QUOTED-PRINTABLE</entry></row>
        <row><entry>5</entry><entry>OTHER</entry></row>
       </tbody>
      </tgroup>
     </table>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-headerinfo">
   <refnamediv>
    <refname>imap_headerinfo</refname>
    <refpurpose>Read the header of the message</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>object <function>imap_headerinfo</function></funcdef>
     <paramdef>int <parameter>imap_stream</parameter></paramdef>
     <paramdef>int <parameter>msg_number</parameter></paramdef>
     <paramdef>int 
      <parameter><optional>fromlength</optional></parameter>
     </paramdef>
     <paramdef>int 
      <parameter><optional>subjectlength</optional></parameter>
     </paramdef>
     <paramdef>string 
      <parameter><optional>defaulthost</optional></parameter>
     </paramdef>
    </funcsynopsis>
    <para>
     This function returns an object of various header elements.
    </para>
    <para>  
     <informalexample>
      <literallayout>
       remail, date, Date, subject, Subject, in_reply_to, message_id,
       newsgroups, followup_to, references

message flags:
   Recent -  'R' if recent and seen, 
             'N' if recent and not seen, 
             ' ' if not recent
   Unseen -  'U' if not seen AND not recent, 
             ' ' if seen OR not seen and recent
   Answered -'A' if answered, 
             ' ' if unanswered
   Deleted - 'D' if deleted, 
             ' ' if not deleted
   Draft -   'X' if draft, 
             ' ' if not draft
   Flagged - 'F' if flagged, 
             ' ' if not flagged

NOTE that the Recent/Unseen behavior is a little odd. If you want to
know if a message is Unseen, you must check for

Unseen == 'U' || Recent == 'N'

toaddress (full to: line, up to 1024 characters)

to[] (returns an array of objects from the To line, containing):
   personal
   adl
   mailbox
   host

fromaddress (full from: line, up to 1024 characters)

from[] (returns an array of objects from the From line, containing):
   personal
   adl
   mailbox
   host

ccaddress (full cc: line, up to 1024 characters)
cc[] (returns an array of objects from the Cc line, containing):
   personal
   adl
   mailbox
   host

bccaddress (full bcc line, up to 1024 characters)
bcc[] (returns an array of objects from the Bcc line, containing):
   personal
   adl
   mailbox
   host

reply_toaddress (full reply_to: line, up to 1024 characters)
reply_to[] (returns an array of objects from the Reply_to line,
containing):
   personal
   adl
   mailbox
   host

senderaddress (full sender: line, up to 1024 characters)
sender[] (returns an array of objects from the sender line, containing):
   personal
   adl
   mailbox
   host

return_path (full return-path: line, up to 1024 characters)
return_path[] (returns an array of objects from the return_path line,
containing):
   personal
   adl
   mailbox
   host

udate (mail message date in unix time)

fetchfrom (from line formatted to fit <parameter>fromlength</parameter> 
characters)

fetchsubject (subject line formatted to fit <parameter>subjectlength</parameter> 
characters)
      </literallayout>
     </informalexample>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-header">
   <refnamediv>
    <refname>imap_header</refname>
    <refpurpose>Read the header of the message</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>object <function>imap_header</function></funcdef>
     <paramdef>int <parameter>imap_stream</parameter></paramdef>
     <paramdef>int <parameter>msg_number</parameter></paramdef>
     <paramdef>int 
      <parameter><optional>fromlength</optional></parameter>
     </paramdef>
     <paramdef>int 
      <parameter><optional>subjectlength</optional></parameter>
     </paramdef>
     <paramdef>string 
      <parameter><optional>defaulthost</optional></parameter>
     </paramdef>
    </funcsynopsis>
    <para>
     This is an alias to <function>imap_headerinfo</function>
     and is identical to this in any way.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-rfc822-parse-headers">
   <refnamediv>
    <refname>imap_rfc822_parse_headers</refname>
    <refpurpose>Parse mail headers from a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>object <function>imap_rfc822_parse_headers</function></funcdef>
      <paramdef>string <parameter>headers</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>defaulthost</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns an object of various header elements,
     similar to <function>imap_header</function>, except without the
     flags and other elements that come from the IMAP server.
    </para>
   </refsect1>
  </refentry>

<refentry id="function.imap-headers">
   <refnamediv>
    <refname>imap_headers</refname>
    <refpurpose>
     Returns headers for all messages in a mailbox
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>imap_headers</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of string formatted with header info. One
     element per mail message.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-listmailbox">
   <refnamediv>
    <refname>imap_listmailbox</refname>
    <refpurpose>Read the list of mailboxes</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>imap_listmailbox</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>string <parameter>ref</parameter></paramdef>
      <paramdef>string <parameter>pattern</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array containing the names of the mailboxes.
     See <function>imap_getmailboxes</function> for a description
     of <parameter>ref</parameter> and <parameter>pattern</parameter>.
    </para>
    <para>
     <example>
      <title><function>imap_listmailbox</function> example</title>
      <programlisting role="php">
$mbox = imap_open("{your.imap.host}","username","password",OP_HALFOPEN)
      || die("can't connect: ".imap_last_error());
 
$list = imap_listmailbox($mbox,"{your.imap.host}","*");
if(is_array($list)) {
  reset($list);
  while (list($key, $val) = each($list))
    print imap_utf7_decode($val)."&lt;br>\n";
} else
  print "imap_listmailbox failed: ".imap_last_error()."\n";
 
imap_close($mbox);                                                                
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-getmailboxes">
   <refnamediv>
    <refname>imap_getmailboxes</refname>
    <refpurpose>
     Read the list of mailboxes, returning detailed information on
     each one
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>imap_getmailboxes</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>string <parameter>ref</parameter></paramdef>
      <paramdef>string <parameter>pattern</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of objects containing mailbox information. Each
     object has the attributes <parameter>name</parameter>, specifying
     the full name of the mailbox; <parameter>delimiter</parameter>,
     which is the hierarchy delimiter for the part of the hierarchy
     this mailbox is in; and
     <parameter>attributes</parameter>. <parameter>Attributes</parameter>
     is a bitmask that can be tested against:
     <itemizedlist>
      <listitem>
       <simpara>
        LATT_NOINFERIORS - This mailbox has no "children" (there are
        no mailboxes below this one).
       </simpara>
      </listitem>
     <listitem>
       <simpara>
        LATT_NOSELECT - This is only a container, not a mailbox - you
        cannot open it.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        LATT_MARKED - This mailbox is marked. Only used by UW-IMAPD.
       </simpara>
      </listitem> 
      <listitem>
       <simpara> 
        LATT_UNMARKED - This mailbox is not marked. Only used by
        UW-IMAPD.
       </simpara>
      </listitem> 
     </itemizedlist>
    </para>
    <para>
     Mailbox names containing international Characters outside the
     printable ASCII range will be encoded and may be decoded by
     <function>imap_utf7_decode</function>.
    </para>
    <para>
     <parameter>ref</parameter> should normally be just the server
     specification as described in <function>imap_open</function>, and
     <parameter>pattern</parameter> specifies where in the mailbox
     hierarchy to start searching. If you want all mailboxes, pass
     '*' for <parameter>pattern</parameter>.
    </para>
    <para>
     There are two special characters you can pass as part of the
     <parameter>pattern</parameter>: '*' and '%'. '*' means to return
     all mailboxes. If you pass <parameter>pattern</parameter> as '*',
     you will get a list of the entire mailbox hierarchy. '%' means to
     return the current level only. '%' as the
     <parameter>pattern</parameter> parameter will return only the top
     level mailboxes; '~/mail/%' on UW_IMAPD will return every mailbox
     in the ~/mail directory, but none in subfolders of that
     directory.
    </para>
    <para>
     <example>
      <title><function>imap_getmailboxes</function> example</title>
      <programlisting role="php">
$mbox = imap_open("{your.imap.host}","username","password",OP_HALFOPEN)
      || die("can't connect: ".imap_last_error());
 
$list = imap_getmailboxes($mbox,"{your.imap.host}","*");
if(is_array($list)) {
  reset($list);
  while (list($key, $val) = each($list))
  {
    print "($key) ";
    print imap_utf7_decode($val->name).",";
    print "'".$val->delimiter."',";
    print $val->attributes."&lt;br>\n";
  }
} else
  print "imap_getmailboxes failed: ".imap_last_error()."\n";
 
imap_close($mbox);                                                                
      </programlisting>
     </example>
    </para>
                <para>
                 See also <function>imap_getsubscribed</function>.
                </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-listsubscribed">
   <refnamediv>
    <refname>imap_listsubscribed</refname>
    <refpurpose>List all the subscribed mailboxes</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>imap_listsubscribed</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>string <parameter>ref</parameter></paramdef>
      <paramdef>string <parameter>pattern</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of all the mailboxes that you have
     subscribed. This is almost identical to 
     <function>imap_listmailbox</function>, but will only return
     mailboxes the user you logged in as has subscribed.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-getsubscribed">
   <refnamediv>
    <refname>imap_getsubscribed</refname>
    <refpurpose>List all the subscribed mailboxes</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>imap_getsubscribed</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>string <parameter>ref</parameter></paramdef>
      <paramdef>string <parameter>pattern</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function is identical to
     <function>imap_getmailboxes</function>, except that it only
     returns mailboxes that the user is subscribed to.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-mail-copy">
   <refnamediv>
    <refname>imap_mail_copy</refname>
    <refpurpose>Copy specified messages to a mailbox</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imap_mail_copy</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>string <parameter>msglist</parameter></paramdef>
      <paramdef>string <parameter>mbox</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>flags</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success and false on error.
    </para>  
    <para> 
     Copies mail messages specified by <parameter>msglist</parameter>
     to specified mailbox. <parameter>msglist</parameter> is a range
     not just message numbers (as described in 
     <ulink url="&url.rfc;rfc2060.html">RFC2060</ulink>).
    </para>
    <para>
     Flags is a bitmask of one or more of
     <itemizedlist>
      <listitem>
       <simpara>
        CP_UID - the sequence numbers contain UIDS
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        CP_MOVE - Delete the messages from the current mailbox after
        copying
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-mail-move">
   <refnamediv>
    <refname>imap_mail_move</refname>
    <refpurpose>Move specified messages to a mailbox</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imap_mail_move</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>string <parameter>msglist</parameter></paramdef>
      <paramdef>string <parameter>mbox</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>flags</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Moves mail messages specified by <parameter>msglist</parameter>
     to specified mailbox. <parameter>msglist</parameter> is a range
     not just message numbers (as described in 
     <ulink url="&url.rfc;rfc2060.html">RFC2060</ulink>).
    </para>
    <para>
     Flags is a bitmask and may contain the single option
     <itemizedlist>
      <listitem>
       <simpara>
        CP_UID - the sequence numbers contain UIDS
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     Returns true on success and false on error.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-num-msg">
   <refnamediv>
    <refname>imap_num_msg</refname>
    <refpurpose>
     Gives the number of messages in the current mailbox
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imap_num_msg</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Return the number of messages in the current mailbox.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-num-recent">
   <refnamediv>
    <refname>imap_num_recent</refname>
    <refpurpose>Gives the number of recent messages in current
    mailbox</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imap_num_recent</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the number of recent messages in the current mailbox.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-open">
   <refnamediv>
    <refname>imap_open</refname>
    <refpurpose>Open an IMAP stream to a mailbox</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imap_open</function></funcdef>
      <paramdef>string <parameter>mailbox</parameter></paramdef>
      <paramdef>string <parameter>username</parameter></paramdef>
      <paramdef>string <parameter>password</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>flags</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an IMAP stream on success and false on error.  This
     function can also be used to open streams to POP3 and NNTP
     servers, but some functions and features are not available
     on IMAP servers.  
    </para>
    <para>
     A mailbox name consists of a server part and a mailbox path on
     this server. The special name INBOX stands for the current users
     personal mailbox. The server part, which is enclosed in '{' and
     '}', consists of the servers name or ip address, a protocol
     secification (beginning with '/') and an optional port specifier
     beginnung with ':'. The server part is mandatory in all mailbox
     parameters. Mailbox names that contain international characters
     besides those in the printable ASCII space have to be encoded 
     with <function>imap_utf7_encode</function>.
    </para>
    <para>
     The options are a bit mask with one or more of the following:
     <itemizedlist>
      <listitem>
       <simpara>
        OP_READONLY - Open mailbox read-only
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        OP_ANONYMOUS - Dont use or update a
        <filename>.newsrc</filename> for news (NNTP only)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        OP_HALFOPEN - For IMAP and NNTP names, open a connection but
        dont open a mailbox
       </simpara>
      </listitem> 
      <listitem>
       <simpara>
        CL_EXPUNGE - Expunge mailbox automatically upon mailbox close
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     To connect to an IMAP server running on port 143 on the
     local machine, do the following:
     <informalexample>
      <programlisting role="php"> 
$mbox = imap_open ("{localhost:143}INBOX", "user_id", "password");
      </programlisting>
     </informalexample>
     To connect to a POP3 server on port 110 on the local server, use:
     <informalexample>
      <programlisting role="php">
$mbox = imap_open ("{localhost/pop3:110}INBOX", "user_id", "password");
      </programlisting>
     </informalexample>
     To connect to an NNTP server on port 119 on the local server, use:
     <informalexample>
      <programlisting role="php">
$nntp = imap_open ("{localhost/nntp:119}comp.test", "", "");
      </programlisting>
     </informalexample>
     To connect to a remote server replace "localhost" with the name
     or the IP address of the server you want to connect to.
    </para>
    <para>
     <example>
      <title><function>imap_open</function> example</title>
      <programlisting role="php">
$mbox = imap_open ("{your.imap.host:143}", "username", "password");

echo "&lt;p>&lt;h1>Mailboxes&lt;/h1>\n";
$folders = imap_listmailbox ($mbox, "{your.imap.host:143}", "*");

if ($folders == false) {
    echo "Call failed&lt;br>\n";
} else {
    while (list ($key, $val) = each ($folders)) {
        echo $val."&lt;br>\n";
    }
}

echo "&lt;p>&lt;h1>Headers in INBOX&lt;/h1>\n";
$headers = imap_headers ($mbox);

if ($headers == false) {
    echo "Call failed&lt;br>\n";
} else {
    while (list ($key,$val) = each ($headers)) {
        echo $val."&lt;br>\n";
    }
}

imap_close($mbox);
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-ping">
   <refnamediv>
    <refname>imap_ping</refname>
    <refpurpose>Check if the IMAP stream is still active</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imap_ping</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     Returns true if the stream is still alive, false otherwise.
    </para>
    <para>
     <function>imap_ping</function> function pings the stream to see
     it is still active. It may discover new mail; this is the
     preferred method for a periodic "new mail check" as well as a
     "keep alive" for servers which have inactivity timeout.
     (As PHP scripts do not tend to run that long, i can hardly
     imagine that this function will be usefull to anyone.)
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-renamemailbox">
   <refnamediv>
    <refname>imap_renamemailbox</refname>
    <refpurpose>Rename an old mailbox to new mailbox</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imap_renamemailbox</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>string <parameter>old_mbox</parameter></paramdef>
      <paramdef>string <parameter>new_mbox</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     This function renames on old mailbox to new mailbox (see
     <function>imap_open</function> for the format of
     <parameter>mbox</parameter> names).
    </para>
    <para>
     Returns true on success and false on error.
    </para>
    <para>
     See also <function>imap_createmailbox</function>,
     <function>imap_deletemailbox</function>, and
     <function>imap_open</function> for the format of
     <parameter>mbox</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-reopen">
   <refnamediv>
    <refname>imap_reopen</refname>
    <refpurpose>Reopen IMAP stream to new mailbox</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imap_reopen</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>string <parameter>mailbox</parameter></paramdef>
      <paramdef>string
       <parameter><optional>flags</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     This function reopens the specified stream to a new mailbox on
     an IMAP or NNTP server.
    </para>
    <para>
     The options are a bit mask with one or more of the following:
     <itemizedlist>
      <listitem>
       <simpara>
        OP_READONLY - Open mailbox read-only
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        OP_ANONYMOUS - Dont use or update a
        <filename>.newsrc</filename> for news (NNTP only)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        OP_HALFOPEN - For IMAP and NNTP names, open a connection but
        dont open a mailbox.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        CL_EXPUNGE - Expunge mailbox automatically upon mailbox close
        (see also <function>imap_delete</function> and
        <function>imap_expunge</function>)
       </simpara>
      </listitem>
     </itemizedlist>
    </para>  
    <para>
     Returns true on success and false on error.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-subscribe">
   <refnamediv>
    <refname>imap_subscribe</refname>
    <refpurpose>Subscribe to a mailbox</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imap_subscribe</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>string <parameter>mbox</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     Subscribe to a new mailbox.
    </para>
    <para>
     Returns true on success and false on error.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-undelete">
   <refnamediv>
    <refname>imap_undelete</refname> 
    <refpurpose>
     Unmark the message which is marked deleted
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imap_undelete</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>int <parameter>msg_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     This function removes the deletion flag for a specified message,
     which is set by <function>imap_delete</function> or
     <function>imap_mail_move</function>.
    </para>
    <para>
     Returns true on success and false on error.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-unsubscribe">
   <refnamediv>
    <refname>imap_unsubscribe</refname>
    <refpurpose>Unsubscribe from a mailbox</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imap_unsubscribe</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>string <parameter>mbox</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     Unsubscribe from a specified mailbox.
    </para>
    <para>
     Returns true on success and false on error.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-qprint">
   <refnamediv>
    <refname>imap_qprint</refname>
    <refpurpose>Convert a quoted-printable string to an 8 bit
    string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>imap_qprint</function></funcdef>
      <paramdef>string <parameter>string</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     Convert a quoted-printable string to an 8 bit string (according
     to <ulink url="&url.rfc;rfc2045.html">RFC2045</ulink>, section
     6.7).
    </para>
    <para>
     Returns an 8 bit (binary) string.
    </para>
    <para>
     See also <function>imap_8bit</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-8bit">
   <refnamediv>
    <refname>imap_8bit</refname>
    <refpurpose>
     Convert an 8bit string to a quoted-printable string
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>imap_8bit</function></funcdef>
      <paramdef>string <parameter>string</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     Convert an 8bit string to a quoted-printable string (according to
     <ulink url="&url.rfc;rfc2045.html">RFC2045</ulink>, section
     6.7).
    </para>
    <para>
     Returns a quoted-printable string.
    </para>
    <para>
     See also <function>imap_qprint</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-binary">
   <refnamediv>
    <refname>imap_binary</refname>
    <refpurpose>
     Convert an 8bit string to a base64 string
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>imap_binary</function></funcdef>
      <paramdef>string <parameter>string</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     Convert an 8bit string to a base64 string (according to <ulink
     url="&url.rfc;rfc2045.html">RFC2045</ulink>, Section 6.8).
    </para>
    <para>
     Returns a base64 string.
    </para>
    <para>
     See also <function>imap_base64</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-scanmailbox">
   <refnamediv>
    <refname>imap_scanmailbox</refname>
    <refpurpose>
     Read the list of mailboxes, takes a string to search for in the
     text of the mailbox
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>imap_scanmailbox</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>string <parameter>ref</parameter></paramdef>
      <paramdef>string <parameter>pattern</parameter></paramdef>   
      <paramdef>string <parameter>content</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array containing the names of the mailboxes that have
     <parameter>string</parameter> in the text of the mailbox.
     This function is similar to <function>imap_listmailbox</function>,
     but it will additionally check for the presence of the string 
     <parameter>content</parameter> inside the mailbox data.
     See <function>imap_getmailboxes</function> for a description
     of <parameter>ref</parameter> and <parameter>pattern</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-mailboxmsginfo">
   <refnamediv>
    <refname>imap_mailboxmsginfo</refname>
    <refpurpose>Get information about the current mailbox</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>object <function>imap_mailboxmsginfo</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns information about the current mailbox. Returns FALSE on
     failure.
    </para> 
    <para> 
     The <function>imap_mailboxmsginfo</function> function checks the
     current mailbox status on the server. It is similar to 
     <function>imap_status</function>, but will additionally sum up the
     size of all messages in the mailbox, which will take some additional
     time to execute. It returns the information
     in an object with following properties.
    </para>
    <para>
     <table>
      <title>Mailbox properties</title>
      <tgroup cols="2">
       <tbody>
        <row>
         <entry>Date</entry>
         <entry>date of last change</entry>
        </row>
        <row>
         <entry>Driver</entry>
         <entry>driver</entry>
        </row>
        <row>
         <entry>Mailbox</entry>
         <entry>name of the mailbox</entry>
        </row>
        <row>
         <entry>Nmsgs</entry>
         <entry>number of messages</entry>
        </row>
        <row>
         <entry>Recent</entry>
         <entry>number of recent messages</entry>
        </row>
        <row>
         <entry>Unread</entry>
         <entry>number of unread messages</entry>
        </row>
        <row>
         <entry>Deleted</entry>
         <entry>number of deleted messages</entry>
        </row>
        <row>
         <entry>Size</entry>
         <entry>mailbox size</entry>
        </row>
       </tbody>
      </tgroup>
     </table>
    </para>
    <para>
     <example>
      <title><function>imap_mailboxmsginfo</function> example</title>
      <programlisting role="php">
&lt;?php

$mbox = imap_open("{your.imap.host}INBOX","username", "password")
      || die("can't connect: ".imap_last_error());
 
$check = imap_mailboxmsginfo($mbox);
 
if($check) {
    print "Date: "    . $check->Date    ."&lt;br>\n" ;
    print "Driver: "  . $check->Driver  ."&lt;br>\n" ;
    print "Mailbox: " . $check->Mailbox ."&lt;br>\n" ;
    print "Messages: ". $check->Nmsgs   ."&lt;br>\n" ;
    print "Recent: "  . $check->Recent  ."&lt;br>\n" ;
    print "Unread: "  . $check->Unread  ."&lt;br>\n" ;
    print "Deleted: " . $check->Deleted ."&lt;br>\n" ;
    print "Size: "    . $check->Size    ."&lt;br>\n" ;
} else {
    print "imap_check() failed: ".imap_last_error(). "&lt;br>\n";
}
 
imap_close($mbox);

?&gt;
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-rfc822-write-address">
   <refnamediv>
    <refname>imap_rfc822_write_address</refname>
    <refpurpose>
     Returns a properly formatted email address given the mailbox,
     host, and personal info.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string 
       <function>imap_rfc822_write_address</function>
      </funcdef>
      <paramdef>string <parameter>mailbox</parameter></paramdef>
      <paramdef>string <parameter>host</parameter></paramdef>
      <paramdef>string <parameter>personal</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a properly formatted email address as defined in 
     <ulink url="&url.rfc;rfc822.html">RFC822</ulink>
     given the mailbox, host, and personal info.
    </para>
    <para>
     <example>
      <title><function>imap_rfc822_write_address</function> example</title>
      <programlisting role="php">
print imap_rfc822_write_address("hartmut","cvs.php.net","Hartmut Holzgraefe")."\n";    
  
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-rfc822-parse-adrlist">
   <refnamediv>
    <refname>imap_rfc822_parse_adrlist</refname>
    <refpurpose>Parses an address string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array
       <function>imap_rfc822_parse_adrlist</function>
      </funcdef>
      <paramdef>string <parameter>address</parameter></paramdef>
      <paramdef>string <parameter>default_host</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function parses the address string as defined in 
     <ulink url="&url.rfc;rfc822.html">RFC822</ulink> and 
     for each address, returns an array of objects.  
     The objects properties are:
    </para>
    <para>
     <itemizedlist>
      <listitem>
       <simpara>
        mailbox  - the mailbox name (username)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        host - the host name
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        personal - the personal name
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        adl - at domain source route
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     <example>
      <title><function>imap_rfc822_parse_adrlist</function> example</title>
      <programlisting role="php">
$address_string = "Hartmut Holzgraefe &lt;[EMAIL PROTECTED]>, 
[EMAIL PROTECTED], root";
$address_array  = imap_rfc822_parse_adrlist($address_string,"somedomain.net");
if(! is_array($address_array)) die("somethings wrong\n");
 
reset($address_array);
while(list($key,$val)=each($address_array)){
  print "mailbox : ".$val->mailbox."&lt;br>\n";
  print "host    : ".$val->host."&lt;br>\n";
  print "personal: ".$val->personal."&lt;br>\n";
  print "adl     : ".$val->adl."&lt;p>\n";
} 
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-setflag-full">
   <refnamediv>
    <refname>imap_setflag_full</refname>
    <refpurpose>Sets flags on messages</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>imap_setflag_full</function></funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
      <paramdef>string <parameter>sequence</parameter></paramdef>
      <paramdef>string <parameter>flag</parameter></paramdef>
      <paramdef>string <parameter>options</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function causes a store to add the specified flag to the
     flags set for the messages in the specified sequence.
    </para>
    <para>
     The flags which you can set are "\\Seen", "\\Answered",
     "\\Flagged", "\\Deleted", "\\Draft", and "\\Recent" (as defined
     by RFC2060).
    </para>
    <para>
     The options are a bit mask with one or more of the following:
     <informalexample>
      <literallayout>
ST_UID          The sequence argument contains UIDs instead of
                sequence numbers
      </literallayout>
     </informalexample>
    </para>
    <para>
     <example>
      <title><function>imap_setflag_full</function> example</title>
      <programlisting role="php">
$mbox = imap_open("{your.imap.host:143}","username","password")
     || die("can't connect: ".imap_last_error());
 
$status = imap_setflag_full($mbox,"2,5","\\Seen \\Flagged");
 
print gettype($status)."\n";
print $status."\n";
 
imap_close($mbox);
      </programlisting>
     </example>
    </para>                                                                            
                     </refsect1>
  </refentry>

  <refentry id="function.imap-clearflag-full">
   <refnamediv>
    <refname>imap_clearflag_full</refname>
    <refpurpose>Clears flags on messages</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string 
       <function>imap_clearflag_full</function>
      </funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
      <paramdef>string <parameter>sequence</parameter></paramdef>
      <paramdef>string <parameter>flag</parameter></paramdef>
      <paramdef>string <parameter>options</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function causes a store to delete the specified flag to the
     flags set for the messages in the specified sequence.
     The flags which you can unset are "\\Seen", "\\Answered",
     "\\Flagged", "\\Deleted", "\\Draft", and "\\Recent" (as defined
     by RFC2060).
    </para>
    <para>
     The options are a bit mask with one or more of the following:
     <informalexample>
      <literallayout>
ST_UID          The sequence argument contains UIDs instead of
                sequence numbers
      </literallayout>
     </informalexample>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-sort">
   <refnamediv>
    <refname>imap_sort</refname>
    <refpurpose>Sort an array of message headers</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>imap_sort</function></funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
      <paramdef>int <parameter>criteria</parameter></paramdef>
      <paramdef>int <parameter>reverse</parameter></paramdef>
      <paramdef>int <parameter>options</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of message numbers sorted by the given
     parameters.
    </para>
    <para>
     <parameter>Reverse</parameter> is 1 for reverse-sorting.
    </para>
    <para>
     Criteria can be one (and only one) of the following:
     <informalexample>
      <literallayout>
SORTDATE        message Date
SORTARRIVAL     arrival date
SORTFROM        mailbox in first From address
SORTSUBJECT     message Subject
SORTTO          mailbox in first To address 
SORTCC          mailbox in first cc address 
SORTSIZE        size of message in octets
      </literallayout>
     </informalexample>
    </para>
    <para>
     The flags are a bitmask of one or more of the following:
     <informalexample>
      <literallayout>
SE_UID          Return UIDs instead of sequence numbers
SE_NOPREFETCH   Don't prefetch searched messages.
      </literallayout>
     </informalexample>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-fetchheader">
   <refnamediv>
    <refname>imap_fetchheader</refname>
    <refpurpose>Returns header for a message</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>imap_fetchheader</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>int <parameter>msgno</parameter></paramdef>
      <paramdef>int <parameter>flags</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function causes a fetch of the complete, unfiltered 
     <ulink url="&url.rfc;rfc822.html">RFC822</ulink>
     format header of the specified message as a text string and
     returns that text string.
    </para>
    <para>
     The options are:
     <informalexample>
      <literallayout>
FT_UID          The msgno argument is a UID 
FT_INTERNAL     The return string is in "internal" format,
                without any attempt to canonicalize to CRLF
                newlines
FT_PREFETCHTEXT The RFC822.TEXT should be pre-fetched at the
                same time.  This avoids an extra RTT on an
                IMAP connection if a full message text is
                desired (e.g. in a "save to local file"
                operation)
      </literallayout>
     </informalexample>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-uid">
   <refnamediv>
    <refname>imap_uid</refname>
    <refpurpose>
     This function returns the UID for the given message sequence
     number
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imap_uid</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>int <parameter>msgno</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns the UID for the given message sequence
     number. An UID is an unique identifier that will not change over
     time while a message sequence number may change whenever the
     content of the mailbox changes.  This function is the inverse of
     <function>imap_msgno</function>.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.imap-msgno">
   <refnamediv>
    <refname>imap_msgno</refname>
    <refpurpose>
     This function returns the message sequence number for the given
     UID
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>imap_msgno</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>int <parameter>uid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns the message sequence number for the given
     UID. It is the inverse of <function>imap_uid</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-search">
   <refnamediv>
    <refname>imap_search</refname>
    <refpurpose>
     This function returns an array of messages matching the given
     search criteria
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>imap_search</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>string <parameter>criteria</parameter></paramdef>
      <paramdef>int <parameter>flags</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function performs a search on the mailbox currently opened
     in the given imap stream. <parameter>criteria</parameter> is a
     string, delimited by spaces, in which the following keywords are
     allowed. Any multi-word arguments (eg. FROM "joey smith") must be
     quoted.
     <itemizedlist>  
      <listitem>
       <simpara>
        ALL - return all messages matching the rest of the criteria
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        ANSWERED - match messages with the \\ANSWERED flag set
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        BCC "string" - match messages with "string" in the Bcc: field
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        BEFORE "date" - match messages with Date: before "date"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        BODY "string" - match messages with "string" in the body of the message
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        CC "string" - match messages with "string" in the Cc: field
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        DELETED - match deleted messages
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        FLAGGED - match messages with the \\FLAGGED (sometimes
        referred to as Important or Urgent) flag set
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        FROM "string" - match messages with "string" in the From: field
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        KEYWORD "string" - match messages with "string" as a keyword
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        NEW - match new messages
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        OLD - match old messages
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        ON "date" - match messages with Date: matching "date"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        RECENT - match messages with the \\RECENT flag set
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        SEEN - match messages that have been read (the \\SEEN flag is set)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        SINCE "date" - match messages with Date: after "date"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        SUBJECT "string" - match messages with "string" in the Subject:
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        TEXT "string" - match messages with text "string"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        TO "string" - match messages with "string" in the To:
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        UNANSWERED - match messages that have not been answered
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        UNDELETED - match messages that are not deleted
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        UNFLAGGED - match messages that are not flagged
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        UNKEYWORD "string" - match messages that do not have the
        keyword "string"
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        UNSEEN - match messages which have not been read yet
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     For example, to match all unanswered messages sent by Mom, you'd
     use: "UNANSWERED FROM mom". Searches appear to be case
     insensitive. This list of criteria is from a reading of the UW
     c-client source code and may be uncomplete or
     inaccurate (see also RFC2060, section 6.4.4).
    </para>
    <para>
     Valid values for flags are SE_UID, which causes the returned
     array to contain UIDs instead of messages sequence numbers.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-last-error">
   <refnamediv>
    <refname>imap_last_error</refname>
    <refpurpose>
     This function returns the last IMAP error (if any) that occurred
     during this page request
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>imap_last_error</function></funcdef>
      <paramdef>void </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns the full text of the last IMAP error
     message that occurred on the current page. The error stack is
     untouched; calling <function>imap_last_error</function>
     subsequently, with no intervening errors, will return the same
     error.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-errors">
   <refnamediv>
    <refname>imap_errors</refname>
    <refpurpose>
     This function returns all of the IMAP errors (if any) that have
     occurred during this page request or since the error stack was
     reset.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>imap_errors</function></funcdef>
      <paramdef>void </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns an array of all of the IMAP error messages
     generated since the last <function>imap_errors</function> call,
     or the beginning of the page. When
     <function>imap_errors</function> is called, the error stack is
     subsequently cleared.  
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-alerts">
   <refnamediv>
    <refname>imap_alerts</refname>
    <refpurpose>
     This function returns all IMAP alert messages (if any) that have
     occurred during this page request or since the alert stack was
     reset
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>imap_alerts</function></funcdef>
      <paramdef>void </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns an array of all of the IMAP alert messages
     generated since the last <function>imap_alerts</function> call,
     or the beginning of the page. When
     <function>imap_alerts</function> is called, the alert stack is
     subsequently cleared. The IMAP specification requires that these
     messages be passed to the user.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-status">
   <refnamediv>
    <refname>imap_status</refname>
    <refpurpose>
     This function returns status information on a mailbox other than
     the current one
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>object <function>imap_status</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>string <parameter>mailbox</parameter></paramdef>
      <paramdef>int <parameter>options</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns an object containing status
     information. Valid flags are:
     <itemizedlist>
      <listitem>
       <simpara>
        SA_MESSAGES - set status->messages to the number of messages
        in the mailbox
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        SA_RECENT - set status->recent to the number of recent
        messages in the mailbox
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        SA_UNSEEN - set status->unseen to the number of unseen (new)
        messages in the mailbox
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        SA_UIDNEXT - set status->uidnext to the next uid to be used in
        the mailbox
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        SA_UIDVALIDITY - set status->uidvalidity to a constant that
        changes when uids for the mailbox may no longer be valid
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        SA_ALL - set all of the above
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     status->flags is also set, which contains a bitmask which can be
     checked against any of the above constants.
    </para>
    <para>
     <example>
      <title><function>imap_status</function> example</title>
      <programlisting role="php">
$mbox = imap_open("{your.imap.host}","username","password",OP_HALFOPEN)
      || die("can't connect: ".imap_last_error());
 
$status = imap_status($mbox,"{your.imap.host}INBOX",SA_ALL);
if($status) {
  print("Messages:   ". $status->messages   )."&lt;br>\n";
  print("Recent:     ". $status->recent     )."&lt;br>\n";
  print("Unseen:     ". $status->unseen     )."&lt;br>\n";
  print("UIDnext:    ". $status->uidnext    )."&lt;br>\n";
  print("UIDvalidity:". $status->uidvalidity)."&lt;br>\n"; 
} else
  print "imap_status failed: ".imap_lasterror()."\n";
 
imap_close($mbox);
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-utf7-decode">
   <refnamediv>
    <refname>imap_utf7_decode</refname>
    <refpurpose>
     Decodes a modified UTF-7 encoded string.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>imap_utf7_decode</function></funcdef>
      <paramdef>string <parameter>text</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     Decodes modified UTF-7 <parameter>text</parameter> into 8bit data.
    </para>
    <para>
     Returns the decoded 8bit data, or false if the input string was
     not valid modified UTF-7. This function is needed to decode
     mailbox names that contain international characters outside of
     the printable ASCII range. The modified UTF-7 encoding is defined
     in <ulink url="&url.rfc;rfc2060.html">RFC 2060</ulink>, section
     5.1.3 (original UTF-7 was defned in <ulink
     url="&url.rfc;rfc1642.html">RFC1642</ulink>).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-utf7-encode">
   <refnamediv>
    <refname>imap_utf7_encode</refname>
    <refpurpose>
     Converts 8bit data to modified UTF-7 text.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>imap_utf7_encode</function></funcdef>
      <paramdef>string <parameter>data</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Converts 8bit <parameter>data</parameter> to modified UTF-7
     text. This is needed to encode mailbox names that contain
     international characters outside of the printable ASCII
     range. The modified UTF-7 encoding is defined in <ulink
     url="&url.rfc;rfc2060.html">RFC 2060</ulink>, section 5.1.3
     (original UTF-7 was defned in <ulink
     url="&url.rfc;rfc1642.html">RFC1642</ulink>).
    </para>
    <para>
     Returns the modified UTF-7 text.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-utf8">
   <refnamediv>
    <refname>imap_utf8</refname>
    <refpurpose>
      Converts text to UTF8
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>imap_utf8</function></funcdef>
      <paramdef>string <parameter>text</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Converts the given <parameter>text</parameter> to 
     UTF8 (as defined in 
     <ulink url="&url.rfc;rfc2044.html">RFC2044</ulink>).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-fetch-overview">
   <refnamediv>
    <refname>imap_fetch_overview</refname>
    <refpurpose>
     Read an overview of the information in the headers of the given message
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>imap_fetch_overview</function></funcdef>
      <paramdef>int <parameter>imap_stream</parameter></paramdef>
      <paramdef>string <parameter>sequence</parameter></paramdef>
      <paramdef>int <parameter><optional>flags</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function fetches mail headers for the given
     <parameter>sequence</parameter> and returns an overview of their
     contents. <parameter>sequence</parameter> will contain a sequence
     of message indices or UIDs, if <parameter>flags</parameter>
     contains FT_UID. The returned value is an array of objects
     describing one message header each:
     <itemizedlist>
      <listitem>
       <simpara>
        subject - the messages subject
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        from - who sent it
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        date - when was it sent
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        message_id - Message-ID 
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        references - is a reference to this message id
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        size - size in bytes
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        uid - UID the message has in the mailbox
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        msgno - message sequence number in the maibox
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        recent - this message is flagged as recent
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        flagged -  this message is flagged
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        answered -  this message is flagged as answered
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        deleted -  this message is flagged for deletion
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        seen -  this message is flagged as already read
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        draft -  this message is flagged as being a draft
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     <example>
      <title><function>imap_fetch_overview</function> example</title>
      <programlisting role="php">
$mbox = imap_open("{your.imap.host:143}","username","password")
     || die("can't connect: ".imap_last_error());
 
$overview = imap_fetch_overview($mbox,"2,4:6",0);
 
if(is_array($overview)) {
        reset($overview);
        while( list($key,$val) = each($overview)) {
                print     $val->msgno
                . " - " . $val->date
                . " - " . $val->subject
                . "\n";
        }
}
 
imap_close($mbox);
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-mime-header-decode">
   <refnamediv>
    <refname>imap_mime_header_decode</refname>
    <refpurpose>Decode MIME header elements</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>imap_header_decode</function></funcdef>
      <paramdef>string <parameter>text</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>imap_mime_header_decode</function> function decodes 
     MIME message header extensions that are non ASCII text 
     (see <ulink url="&url.rfc;rfc2047.html">RFC2047</ulink>) 
     The decoded elements are returned in an array of objects, 
     where each object has two properties, "charset" &amp; "text".
     If the element hasn't been encoded, and in other words is in 
     plain US-ASCII,the "charset" property of that element is set to 
     "default".
    </para>
    <para>
     <example>
      <title><function>imap_mime_header_decode</function> example</title>
      <programlisting role="php">
$text="=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= &lt;[EMAIL PROTECTED]>";

$elements=imap_mime_header_decode($text);
for($i=0;$i&lt;count($elements);$i++) {
        echo "Charset: {$elements[$i]->charset}\n";
        echo "Text: {$elements[$i]->text}\n\n";
}

      </programlisting>
     </example>
    </para>
    <para>
     In the above example we would have two elements, whereas the first
     element had previously been encoded with ISO-8859-1, and the second
     element would be plain US-ASCII.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.imap-mail-compose">
   <refnamediv>
    <refname>imap_mail_compose</refname>
    <refpurpose>
     Create a MIME message based on given envelope and body sections 
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>imap_mail_compose</function></funcdef>
      <paramdef>array <parameter>envelope</parameter></paramdef>
      <paramdef>array <parameter>body</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
    </para>
    <para>
     <example>
      <title><function>imap_mail_compose</function> example</title>
      <programlisting role="php">
&lt;?php

$envelope["from"]="[EMAIL PROTECTED]";
$envelope["to"]="musone@darkstar";
$envelope["cc"]="[EMAIL PROTECTED]";

$part1["type"]=TYPEMULTIPART;
$part1["subtype"]="mixed";

$filename="/tmp/imap.c.gz";
$fp=fopen($filename,"r");
$contents=fread($fp,filesize($filename));
fclose($fp);

$part2["type"]=TYPEAPPLICATION;
$part2["encoding"]=ENCBINARY;
$part2["subtype"]="octet-stream";
$part2["description"]=basename($filename);
$part2["contents.data"]=$contents;

$part3["type"]=TYPETEXT;
$part3["subtype"]="plain";
$part3["description"]="description3";
$part3["contents.data"]="contents.data3\n\n\n\t";

$body[1]=$part1;
$body[2]=$part2;
$body[3]=$part3;

echo nl2br(imap_mail_compose($envelope,$body));

?&gt;
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.imap-mail">
   <refnamediv>
    <refname>imap_mail</refname>
    <refpurpose>
     Send an email message
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>imap_mail</function></funcdef>
      <paramdef>string <parameter>to</parameter></paramdef>
      <paramdef>string <parameter>subject</parameter></paramdef>
      <paramdef>string <parameter>message</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>additional_headers</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>cc</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>bcc</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>rpath</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function is currently only available in PHP 3. 
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/info.xml
+++ phpdoc/kr/functions/info.xml
 <reference id="ref.info">
  <title>PHP options &amp; information</title>
  <titleabbrev>PHP options/info</titleabbrev>
  
  <refentry id="function.assert">
   <refnamediv>
    <refname>assert</refname>
    <refpurpose>Checks if assertion is false</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>assert</function></funcdef>
      <paramdef>string|bool <parameter>assertion</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>assert</function> will check the given 
     <parameter>assertion</parameter> and take appropriate 
     action if its result is <literal>false</literal>.
    </para>
    <para>
     If the <parameter>assertion</parameter> is given as a string it
     will be evaluated as PHP code by <function>assert</function>.
     The advantages of a string <parameter>assertion</parameter> 
     are less overhead when assertion checking is off and messages
     containing the <parameter>assertion</parameter> expression when
     an assertion failes.
    </para>
    <para>
     Assertion should be used as a debugging feature only. You may
     use them for sanity-checks that test for conditions that should
     always be true and that indicate some programming errors if not
     or to check for the presence of certain features like extension
     functions or certain system limits and features.
    </para>
    <para>
     Assertions should not be used for normal runtime operations 
     like input parameter checks. As a rule of thumb your code
     should always be able to work correct if assertion checking
     is not activated.
    </para>
    <para>
     The behavior of <function>assert</function> may be configured
     by <function>assert_options</function> or by .ini-settings 
     described in that functions manual page.
    </para>
   </refsect1>
  </refentry> 

  <refentry id="function.assert-options">
   <refnamediv>
    <refname>assert_options</refname>
    <refpurpose>Set/get the various assert flags</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>assert_options</function></funcdef>
      <paramdef>int <parameter>what</parameter></paramdef>
      <paramdef>mixed 
       <parameter><optional>value</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Using <function>assert_options</function> you may set the various
     <function>assert</function> control options or just query their
     current settings.
    </para>
    <table>
     <title>assert options</title>
     <tgroup cols="4">
      <thead>
       <row>
                                <entry>option</entry>
                                <entry>ini-parameter</entry>
                                <entry>default</entry>
                                <entry>description</entry>
       </row>
      </thead>
      <tbody>
       <row>
                                <entry>ASSERT_ACTIVE</entry>
                                <entry>assert.active</entry>
                                <entry>1</entry>
                                <entry>enable <function>assert</function> 
evaluation</entry>
       </row>
       <row>
                                <entry>ASSERT_WARNING</entry>
                                <entry>assert.warning</entry>
                                <entry>1</entry>
                                <entry>issue a PHP warning for each failed 
assertion</entry>
       </row>
       <row>
                                <entry>ASSERT_BAIL</entry>
                                <entry>assert.bail</entry>
                                <entry>0</entry>
                                <entry>terminate execution on failed assertions</entry>
       </row>
       <row>
                                <entry>ASSERT_QUIET_EVAL</entry>
                                <entry>assert.quiet_eval</entry>
                                <entry>0</entry>
                                <entry>
                                 disable error_reporting during assertion expression
                                 evaluation
                                </entry>
       </row>
       <row>
                                <entry>ASSERT_CALLBACK</entry>
                                <entry>assert_callback</entry>
                                <entry>(null)</entry>
                                <entry>user function to call on failed 
assertions</entry>
       </row>
      </tbody>    
     </tgroup>
    </table>
    <para>
     <function>assert_options</function> will return the original
     setting of any option or <literal>false</literal> on errors.
    </para>
   </refsect1>
  </refentry> 

  <refentry id="function.extension-loaded">
   <refnamediv>
    <refname>extension_loaded</refname>
    <refpurpose>find out whether an extension is loaded</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>extension_loaded</function></funcdef>
      <paramdef>string <parameter>name</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns true if the extension identified by
     <parameter>name</parameter> is loaded. You can see the names of
     various extensions by using <function>phpinfo</function>.
    </simpara>
    <para>
     See also <function>phpinfo</function>.
     <note>
      <para>
       This function was added in 3.0.10.
      </para>
     </note>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.dl">
   <refnamediv>
    <refname>dl</refname>
    <refpurpose>load a PHP extension at runtime</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>dl</function></funcdef>
      <paramdef>string <parameter>library</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Loads the PHP extension defined in
     <parameter>library</parameter>.  See also the <link
                        linkend="ini.extension-dir">extension_dir</link> configuration
     directive.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.getenv">
   <refnamediv>
    <refname>getenv</refname>
    <refpurpose>Get the value of an environment variable</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>getenv</function></funcdef>
      <paramdef>string <parameter>varname</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the value of the environment variable
     <parameter>varname</parameter>, or false on an error.

     <informalexample>
      <programlisting>
$ip = getenv ("REMOTE_ADDR"); // get the ip number of the user 
      </programlisting>
     </informalexample>
    </para>
    <para>
     You can see a list of all the environmental variables by using
     <function>phpinfo</function>. You can find out what many of them
     mean by taking a look at the <ulink url="&url.cgispecs;">CGI
                        specification</ulink>, specifically the <ulink
                        url="&url.cgispec;">page on
                        environmental variables</ulink>.
     <note>
      <para>
       This function does not work in ISAPI mode.
      </para>
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.get-cfg-var">
   <refnamediv>
    <refname>get_cfg_var</refname>
    <refpurpose>
     Get the value of a PHP configuration option.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>get_cfg_var</function></funcdef>
      <paramdef>string <parameter>varname</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns the current value of the PHP configuration variable
     specified by <parameter>varname</parameter>, or false if an error
     occurs.
    </simpara>
    <simpara>
     It will not return configuration information set when the PHP was
     compiled, or read from an Apache configuration file (using the
     php3_configuration_option directives).
    </simpara>
    <simpara>
     To check whether the system is using a <link
                        linkend="configuration.file">configuration file</link>, try
     retrieving the value of the cfg_file_path configuration
     setting. If this is available, a configuration file is being
     used.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.get-current-user">
   <refnamediv>
    <refname>get_current_user</refname>
    <refpurpose>
     Get the name of the owner of the current PHP script.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>get_current_user</function></funcdef>
      <paramdef>void</paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns the name of the owner of the current PHP script.
    </simpara>
    <simpara>
     See also <function>getmyuid</function>,
     <function>getmypid</function>, <function>getmyinode</function>,
     and <function>getlastmod</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.get-magic-quotes-gpc">
   <refnamediv>
    <refname>get_magic_quotes_gpc</refname>
    <refpurpose>
     Get the current active configuration setting of magic quotes gpc.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>long <function>get_magic_quotes_gpc</function></funcdef>
      <paramdef>void</paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns the current active configuration setting of 
     <link linkend="ini.magic-quotes-gpc">magic_quotes_gpc</link>.
     (0 for off, 1 for on).
    </simpara>
    <simpara>
     See also <function>get_magic_quotes_runtime</function>,
     <function>set_magic_quotes_runtime</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.get-magic-quotes-runtime">
   <refnamediv>
    <refname>get_magic_quotes_runtime</refname>
    <refpurpose>
     Get the current active configuration setting of
     magic_quotes_runtime.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>long 
       <function>get_magic_quotes_runtime</function>
      </funcdef>
      <paramdef>void</paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns the current active configuration setting of 
     <link linkend="ini.magic-quotes-runtime">magic_quotes_runtime</link>.
     (0 for off, 1 for on).
    </simpara>
    <simpara>
     See also <function>get_magic_quotes_gpc</function>,
     <function>set_magic_quotes_runtime</function>.
    </simpara>
   </refsect1>
  </refentry>
  
  <refentry id="function.getlastmod">
   <refnamediv>
    <refname>getlastmod</refname>
    <refpurpose>Get time of last page modification.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>getlastmod</function></funcdef>
      <paramdef>void</paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the time of the last modification of the current
     page. The value returned is a Unix timestamp, suitable for
     feeding to <function>date</function>. Returns false on error.
     <example>
      <title>getlastmod() example</title>
      <programlisting role="php">
// outputs e.g. 'Last modified: March 04 1998 20:43:59.'
echo "Last modified: ".date ("F d Y H:i:s.", getlastmod());
      </programlisting>
     </example>
    </para>
    <para>
     See alse <function>date</function>,
     <function>getmyuid</function>,
     <function>get_current_user</function>,
     <function>getmyinode</function>, and
     <function>getmypid</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.getmyinode">
   <refnamediv>
    <refname>getmyinode</refname>
    <refpurpose>Get the inode of the current script.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>getmyinode</function></funcdef>
      <paramdef>void</paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the current script's inode, or false on error.
    </para>
    <para>
     See also <function>getmyuid</function>,
     <function>get_current_user</function>,
     <function>getmypid</function>, and
     <function>getlastmod</function>.
    </para>
    <note>
     <simpara>
                        This function is not supported on Windows systems.
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.getmypid">
   <refnamediv>
    <refname>getmypid</refname>
    <refpurpose>Get PHP's process ID.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>getmypid</function></funcdef>
      <paramdef>void</paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the current PHP process ID, or false on error.
    </para>
    <warning>
     <para>
      Process IDs are not unique, thus they are a weak entropy 
      source. We recommend against relying on pids in 
      security-dependent contexts.
     </para>
    </warning>
    <para>
     See also <function>getmyuid</function>,
     <function>get_current_user</function>,
     <function>getmyinode</function>, and
     <function>getlastmod</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.getmyuid">
   <refnamediv>
    <refname>getmyuid</refname>
    <refpurpose>Get PHP script owner's UID.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>getmyuid</function></funcdef>
      <paramdef>void</paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns the user ID of the current script, or false on error.
    </simpara>
    <simpara>
     See also <function>getmypid</function>,
     <function>get_current_user</function>,
     <function>getmyinode</function>, and
     <function>getlastmod</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.getrusage">
   <refnamediv>
    <refname>getrusage</refname>
    <refpurpose>Get the current resource usages.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>getrusage</function></funcdef>
      <paramdef>int 
       <parameter><optional>who</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This is an interface to getrusage(2). It returns an associative
     array containing the data returned from the system call. If who
     is 1, getrusage will be called with RUSAGE_CHILDREN.
    </para>
    <para>
     All entries are accessible by using their documented field names.
     <example>
      <title>Getrusage Example</title>
      <programlisting role="php">
$dat = getrusage();
echo $dat["ru_nswap"];         # number of swaps
echo $dat["ru_majflt"];        # number of page faults
echo $dat["ru_utime.tv_sec"];  # user time used (seconds)
echo $dat["ru_utime.tv_usec"]; # user time used (microseconds)
      </programlisting>
     </example>
     See your system's man page on getrusage(2) for more details. 
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ini-alter">
   <refnamediv>
    <refname>ini_alter</refname>
    <refpurpose>Change the value of a configuration option</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ini_alter</function></funcdef>
      <paramdef>string <parameter>varname</parameter></paramdef>
      <paramdef>string <parameter>newvalue</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Changes the value of a configuration option, returns
     <literal>false</literal> on failure, and the previous value of the
     configuration option on success.
    </para>
    <note>
     <para>
      This is an alias of <function>ini_set</function>
     </para>
    </note>
    <para>
     See also <function>ini_get</function>,
     <function>ini_restore</function>,
     <function>ini_set</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ini-get">
   <refnamediv>
    <refname>ini_get</refname>
    <refpurpose>Get the value of a configuration option</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ini_get</function></funcdef>
      <paramdef>string <parameter>varname</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the value of the configuration option on success,
     <literal>false</literal> on failure.
    </para>
    <para>
     See also <function>ini_alter</function>,
     <function>ini_restore</function>,
     <function>ini_set</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ini-restore">
   <refnamediv>
    <refname>ini_restore</refname>
    <refpurpose>Restore the value of a configuration option</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ini_restore</function></funcdef>
      <paramdef>string <parameter>varname</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Restores a given configuration option to its original value.
    </para>
    <para>
     See also <function>ini_alter</function>,
     <function>ini_get</function>,
     <function>ini_set</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ini-set">
   <refnamediv>
    <refname>ini_set</refname>
    <refpurpose>Set the value of a configuration option</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ini_set</function></funcdef>
      <paramdef>string <parameter>varname</parameter></paramdef>
      <paramdef>string <parameter>newvalue</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets the value of the given configuration option. Returns the old
     value on success, <literal>false</literal> on failure.
    </para>
    <para>
     See also <function>ini_alter</function>,
     <function>ini_get</function>,
     <function>ini_restore</function>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.phpcredits">
   <refnamediv>
    <refname>phpcredits</refname>
    <refpurpose>Prints out the credits for PHP.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>phpcredits</function></funcdef>
      <paramdef>int <parameter>flag</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function prints out the credits listing the PHP developers,
     modules, etc. It generates the appropriate HTML codes to insert
     the information in a page. A parameter indicating what will be
     printed (a pre-defined constant flag, see table below) needs
     to be passed. For example to print the general credits, you will
     use somewhere in your code:
     <informalexample>
      <programlisting role="php">
..
phpcredits(CREDITS_GENERAL);
..
      </programlisting>
     </informalexample>
     And if you want to print the core developers and the documentation
     group, in a page of its own, you will use:
     <informalexample>
      <programlisting role="php">
&lt;?php
phpcredits(CREDITS_GROUP + CREDITS_DOCS + CREDITS_FULLPAGE);
?&gt;  
      </programlisting>
     </informalexample>
     And if you feel like embedding all the credits in your page, then
     code like the one below will do it:
     <informalexample>
      <programlisting role="php">
&lt;html&gt;
 &lt;head&gt;
  &lt;title&gt;My credits page&lt;/title&gt;
 &lt;/head&gt;
 &lt;body&gt;
  &lt;?php
        // some code of your own
        phpcredits(CREDITS_ALL + CREDITS_FULLPAGE);
        // some more code
        ?&gt;
 &lt;/body&gt;
&lt;/html&gt;
      </programlisting>
     </informalexample>
    </para>
    <para>
    </para>
    <para>
                 <table>
      <title>Pre-defined <function>phpcredits</function> flags</title>
      <tgroup cols="2">
       <thead>
                                <row>
                                 <entry>name</entry>
                                 <entry>description</entry>
                                </row>
       </thead>
       <tbody>
                                <row>
                                 <entry>CREDITS_ALL</entry>
                                 <entry>
                                        All the credits, equivalent to using: 
CREDITS_DOCS + CREDITS_GENERAL + 
                                        CREDITS_GROUP + CREDITS_MODULES + 
CREDITS_FULLPAGE. It generates a
                                        complete stand-alone HTML page with the 
appropriate tags.
                                 </entry>
                                </row>
                                <row>
                                 <entry>CREDITS_DOCS</entry>
                                 <entry>The credits for the documentation team</entry>
                                </row>
                                <row>
                                 <entry>CREDITS_FULLPAGE</entry>
                                 <entry>
                                        Usually used in combination with the other 
flags.
                                        Indicates that the a complete stand-alone HTML 
page
                                        needs to be printed including the information 
indicated
                                        by the other flags.
                                 </entry>
                                </row>
                                <row>
                                 <entry>CREDITS_GENERAL</entry>
                                 <entry>
                                        General credits: Language design and concept, 
PHP 4.0 authors
                                        and SAPI module.
                                 </entry>
                                </row>
                                <row>
                                 <entry>CREDITS_GROUP</entry>
                                 <entry>A list of the core developers</entry>
                                </row>
                                <row>
                                 <entry>CREDITS_MODULES</entry>
                                 <entry>A list of the extension modules for PHP, and 
their authors</entry>
                                </row>
                                <row>
                                 <entry>CREDITS_SAPI</entry>
                                 <entry>A list of the server API modules for PHP, and 
their authors</entry>
                                </row>
       </tbody>
      </tgroup>
     </table>
    </para>
    <para>
     See also <function>phpinfo</function>,
     <function>phpversion</function>,
     <function>php_logo_guid</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.phpinfo">
   <refnamediv>
    <refname>phpinfo</refname>
    <refpurpose>Output lots of PHP information.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>phpinfo</function></funcdef>
      <paramdef>int <parameter><optional>what</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Outputs a large amount of information about the current state of
     PHP. This includes information about PHP compilation options and
     extensions, the PHP version, server information and environment
     (if compiled as a module), the PHP environment, OS version
     information, paths, master and local values of configuration
     options, HTTP headers, and the PHP License.
    </para>
          <para>
                 The output may be customized by passing one or more of the
     following values ored together in the optional parameter
     <parameter>what</parameter>. 
                 <itemizedlist>
                  <listitem><simpara>INFO_GENERAL</simpara></listitem>
                  <listitem><simpara>INFO_CREDITS</simpara></listitem>
                  <listitem><simpara>INFO_CONFIGURATION</simpara></listitem>
                  <listitem><simpara>INFO_MODULES</simpara></listitem>
                  <listitem><simpara>INFO_ENVIRONMENT</simpara></listitem>
                  <listitem><simpara>INFO_VARIABLES</simpara></listitem>
                  <listitem><simpara>INFO_LICENSE</simpara></listitem>
                  <listitem><simpara>INFO_ALL</simpara></listitem>
                 </itemizedlist>
          </para>
    <para>
     See also <function>phpversion</function>,
     <function>phpcredits</function>,
     <function>php_logo_guid</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.phpversion">
   <refnamediv>
    <refname>phpversion</refname>
    <refpurpose>Get the current PHP version.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>phpversion</function></funcdef>
      <paramdef>void</paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string containing the version of the currently running
     PHP parser.
     <example>
      <title>phpversion() example</title>
      <programlisting role="php">
// prints e.g. 'Current PHP version: 3.0rel-dev'
echo "Current PHP version: ".phpversion();
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>phpinfo</function>, 
     <function>phpcredits</function>,
     <function>php_logo_guid</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.php-logo-guid">
   <refnamediv>
    <refname>php_logo_guid</refname>
    <refpurpose>Get the logo guid</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>php_logo_guid</function></funcdef>
      <paramdef>void</paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <note>
      <para>
       This funcionality was added in PHP 4 Beta 4.
      </para>
     </note>
    </para>
    <para>
     See also <function>phpinfo</function>.
     <function>phpversion</function>,
     <function>phpcredits</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.php-sapi-name">
   <refnamediv>
    <refname>php_sapi_name</refname>
    <refpurpose>
     Returns the type of interface between web server and PHP
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>php_sapi_name</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Php_sapi_name</function> returns a lowercase string which
     describes the type of interface between web server and PHP
     (Server API, SAPI). In CGI PHP, this string is "cgi", in
     mod_php for Apache, this string is "apache" and so on.
    </simpara>
    <para>
     <example>
      <title><function>Php_sapi_name</function> Example</title>
      <programlisting role="php">
$sapi_type = php_sapi_name();
if ($sapi_type == "cgi")
  print "You are using CGI PHP\n";
else
  print "You are not using CGI PHP\n";
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.php-uname">
   <refnamediv>
    <refname>php_uname</refname>
    <refpurpose>
     Returns information about the operating system PHP was built on
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>php_uname</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>php_uname</function> returns a string with a description
     of the operating system PHP is built on.
    </simpara>
    <para>
     <example>
      <title><function>php_uname</function> Example</title>
      <programlisting role="php">
if (substr(php_uname(), 0, 7) == "Windows") {
  die("Sorry, this script doesn't run on Windows.\n");
}
                        </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.putenv">
   <refnamediv>
    <refname>putenv</refname>
    <refpurpose>Set the value of an environment variable.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>putenv</function></funcdef>
      <paramdef>string <parameter>setting</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Adds <parameter>setting</parameter> to the server environment.
    </para>
    <para>
     <example>
      <title>Setting an Environment Variable</title>
      <programlisting role="php">
putenv ("UNIQID=$uniqid");
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.set-magic-quotes-runtime">
   <refnamediv>
    <refname>set_magic_quotes_runtime</refname>
    <refpurpose>
     Set the current active configuration setting of
     magic_quotes_runtime.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>long 
       <function>set_magic_quotes_runtime</function>
      </funcdef>
      <paramdef>int <parameter>new_setting</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Set the current active configuration setting of <link
                        linkend="ini.magic-quotes-runtime">magic_quotes_runtime</link>.
     (0 for off, 1 for on)
    </simpara>
    <simpara>
     See also <function>get_magic_quotes_gpc</function>,
     <function>get_magic_quotes_runtime</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.set-time-limit">
   <refnamediv>
    <refname>set_time_limit</refname>
    <refpurpose>limit the maximum execution time</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>set_time_limit</function></funcdef>
      <paramdef>int <parameter>seconds</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Set the number of seconds a script is allowed to run.  If this is
     reached, the script returns a fatal error.  The default limit is
     30 seconds or, if it exists, the max_execution_time value defined
     in the <link linkend="configuration.file">configuration
                        file</link>.  If seconds is set to zero, no time limit is
     imposed.
    </simpara>
    <simpara>
     When called, <function>set_time_limit</function> restarts the
     timeout counter from zero. In other words, if the timeout is the
     default 30 seconds, and 25 seconds into script execution a call
     such as set_time_limit(20) is made, the script will run for a
     total of 45 seconds before timing out.
    </simpara>
    <simpara>
     Note that <function>set_time_limit</function> has no effect when
     PHP is running in safe mode. There is no workaround other than
     turning off safe mode or changing the time limit in the <link
                        linkend="configuration.file">configuration file</link>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.zend-logo-guid">
   <refnamediv>
    <refname>zend_logo_guid</refname>
    <refpurpose>Get the zend guid</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>zend_logo_guid</function></funcdef>
      <paramdef>void</paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <note>
      <para>
       This funcionality was added in PHP 4 Beta 4.
      </para>
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.get-loaded-extensions">
   <refnamediv>
    <refname>get_loaded_extensions</refname>
    <refpurpose>
     Returns an array with the names of all modules compiled and
     loaded
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>get_loaded_extensions</function></funcdef>
      <paramdef>void </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns the names of all the modules compiled and
     loaded in the PHP interpreter.
    </para>
    <para>
     For example the line below
     <informalexample>
      <programlisting>
print_r (get_loaded_extensions());
      </programlisting>
     </informalexample>
     will print a list like:
     <informalexample>
      <programlisting>
Array
(
    [0] =&gt; xml
    [1] =&gt; wddx
    [2] =&gt; standard
          [3] =&gt; session
          [4] =&gt; posix
          [5] =&gt; pgsql
          [6] =&gt; pcre
          [7] =&gt; gd
          [8] =&gt; ftp
          [9] =&gt; db
          [10] =&gt; Calendar
          [11] =&gt; bcmath
)
      </programlisting>
     </informalexample>
    </para>
    <para>
     See also: <function>get_extension_funcs</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.get-extension-funcs">
   <refnamediv>
    <refname>get_extension_funcs</refname>
    <refpurpose>
     Returns an array with the names of the functions of a module
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>get_extension_funcs</function></funcdef>
      <paramdef>string <parameter>module_name</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns the names of all the functions defined in
     the module indicated by <parameter>module_name</parameter>.
    </para>
    <para>
     For example the lines below
     <informalexample>
      <programlisting>
print_r (get_extension_funcs (&quot;xml&quot;));
print_r (get_extension_funcs (&quot;gd&quot;));
                        </programlisting>
     </informalexample>
     will print a list of the functions in the modules
     <varname>xml</varname> and <varname>gd</varname> respectively.
    </para>
    <para>
     See also: <function>get_loaded_extensions</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.get-required-files">
   <refnamediv>
    <refname>get_required_files</refname>
    <refpurpose>
     Returns an array with the names of the files require_once()'d in
     a script
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>get_required_files</function></funcdef>
      <paramdef>void </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns an associtative array of the names of all
     the files that have been loaded into a script using
     <function>require_once</function>. The indexes of the array are
     the file names as used in the <function>require_once</function>
     without the &quot;.php&quot; extension.
    </para>
    <para>
     The example below
     <example>
      <title>Printing the required and included files</title>
      <programlisting>
&lt;?php

require_once (&quot;local.php&quot;);
require_once (&quot;../inc/global.php&quot;);

for ($i=1; $i&lt;5; $i++)
  include &quot;util&quot;.$i.&quot;php&quot;;

  echo &quot;Required_once files\n&quot;;
  print_r (get_required_files());

  echo &quot;Included_once files\n&quot;;
  print_r (get_included_files());
?&gt;
      </programlisting>
     </example>
     will generate the following output:
     <informalexample>
      <programlisting>
Required_once files
Array
(
  [local] =&gt; local.php 
  [../inc/global] =&gt; /full/path/to/inc/global.php
)

Included_once files
Array
(
    [util1] =&gt; util1.php 
    [util2] =&gt; util2.php 
    [util3] =&gt; util3.php 
    [util4] =&gt; util4.php 
)
      </programlisting>
     </informalexample>
    </para>
    <para>
     <note>
      <para>
       As of PHP 4.0.1pl2 this function assumes that the
       <varname>required_once</varname> files end in the extension
       &quot;.php&quot;, other extensions do not work.
      </para>
     </note>
    </para>
    <para>
     See also: <function>require_once</function>,
     <function>include_once</function>,
     <function>get_included_files</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.get-included-files">
   <refnamediv>
    <refname>get_included_files</refname>
    <refpurpose>
     Returns an array with the names of the files include_once()'d in
     a script
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>get_included_files</function></funcdef>
      <paramdef>void </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns an associtative array of the names of all
     the files that have been loaded into a script using
     <function>include_once</function>. The indexes of the array are
     the file names as used in the <function>include_once</function>
     without the &quot;.php&quot; extension.
    </para>
    <para>
     <note>
      <para>
       As of PHP 4.0.1pl2 this function assumes that the
       <varname>include_once</varname> files end in the extension
       &quot;.php&quot;, other extensions do not work.
      </para>
     </note>
    </para>
    <para>
     See also: <function>require_once</function>,
     <function>include_once</function>,
     <function>get_required_files</function>
    </para>
   </refsect1>
  </refentry>

 </reference>

 <!-- Keep this comment at the end of the file
 Local variables:
 mode: sgml
 sgml-omittag:t
 sgml-shorttag:t
 sgml-minimize-attributes:nil
 sgml-always-quote-attributes:t
 sgml-indent-step:1
 sgml-indent-data:t
 sgml-parent-document:nil
 sgml-default-dtd-file:"../../manual.ced"
 sgml-exposed-tags:nil
 sgml-local-catalogs:nil
 sgml-local-ecat-files:nil
 End:
 -->

Index: phpdoc/kr/functions/ingres_ii.xml
+++ phpdoc/kr/functions/ingres_ii.xml
 <reference id="ref.ingres">
  <title>Ingres II functions</title>
  <titleabbrev>Ingres II</titleabbrev>
  <partintro>
   <simpara>
    These functions allow you to access Ingres II database servers.
   </simpara>
   <simpara>
    In order to have these functions available, you must compile php
    with Ingres support by using the
    <option role="configure">--with-ingres</option> option.
    You need the Open API library and header files included with
    Ingres II. If the II_SYSTEM environment variable isn't correctly
    set you may have to use
    <option role="configure">--with-ingres=DIR</option>
    to specify your Ingres installation directory.
   </simpara>
   <simpara>
    When using this extension with Apache, if Apache does not start
    and complains with "PHP Fatal error:  Unable to start
    ingres_ii module in Unknown on line 0"
    then make sure the environement variable II_SYSTEM is correctly
    set. Adding "export II_SYSTEM="/home/ingres/II" in the script
    that starts Apache, just before launching httpd, should be fine.
   </simpara>
   <note>
    <para>
     If you already used PHP extensions to access other database servers,
     note that Ingres doesn't allow concurrent queries and/or transaction
     over one connection, thus you won't find any result or transaction
     handle in this extension. The result of a query must be treated
     before sending another query, and a transaction must be commited or
     rolled back before opening another transaction (which is automaticaly
     done when sending the first query).
    </para>
   </note>
  </partintro>

  <refentry id="function.ingres-connect">
   <refnamediv>
    <refname>ingres_connect</refname>
    <refpurpose>Open a connection to an Ingres II database.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>ingres_connect</function></funcdef>
      <paramdef>string
       <parameter><optional>database</optional></parameter>
      </paramdef>
      <paramdef>string
       <parameter><optional>username</optional></parameter>
      </paramdef>
      <paramdef>string
       <parameter><optional>password</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a Ingres II link resource on success, or false on failure.
    </para>
    <para>
     <function>ingres_connect</function> opens a connection with the
     Ingres database designated by <parameter>database</parameter>, which
     follows the syntax <parameter>[node_id::]dbname[/svr_class]</parameter>.
    </para>
    <para>
     If some parameters are missing, <function>ingres_connect</function>
     uses the values in <filename>php.ini</filename> for
     <parameter>ingres.default_database</parameter>,
     <parameter>ingres.default_user</parameter> and
     <parameter>ingres.default_password</parameter>.
    </para>
    <para>
     The connection is closed when the script ends or when
     <function>ingres_close</function> is called on this link.
    </para>
    <para>
     All the other ingres functions use the last opened link as a
     default, so you need to store the returned value only if you use
     more than one link at a time.
    </para>
    <example>
     <title><function>ingres_connect</function> example</title>
     <programlisting>
&lt;?php
    $link = ingres_connect ("mydb", "user", "pass")
        or die ("Could not connect");
    print ("Connected successfully");
    ingres_close ($link);
?>
     </programlisting>
    </example>
    <example>
     <title><function>ingres_connect</function> example
      using default link</title>
     <programlisting>
&lt;?php
    ingres_connect ("mydb", "user", "pass")
        or die ("Could not connect");
    print ("Connected successfully");
    ingres_close ();
?>
     </programlisting>
    </example>
    <para> See also
     <function>ingres_pconnect</function>, and
     <function>ingres_close</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ingres-pconnect">
   <refnamediv>
    <refname>ingres_pconnect</refname>
    <refpurpose>
     Open a persistent connection to an Ingres II database.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>ingres_pconnect</function></funcdef>
      <paramdef>string
       <parameter><optional>database</optional></parameter>
      </paramdef>
      <paramdef>string
       <parameter><optional>username</optional></parameter>
      </paramdef>
      <paramdef>string
       <parameter><optional>password</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a Ingres II link resource on success, or false on failure.
    </para>
    <para>
     See <function>ingres_connect</function> for parameters details and
     examples. There are only 2 differences between
     <function>ingres_pconnect</function> and
     <function>ingres_connect</function> : 
     First, when connecting, the function will first try to find a
     (persistent) link that's already opened with the same parameters.
     If one is found, an identifier for it will be returned instead of
     opening a new connection. Second, the connection to the Ingres
     server will not be closed when the execution of the script ends.
     Instead, the link will remain open for future use
     (<function>ingres_close</function> will not close links established
     by <function>ingres_pconnect</function>). This type of link is
     therefore called 'persistent'.
    </para>
    <para> See also
     <function>ingres_connect</function>, and
     <function>ingres_close</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ingres-close">
   <refnamediv>
    <refname>ingres_close</refname>
    <refpurpose>Close an Ingres II database connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool<function>ingres_close</function></funcdef>
      <paramdef>resource
       <parameter><optional>link</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, or false on failure.
    </para>
    <para>
     <function>ingres_close</function> closes the connection to
     the Ingres server that's associated with the specified link.
     If the <parameter>link</parameter> parameter isn't
     specified, the last opened link is used.
    </para>
    <para>
     <function>ingres_close</function> isn't usually necessary, as it
     won't close persistent connections and all non-persistent connections
     are automatically closed at the end of the script.
    </para>
    <para> See also
     <function>ingres_connect</function>, and
     <function>ingres_pconnect</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ingres-query">
   <refnamediv>
    <refname>ingres_query</refname>
    <refpurpose>Send a SQL query to Ingres II</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool<function>ingres_query</function></funcdef>
      <paramdef>string
       <parameter>query</parameter>
      </paramdef>
      <paramdef>resource
       <parameter><optional>link</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, or false on failure.
    </para>
    <para>
     <function>ingres_query</function> sends the given
     <parameter>query</parameter> to the Ingres server. This query
     must be a valid SQL query (see the Ingres SQL reference guide)
    </para>
    <para>
     The query becomes part of the currently open transaction.
     If there is no open transaction, <function>ingres_query</function>
     opens a new transaction. To close the transaction, you can either
     call <function>ingres_commit</function> to commit the changes made
     to the database or <function>ingres_rollback</function> to cancel these
     changes. When the script ends, any open transaction is rolled back
     (by calling <function>ingres_rollback</function>). You can also
     use <function>ingres_autocommit</function> before opening a new
     transaction to have every SQL query immediatly commited.
    </para>
    <para>
     Some types of SQL queries can't be sent with this function :
     <itemizedlist>
      <listitem>
       <simpara>close (see <function>ingres_close</function>).</simpara>
      </listitem>
     <listitem>
       <simpara>commit (see <function>ingres_commit</function>).</simpara>
      </listitem>
      <listitem>
       <simpara>connect (see <function>ingres_connect</function>).</simpara>
      </listitem>
      <listitem>
       <simpara>disconnect (see <function>ingres_close</function>).</simpara>
      </listitem>
      <listitem><simpara>get dbevent</simpara></listitem>
      <listitem><simpara>prepare to commit</simpara></listitem>
      <listitem>
       <simpara>
        rollback (see <function>ingres_rollback</function>).
       </simpara>
      </listitem>
      <listitem><simpara>savepoint</simpara></listitem>
      <listitem>
       <simpara>
        set autocommit (see <function>ingres_autocommit</function>).
       </simpara>
      </listitem>
      <listitem>
       <simpara>all cursor related queries are unsupported</simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     <example>
      <title><function>ingres_query</function> example</title>
      <programlisting role="php">
&lt;?php 
ingres_connect ($database, $user, $password);

ingres_query ("select * from table");
while ($row = ingres_fetch_row()) {
    echo $row[1];
    echo $row[2];
}
?>
      </programlisting>
     </example>
    </para>
    <para>
     See also
     <function>ingres_fetch_array</function>,
     <function>ingres_fetch_object</function>,
     <function>ingres_fetch_row</function>,
     <function>ingres_commit</function>,
     <function>ingres_rollback</function> and
     <function>ingres_autocommit</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ingres-num-rows">
   <refnamediv>
    <refname>ingres_num_rows</refname>
    <refpurpose>
     Get the number of rows affected or returned by the last query
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int<function>ingres_num_rows</function></funcdef>
      <paramdef>resource
       <parameter><optional>link</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     For delete, insert or update queries,
     <function>ingres_num_rows</function> returns the number of rows
     affected by the query. For other queries,
     <function>ingres_num_rows</function> returns the number of rows
     in the query's result.
    </para>
    <para>
     <note>
      <simpara>
       This function is mainly meant to get the number of rows
       modified in the database.
       If this function is called before using
       <function>ingres_fetch_array</function>,
       <function>ingres_fetch_object</function> or
       <function>ingres_fetch_row</function> the server will delete
       the result's data and the script won't be able to get them.
      </simpara>
      <simpara>
       You should instead retrieve the result's data using one of these
       fetch functions in a loop until it returns false, indicating that
       no more results are available.
      </simpara>
     </note>
    </para>
    <para>
     See also
     <function>ingres_query</function>,
     <function>ingres_fetch_array</function>,
     <function>ingres_fetch_object</function> and
     <function>ingres_fetch_row</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ingres-num-fields">
   <refnamediv>
    <refname>ingres_num_fields</refname>
    <refpurpose>
     Get the number of fields returned by the last query
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int<function>ingres_num_fields</function></funcdef>
      <paramdef>resource
       <parameter><optional>link</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ingres_num_fields</function> returns the number of fields
     in the results returned by the Ingres server after a call to
     <function>ingres_query</function>
    </para>
    <para>
     See also
     <function>ingres_query</function>,
     <function>ingres_fetch_array</function>,
     <function>ingres_fetch_object</function> and
     <function>ingres_fetch_row</function>.     
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ingres-field-name">
   <refnamediv>
    <refname>ingres_field_name</refname>
    <refpurpose>Get the name of a field in a query result.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string<function>ingres_field_name</function></funcdef>
      <paramdef>int
       <parameter>index</parameter>
      </paramdef>
      <paramdef>resource
       <parameter><optional>link</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ingres_field_name</function> returns the name of a field
     in a query result, or false on failure.
    </para>
    <para>
     <parameter>index</parameter> is the number of the field and must be
     between 1 and the value given by
     <function>ingres_num_fields</function>.
    </para>
    <para>
     See also
     <function>ingres_query</function>,
     <function>ingres_fetch_array</function>,
     <function>ingres_fetch_object</function> and
     <function>ingres_fetch_row</function>.     
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ingres-field-type">
   <refnamediv>
    <refname>ingres_field_type</refname>
    <refpurpose>Get the type of a field in a query result.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string<function>ingres_field_type</function></funcdef>
      <paramdef>int
       <parameter>index</parameter>
      </paramdef>
      <paramdef>resource
       <parameter><optional>link</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ingres_field_type</function> returns the type of a field
     in a query result, or false on failure.
     Examples of types returned are "IIAPI_BYTE_TYPE",
     "IIAPI_CHA_TYPE", "IIAPI_DTE_TYPE", "IIAPI_FLT_TYPE",
     "IIAPI_INT_TYPE", "IIAPI_VCH_TYPE". Some of these types can map
     to more than one SQL type depending on the length of the field
     (see <function>ingres_field_length</function>). For example
     "IIAPI_FLT_TYPE" can be a float4 or a float8. For detailed
     information, see the Ingres/OpenAPI User Guide - Appendix C.
    </para>
    <para>
     <parameter>index</parameter> is the number of the field and must be
     between 1 and the value given by
     <function>ingres_num_fields</function>.
    </para>
    <para>
     See also
     <function>ingres_query</function>,
     <function>ingres_fetch_array</function>,
     <function>ingres_fetch_object</function> and
     <function>ingres_fetch_row</function>.     
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ingres-field-nullable">
   <refnamediv>
    <refname>ingres_field_nullable</refname>
    <refpurpose>Test if a field is nullable.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool<function>ingres_field_nullable</function></funcdef>
      <paramdef>int
       <parameter>index</parameter>
      </paramdef>
      <paramdef>resource
       <parameter><optional>link</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ingres_field_nullable</function> returns true if the field
     can be set to the NULL value and false if it can't.
    </para>
    <para>
     <parameter>index</parameter> is the number of the field and must be
     between 1 and the value given by
     <function>ingres_num_fields</function>.
    </para>
    <para>
     See also
     <function>ingres_query</function>,
     <function>ingres_fetch_array</function>,
     <function>ingres_fetch_object</function> and
     <function>ingres_fetch_row</function>.     
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ingres-field-length">
   <refnamediv>
    <refname>ingres_field_length</refname>
    <refpurpose>Get the length of a field.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int<function>ingres_field_length</function></funcdef>
      <paramdef>int
       <parameter>index</parameter>
      </paramdef>
      <paramdef>resource
       <parameter><optional>link</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ingres_field_length</function> returns the length of a field.
     This is the number of bytes used by the server to store the field.
     For detailed information, see the Ingres/OpenAPI User Guide - Appendix C.
    </para>
    <para>
     <parameter>index</parameter> is the number of the field and must be
     between 1 and the value given by
     <function>ingres_num_fields</function>.     
    </para>
    <para>
     See also
     <function>ingres_query</function>,
     <function>ingres_fetch_array</function>,
     <function>ingres_fetch_object</function> and
     <function>ingres_fetch_row</function>.     
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ingres-field-precision">
   <refnamediv>
    <refname>ingres_field_precision</refname>
    <refpurpose>Get the precision of a field.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int<function>ingres_field_precision</function></funcdef>
      <paramdef>int
       <parameter>index</parameter>
      </paramdef>
      <paramdef>resource
       <parameter><optional>link</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ingres_field_precision</function> returns the precision of
     a field. This value is used only for decimal, float and money SQL data
     types. For detailed information, see the Ingres/OpenAPI User Guide -
     Appendix C.
    </para>
    <para>
     <parameter>index</parameter> is the number of the field and must be
     between 1 and the value given by
     <function>ingres_num_fields</function>.     
    </para>
    <para>
     See also
     <function>ingres_query</function>,
     <function>ingres_fetch_array</function>,
     <function>ingres_fetch_object</function> and
     <function>ingres_fetch_row</function>.     
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ingres-field-scale">
   <refnamediv>
    <refname>ingres_field_scale</refname>
    <refpurpose>Get the scale of a field.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int<function>ingres_field_scale</function></funcdef>
      <paramdef>int
       <parameter>index</parameter>
      </paramdef>
      <paramdef>resource
       <parameter><optional>link</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ingres_field_scale</function> returns the scale of a field.
     This value is used only for the decimal SQL data type. For detailed
     information, see the Ingres/OpenAPI User Guide - Appendix C.
    </para>
    <para>
     <parameter>index</parameter> is the number of the field and must be
     between 1 and the value given by
     <function>ingres_num_fields</function>.     
    </para>
    <para>
     See also
     <function>ingres_query</function>,
     <function>ingres_fetch_array</function>,
     <function>ingres_fetch_object</function> and
     <function>ingres_fetch_row</function>.     
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ingres-fetch-array">
   <refnamediv>
    <refname>ingres_fetch_array</refname>
    <refpurpose>Fetch a row of result into an array.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array<function>ingres_fetch_array</function></funcdef>
      <paramdef>int
       <parameter><optional>result_type</optional></parameter>
      </paramdef>
      <paramdef>resource
       <parameter><optional>link</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ingres_fetch_array</function> Returns an array that corresponds
     to the fetched row, or false if there are no more rows.
    </para>
    <para>
     This function is an extended version of
     <function>ingres_fetch_row</function>.  In addition to storing the
     data in the numeric indices of the result array, it also stores
     the data in associative indices, using the field names as keys.
    </para>
    <para>
     If two or more columns of the result have the same field names,
     the last column will take precedence. To access the other column(s)
     of the same name, you must use the numeric index of the column or
     make an alias for the column.
     <informalexample>
      <programlisting>
ingres_query(select t1.f1 as foo t2.f1 as bar from t1, t2);
$result = ingres_fetch_array();
$foo = $result["foo"];
$bar = $result["bar"];
      </programlisting>
     </informalexample>
    </para>
    <para>
     <parameter>result_type</parameter> can be II_NUM for enumerated array,
     II_ASSOC for associative array, or II_BOTH (default).
    </para>
    <para>
     Speed-wise, the function is identical to
     <function>ingres_fetch_object</function>, and almost as quick as
     <function>ingres_fetch_row</function> (the difference is
     insignificant).
    </para>
    <para>
     <example>
      <title><function>ingres_fetch_array</function> example</title>
      <programlisting role="php">
&lt;?php 
ingres_connect ($database, $user, $password);

ingres_query ("select * from table");
while ($row = ingres_fetch_array()) {
    echo $row["user_id"];  # using associative array
    echo $row["fullname"];
    echo $row[1];          # using enumerated array
    echo $row[2];
}
?>
      </programlisting>
     </example>
    </para>
    <para>
     See also
     <function>ingres_query</function>,
     <function>ingres_num_fields</function>,
     <function>ingres_field_name</function>,
     <function>ingres_fetch_object</function> and
     <function>ingres_fetch_row</function>.     
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ingres-fetch-row">
   <refnamediv>
    <refname>ingres_fetch_row</refname>
    <refpurpose>Fetch a row of result into an enumerated array.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array<function>ingres_fetch_row</function></funcdef>
      <paramdef>resource
       <parameter><optional>link</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ingres_fetch_row</function> returns an array that corresponds
     to the fetched row, or false if there are no more rows. Each result
     column is stored in an array offset, starting at offset 1.
    </para>
    <para>
     Subsequent call to <function>ingres_fetch_row</function> would
     return the next row in the result set, or false if there are no
     more rows.
    </para>
    <para>
     <example>
      <title><function>ingres_fetch_row</function> example</title>
      <programlisting role="php">
&lt;?php 
ingres_connect ($database, $user, $password);

ingres_query ("select * from table");
while ($row = ingres_fetch_row()) {
    echo $row[1];
    echo $row[2];
}
?>
      </programlisting>
     </example>
    </para>
    <para>
     See also
     <function>ingres_num_fields</function>,
     <function>ingres_query</function>,
     <function>ingres_fetch_array</function> and
     <function>ingres_fetch_object</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ingres-fetch-object">
   <refnamediv>
    <refname>ingres_fetch_object</refname>
    <refpurpose>Fetch a row of result into an object.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>object<function>ingres_fetch_object</function></funcdef>
      <paramdef>int
       <parameter><optional>result_type</optional></parameter>
      </paramdef>
      <paramdef>resource
       <parameter><optional>link</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ingres_fetch_object</function> Returns an object that
     corresponds to the fetched row, or false if there are no more rows.
    </para>
    <para> 
     This function is similar to
     <function>ingres_fetch_array</function>, with one difference - an
     object is returned, instead of an array.  Indirectly, that means
     that you can only access the data by the field names, and not by
     their offsets (numbers are illegal property names).
    </para>
    <para>
     The optional argument <parameter>result_type</parameter> is a
     constant and can take the following values: II_ASSOC,
     II_NUM, and II_BOTH.
    </para>
    <para>
     Speed-wise, the function is identical to
     <function>ingres_fetch_array</function>, and almost as quick as
     <function>ingres_fetch_row</function> (the difference is
     insignificant).
    </para>
    <para>
     <example>
      <title><function>ingres_fetch_object</function> example</title>
      <programlisting role="php">
&lt;?php 
ingres_connect ($database, $user, $password);
ingres_query ("select * from table");
while ($row = ingres_fetch_object()) {
    echo $row->user_id;
    echo $row->fullname;
}
?>
      </programlisting>
     </example>
    </para>
    <para>
     See also
     <function>ingres_query</function>,
     <function>ingres_num_fields</function>,
     <function>ingres_field_name</function>,
     <function>ingres_fetch_array</function> and
     <function>ingres_fetch_row</function>.     
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ingres-rollback">
   <refnamediv>
    <refname>ingres_rollback</refname>
    <refpurpose>Roll back a transaction.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool<function>ingres_rollback</function></funcdef>
      <paramdef>resource
       <parameter><optional>link</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ingres_rollback</function> rolls back the currently open
     transaction, actualy canceling all changes made to the database
     during the transaction.
    </para>
    <para>
     This closes the transaction. A new one can be open by sending a
     query with <function>ingres_query</function>.
    </para>
    <para>
     See also
     <function>ingres_query</function>,
     <function>ingres_commit</function> and
     <function>ingres_autocommit</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ingres-commit">
   <refnamediv>
    <refname>ingres_commit</refname>
    <refpurpose>Commit a transaction.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool<function>ingres_commit</function></funcdef>
      <paramdef>resource
       <parameter><optional>link</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ingres_commit</function> commits the currently open
     transaction, making all changes made to the database permanent.
    </para>
    <para>
     This closes the transaction. A new one can be open by sending a
     query with <function>ingres_query</function>.
    </para>
    <para>
     You can also have the server commit automaticaly after every query
     by calling <function>ingres_autocommit</function> before opening the
     transaction.
    </para>
    <para>
     See also
     <function>ingres_query</function>,
     <function>ingres_rollback</function> and
     <function>ingres_autocommit</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ingres-autocommit">
   <refnamediv>
    <refname>ingres_autocommit</refname>
    <refpurpose>Switch autocommit on or off.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool<function>ingres_autocommit</function></funcdef>
      <paramdef>resource
       <parameter><optional>link</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ingres_autocommit</function> is called before opening a
     transaction (before the first call to <function>ingres_query</function>
     or just after a call to <function>ingres_rollback</function> or
     <function>ingres_autocommit</function>) to switch the "autocommit" mode
     of the server on or off (when the script begins the autocommit mode is
     off).
    </para>
    <para>
     When the autocommit mode is on, every query is automaticaly commited
     by the server, as if <function>ingres_commit</function> was called
     after every call to <function>ingres_query</function>.
    </para>
    <para>
     See also
     <function>ingres_query</function>,
     <function>ingres_rollback</function> and
     <function>ingres_commit</function>.
    </para>
   </refsect1>
  </refentry>

 </reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->


Index: phpdoc/kr/functions/ldap.xml
+++ phpdoc/kr/functions/ldap.xml
 <reference id="ref.ldap">
  <title>LDAP functions</title>
  <titleabbrev>LDAP</titleabbrev>

  <partintro>
   <sect1 id="ldap.intro">
    <title>Introduction to LDAP</title>
    <para>
     LDAP is the Lightweight Directory Access Protocol, and is a
     protocol used to access "Directory Servers".  The Directory is a
     special kind of database that holds information in a tree
     structure.  
    </para>
    <para> 
     The concept is similar to your hard disk directory structure,
     except that in this context, the root directory is "The world"
     and the first level subdirectories are "countries".  Lower levels
     of the directory structure contain entries for companies,
     organisations or places, while yet lower still we find directory
     entries for people, and perhaps equipment or documents.
    </para>
    <para>
     To refer to a file in a subdirectory on your hard disk, you might
     use something like
    </para>
    <literallayout>
    /usr/local/myapp/docs
    </literallayout>
    <para>
     The forwards slash marks each division in the reference, and the
     sequence is read from left to right.
    </para>
    <para> 
     The equivalent to the fully qualified file reference in LDAP is
     the "distinguished name", referred to simply as "dn".  An example
     dn might be.
    </para>
    <literallayout>
    cn=John Smith,ou=Accounts,o=My Company,c=US
    </literallayout>
    <para>
     The comma marks each division in the reference, and the sequence
     is read from right to left.  You would read this dn as ..
    </para>
    <literallayout>
    country = US
    organization = My Company
    organizationalUnit = Accounts
    commonName = John Smith
    </literallayout>
    <para>
     In the same way as there are no hard rules about how you organise
     the directory structure of a hard disk, a directory server
     manager can set up any structure that is meaningful for the
     purpose.  However, there are some conventions that are used.  The
     message is that you can not write code to access a directory
     server unless you know something about its structure, any more
     than you can use a database without some knowledge of what is
     available.
    </para>
   </sect1>

   <sect1 id="ldap-example">
    <title>Complete code example</title>
     <para>
      Retrieve information for all entries where the surname starts
      with "S" from a directory server, displaying an extract with
      name and email address.
     </para>

    <example>
     <title>LDAP search example</title>
<programlisting role="php">
&lt;?php
// basic sequence with LDAP is connect, bind, search, interpret search
// result, close connection

echo "&lt;h3>LDAP query test&lt;/h3>";
echo "Connecting ...";
$ds=ldap_connect("localhost");  // must be a valid LDAP server!
echo "connect result is ".$ds."&lt;p>";

if ($ds) { 
    echo "Binding ..."; 
    $r=ldap_bind($ds);     // this is an "anonymous" bind, typically
                           // read-only access
    echo "Bind result is ".$r."&lt;p>";

    echo "Searching for (sn=S*) ...";
    // Search surname entry
    $sr=ldap_search($ds,"o=My Company, c=US", "sn=S*");  
    echo "Search result is ".$sr."&lt;p>";

    echo "Number of entires returned is ".ldap_count_entries($ds,$sr)."&lt;p>";

    echo "Getting entries ...&lt;p>";
    $info = ldap_get_entries($ds, $sr);
    echo "Data for ".$info["count"]." items returned:&lt;p>";

    for ($i=0; $i&lt;$info["count"]; $i++) {
        echo "dn is: ". $info[$i]["dn"] ."&lt;br>";
        echo "first cn entry is: ". $info[$i]["cn"][0] ."&lt;br>";
        echo "first email entry is: ". $info[$i]["mail"][0] ."&lt;p>";
    }

    echo "Closing connection";
    ldap_close($ds);

} else {
    echo "&lt;h4>Unable to connect to LDAP server&lt;/h4>";
}
?>
</programlisting>
    </example>

   <sect2 id="ldap.using">
    <title>Using the PHP LDAP calls</title>
     <para>
      You will need to get and compile LDAP client libraries from
      either the University of Michigan ldap-3.3 package or the
      Netscape Directory SDK 3.0.  You will also need to recompile PHP
      with LDAP support enabled before PHP's LDAP calls will work.
     </para><para>
      Before you can use the LDAP calls you will need to know ..

    <itemizedlist>
     <listitem>
      <para>
       The name or address of the directory server you will use
      </para>
     </listitem>
     <listitem>
      <para>
       The "base dn" of the server (the part of the world directory
       that is held on this server, which could be "o=My
       Company,c=US")
      </para>
     </listitem>
     <listitem>
      <para>
       Whether you need a password to access the server (many servers
       will provide read access for an "anonymous bind" but require a
       password for anything else)
      </para>
     </listitem>
    </itemizedlist></para>

     <para>
      The typical sequence of LDAP calls you will make in an
      application will follow this pattern:
<literallayout>
  ldap_connect()    // establish connection to server
     |
  ldap_bind()       // anonymous or authenticated "login"
     |
  do something like search or update the directory
  and display the results
     |
  ldap_close()      // "logout"
</literallayout></para>
   </sect2>


   <sect2 id="ldap.moreinfo">
    <title>More Information</title>
     <para>
      Lots of information about LDAP can be found at
     </para>

    <itemizedlist>
     <listitem>
      <para>
       <ulink url="&url.ldap.netscape;">Netscape</ulink>
      </para>
     </listitem>
     <listitem>
      <para>
       <ulink url="&url.ldap.michigan;">University of Michigan</ulink>
      </para>
     </listitem>
     <listitem>
      <para>
       <ulink url="&url.ldap.openldap;">OpenLDAP Project</ulink>
      </para>
     </listitem>
     <listitem>
      <para>
       <ulink url="&url.ldap.ldapworld;">LDAP World</ulink>
      </para>
     </listitem>
    </itemizedlist>

     <para>    
      The Netscape SDK contains a helpful Programmer's Guide in .html
      format.
     </para>
   </sect2>
  </sect1>

  </partintro>


  <refentry id="function.ldap-add">
   <refnamediv>
    <refname>ldap_add</refname>
    <refpurpose>Add entries to LDAP directory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ldap_add</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>string <parameter>dn</parameter></paramdef>
      <paramdef>array <parameter>entry</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     returns true on success and false on error.  
    </para><para> 
     The <function>ldap_add</function> function is used to add entries
     in the LDAP directory. The DN of the entry to be added is
     specified by dn. Array entry specifies the information about the
     entry. The values in the entries are indexed by individual
     attributes. In case of multiple values for an attribute, they are
     indexed using integers starting with 0.
    </para>
    <informalexample>
<literallayout>
    entry["attribute1"] = value
    entry["attribute2"][0] = value1
    entry["attribute2"][1] = value2
</literallayout>
     </informalexample>
     <example>
      <title>Complete example with authenticated bind</title>
<programlisting role="php">
&lt;?php
$ds=ldap_connect("localhost");  // assuming the LDAP server is on this host

if ($ds) {
    // bind with appropriate dn to give update access
    $r=ldap_bind($ds,"cn=root, o=My Company, c=US", "secret");

    // prepare data
    $info["cn"]="John Jones";
    $info["sn"]="Jones";
    $info["mail"]="[EMAIL PROTECTED]";
    $info["objectclass"]="person";

    // add data to directory
    $r=ldap_add($ds, "cn=John Jones, o=My Company, c=US", $info);

    ldap_close($ds);
} else {
    echo "Unable to connect to LDAP server"; 
}
?>
</programlisting>
     </example>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-bind">
   <refnamediv>
    <refname>ldap_bind</refname>
    <refpurpose>Bind to LDAP directory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ldap_bind</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>string <parameter><optional>bind_rdn</optional></parameter></paramdef>
      <paramdef>string 
<parameter><optional>bind_password</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Binds to the LDAP directory with specified RDN and
     password. Returns true on success and false on error.</para>
    <para>  
     <function>ldap_bind</function> does a bind operation on the
     directory. bind_rdn and bind_password are optional. If not
     specified, anonymous bind is attempted.</para>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-close">
   <refnamediv>
    <refname>ldap_close</refname>
    <refpurpose>Close link to LDAP server</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ldap_close</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on error.</para> 
    <para>
     <function>ldap_close</function> closes the link to the LDAP
     server that's associated with the specified
     <parameter>link_identifier</parameter>.</para>
    <para>
     This call is internally identical to
     <function>ldap_unbind</function>. The LDAP API uses the call
     <function>ldap_unbind</function>, so perhaps you should use this
     in preference to <function>ldap_close</function>.</para>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-compare">
   <refnamediv>
    <refname>ldap_compare</refname>
    <refpurpose>Compare value of attribute found in entry specified with 
DN</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ldap_compare</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>string <parameter>dn</parameter></paramdef>
      <paramdef>string <parameter>attribute</parameter></paramdef>
      <paramdef>string <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns true if <parameter>value</parameter> matches otherwise returns false. 
Returns -1 on error.
    </simpara>
    <para>
     <function>ldap_compare</function> is used to compare <parameter>value</parameter>
      of <parameter>attribute</parameter> to value of same attribute in LDAP directory 
      entry specified with <parameter>dn</parameter>. 
    </para>
    <simpara>
     The following example demonstrates how to check whether or not given password 
matches
     the one defined in DN specified entry. 
    </simpara>
    <example>
    <title>Complete example of password check</title>
     <programlisting role="php">
&lt;?php

$ds=ldap_connect("localhost");  // assuming the LDAP server is on this host
      
if ($ds) {

    // bind 
    if(ldap_bind($ds)) {

        // prepare data
        $dn = "cn=Matti Meikku, ou=My Unit, o=My Company, c=FI";
        $value = "secretpassword";
        $attr = "password"; 

        // compare value
        $r=ldap_compare($ds, $dn, $attr, $value);

        if ($r === -1) {
            echo "Error: ".ldap_error($ds);
        } elseif ($r === TRUE) {
            echo "Password correct.";
        } elseif ($r === FALSE) {
            echo "Wrong guess! Password incorrect.";
        }

    } else {
        echo "Unable to bind to LDAP server.";
    }          

    ldap_close($ds);

} else {
    echo "Unable to connect to LDAP server.";
}
?&gt;

     </programlisting>
    </example>  
    <note>
     <para>
      <function>ldap_compare</function> can NOT be used to compare BINARY values!
     </para>
    </note>
    <note>
     <para>
      This function was added in 4.0.2. 
     </para>
    </note>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-connect">
   <refnamediv>
    <refname>ldap_connect</refname>
    <refpurpose>Connect to an LDAP server</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ldap_connect</function></funcdef>
      <paramdef>string <parameter><optional>hostname</optional></parameter></paramdef>
      <paramdef>int <parameter><optional>port</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a positive LDAP link identifier on success, or false on
     error.</para>  
    <para> 
     <function>ldap_connect</function> establishes a connection to a
     LDAP server on a specified <parameter>hostname</parameter> and
     <parameter>port</parameter>.  Both the arguments are optional. If
     no arguments are specified then the link identifier of the
     already opened link will be returned. If only
     <parameter>hostname</parameter> is specified, then the port
     defaults to 389.</para>
    <para>
     If you are using OpenLDAP 2.x.x you can specify a URL instead of the
     hostname. To use LDAP with SSL, compile OpenLDAP 2.x.x with SSL
     support, configure PHP with SSL, and use ldaps://hostname/ as
     host parameter. The port parameter is not used when using URLs.
     URL and SSL support were added in 4.0.4.</para>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-count-entries">
   <refnamediv>
    <refname>ldap_count_entries</refname>
    <refpurpose>Count the number of entries in a search</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ldap_count_entries</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>int <parameter>result_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns number of entries in the result or false on error.</para>
    <para>  
     <function>ldap_count_entries</function> returns the number of
     entries stored in the result of previous search
     operations. <parameter>result_identifier</parameter> identifies
     the internal ldap result.</para>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-delete">
   <refnamediv>
    <refname>ldap_delete</refname>
    <refpurpose>Delete an entry from a directory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ldap_delete</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>string <parameter>dn</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success and false on error.</para>  
    <para>
     <function>ldap_delete</function> function delete a particular
     entry in LDAP directory specified by dn.</para>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-dn2ufn">
   <refnamediv>
    <refname>ldap_dn2ufn</refname>
    <refpurpose>Convert DN to User Friendly Naming format</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ldap_dn2ufn</function></funcdef>
      <paramdef>string <parameter>dn</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ldap_dn2ufn</function> function is used to turn a DN
     into a more user-friendly form, stripping off type names.</para>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-err2str">
   <refnamediv>
    <refname>ldap_err2str</refname>
    <refpurpose>
     Convert LDAP error number into string error message
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ldap_err2str</function></funcdef>
      <paramdef>int <parameter>errno</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     returns string error message.</para>
    <para>
     This function returns the string error message explaining the
     error number errno. While LDAP errno numbers are standardized,
     different libraries return different or even localized textual
     error messages. Never check for a specific error message text,
     but always use an error number to check.</para>
    <para>
     See also <function>ldap_errno</function> and
     <function>ldap_error</function>.

    <example>
     <title>Enumerating all LDAP error messages</title>
<programlisting role="php">
&lt;?php
  for($i=0; $i&lt;100; $i++) {
    printf("Error $i: %s&lt;br>\n", ldap_err2str($i));
  }
?>
</programlisting>
    </example></para>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-errno">
   <refnamediv>
    <refname>ldap_errno</refname>
    <refpurpose>
     Return the LDAP error number of the last LDAP command
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ldap_errno</function></funcdef>
      <paramdef>int <parameter>link_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     return the LDAP error number of the last LDAP command for this
     link.</para>
    <para>
     This function returns the standardized error number returned by
     the last LDAP command for the given link identifier. This number
     can be converted into a textual error message using
     <function>ldap_err2str</function>.</para>
    <para>
     Unless you lower your warning level in your php3.ini sufficiently
     or prefix your LDAP commands with @ (at) characters to suppress
     warning output, the errors generated will also show up in your
     HTML output.
     <example>
      <title>Generating and catching an error</title>
<programlisting role="php">
&lt;?php
// This example contains an error, which we will catch.
$ld = ldap_connect("localhost");
$bind = ldap_bind($ld);
// syntax error in filter expression (errno 87),
// must be "objectclass=*" to work.
$res =  @ldap_search($ld, "o=Myorg, c=DE", "objectclass");
if (!$res) {
    printf("LDAP-Errno: %s&lt;br>\n", ldap_errno($ld));
    printf("LDAP-Error: %s&lt;br>\n", ldap_error($ld));
    die("Argh!&lt;br>\n");
}
$info = ldap_get_entries($ld, $res);
printf("%d matching entries.&lt;br>\n", $info["count"]);
?>
</programlisting>
    </example></para>
    <para>
     see also <function>ldap_err2str</function> and
     <function>ldap_error</function>.</para>
   </refsect1>
  </refentry>
  

  <refentry id="function.ldap-error">
   <refnamediv>
    <refname>ldap_error</refname>
    <refpurpose>
     Return the LDAP error message of the last LDAP command
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ldap_error</function></funcdef>
      <paramdef>int <parameter>link_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     returns string error message.</para>
    <para>
     This function returns the string error message explaining the
     error generated by the last LDAP command for the given link
     identifier. While LDAP errno numbers are standardized, different
     libraries return different or even localized textual error
     messages. Never check for a specific error message text, but
     always use an error number to check.</para>
    <para>
     Unless you lower your warning level in your
     <filename>php3.ini</filename> sufficiently or prefix your LDAP
     commands with <literal>@</literal> (at) characters to suppress
     warning output, the errors generated will also show up in your
     HTML output.</para>
    <para>
     see also <function>ldap_err2str</function> and
     <function>ldap_errno</function>.</para>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-explode-dn">
   <refnamediv>
    <refname>ldap_explode_dn</refname>
    <refpurpose>Splits DN into its component parts</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>ldap_explode_dn</function></funcdef>
      <paramdef>string <parameter>dn</parameter></paramdef>
      <paramdef>int <parameter>with_attrib</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ldap_explode_dn</function> function is used to split
     the a DN returned by <function>ldap_get_dn</function> and breaks
     it up into its component parts. Each part is known as Relative
     Distinguished Name, or RDN.  <function>ldap_explode_dn</function>
     returns an array of all those components.
     <parameter>with_attrib</parameter> is used to request if the RDNs
     are returned with only values or their attributes as well.  To
     get RDNs with the attributes (i.e. in attribute=value format) set
     <parameter>with_attrib</parameter> to 0 and to get only values
     set it to 1.</para>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-first-attribute">
   <refnamediv>
    <refname>ldap_first_attribute</refname>
    <refpurpose>Return first attribute</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ldap_first_attribute</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>int <parameter>result_entry_identifier</parameter></paramdef>
      <paramdef>int <parameter>ber_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the first attribute in the entry on success and false on
     error.
    </para> 
    <para> 
     Similar to reading entries, attributes are also read one by one
     from a particular entry.
     <function>ldap_first_attribute</function> returns the first
     attribute in the entry pointed by the entry identifier.
     Remaining attributes are retrieved by calling
     <function>ldap_next_attribute</function> successively.
     <parameter>ber_identifier</parameter> is the identifier to
     internal memory location pointer. It is passed by reference. The
     same <parameter>ber_identifier</parameter> is passed to the
     <function>ldap_next_attribute</function> function, which modifies
     that pointer.
    </para>
    <para>
     see also <function>ldap_get_attributes</function></para>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-first-entry">
   <refnamediv>
    <refname>ldap_first_entry</refname>
    <refpurpose>Return first result id</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ldap_first_entry</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>int <parameter>result_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the result entry identifier for the first entry on
     success and false on error.</para>
    <para>  
     Entries in the LDAP result are read sequentially using the
     <function>ldap_first_entry</function> and
     <function>ldap_next_entry</function>
     functions. <function>ldap_first_entry</function> returns the
     entry identifier for first entry in the result. This entry
     identifier is then supplied to
     <function>lap_next_entry</function> routine to get successive
     entries from the result.</para>
    <para>
     see also <function>ldap_get_entries</function>.</para>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-free-result">
   <refnamediv>
    <refname>ldap_free_result</refname>
    <refpurpose>Free result memory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ldap_free_result</function></funcdef>
      <paramdef>int <parameter>result_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success and false on error.</para>
    <para>  
     <function>ldap_free_result</function> frees up the memory
     allocated internally to store the result and pointed by the
     <parameter>result_identifier</parameter>. All result memory will
     be automatically freed when the script terminates.</para>
    <para>
     Typically all the memory allocated for the ldap result gets freed
     at the end of the script. In case the script is making successive
     searches which return large result sets,
     <function>ldap_free_result</function> could be called to keep the
     runtime memory usage by the script low.</para>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-get-attributes">
   <refnamediv>
    <refname>ldap_get_attributes</refname>
    <refpurpose>Get attributes from a search result entry</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>ldap_get_attributes</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>int
      <parameter>result_entry_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a complete entry information in a multi-dimensional array
     on success and false on error.</para>  
    <para>
     <function>ldap_get_attributes</function> function is used to
     simplify reading the attributes and values from an entry in the
     search result. The return value is a multi-dimensional array of
     attributes and values.</para>
    <para>
     Having located a specific entry in the directory, you can find
     out what information is held for that entry by using this
     call. You would use this call for an application which "browses"
     directory entries and/or where you do not know the structure of
     the directory entries. In many applications you will be searching
     for a specific attribute such as an email address or a surname,
     and won't care what other data is held.</para>
    <para>
     <informalexample><literallayout>
return_value["count"] = number of attributes in the entry
return_value[0] = first attribute
return_value[n] = nth attribute

return_value["attribute"]["count"] = number of values for attribute
return_value["attribute"][0] = first value of the attribute
return_value["attribute"][i] = ith value of the attribute
</literallayout></informalexample>

    <example>
     <title>Show the list of attributes held for a particular directory
     entry </title>
<programlisting role="php">
// $ds is the link identifier for the directory

// $sr is a valid search result from a prior call to
// one of the ldap directory search calls

$entry = ldap_first_entry($ds, $sr);

$attrs = ldap_get_attributes($ds, $entry);

echo $attrs["count"]." attributes held for this entry:&lt;p>";

for ($i=0; $i&lt;$attrs["count"]; $i++)
    echo $attrs[$i]."&lt;br>";
</programlisting>
</example></para>

     <para>
      see also <function>ldap_first_attribute</function> and
      <function>ldap_next_attribute</function></para>

   </refsect1>
  </refentry>


  <refentry id="function.ldap-get-dn">
   <refnamediv>
    <refname>ldap_get_dn</refname>
    <refpurpose>Get the DN of a result entry</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ldap_get_dn</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>int <parameter>result_entry_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the DN of the result entry and false on error.</para>  
    <para>
     <function>ldap_get_dn</function> function is used to find out the
     DN of an entry in the result.</para>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-get-entries">
   <refnamediv>
    <refname>ldap_get_entries</refname>
    <refpurpose>Get all result entries</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>ldap_get_entries</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>int <parameter>result_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a complete result information in a multi-dimenasional
     array on success and false on error.</para>
    <para>  
     <function>ldap_get_entries</function> function is used to
     simplify reading multiple entries from the result and then
     reading the attributes and multiple values. The entire
     information is returned by one function call in a
     multi-dimensional array. The structure of the array is as
     follows.</para>
    <para>
     The attribute index is converted to lowercase. (Attributes are
     case-insensitive for directory servers, but not when used as
     array indices)

    <informalexample>
<literallayout>
return_value["count"] = number of entries in the result
return_value[0] : refers to the details of first entry

return_value[i]["dn"] =  DN of the ith entry in the result

return_value[i]["count"] = number of attributes in ith entry
return_value[i][j] = jth attribute in the ith entry in the result

return_value[i]["attribute"]["count"] = number of values for 
    attribute in ith entry
return_value[i]["attribute"][j] = jth value of attribute in ith entry
</literallayout>
    </informalexample></para>
    
     <para>
      see also <function>ldap_first_entry</function> and
      <function>ldap_next_entry</function></para>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-get-option">
   <refnamediv>
    <refname>ldap_get_option</refname>
    <refpurpose>Get the current value for given option</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>ldap_get_option</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>int <parameter>option</parameter></paramdef>
      <paramdef>mixed <parameter>retval</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets <parameter>retval</parameter> to the value of the specified option,
     and returns true on success and false on error.</para>  
    <para>
     The parameter <parameter>option</parameter> can be one of:
     LDAP_OPT_DEREF, LDAP_OPT_SIZELIMIT, LDAP_OPT_TIMELIMIT,
     LDAP_OPT_PROTOCOL_VERSION, LDAP_OPT_ERROR_NUMBER, LDAP_OPT_REFERRALS,
     LDAP_OPT_RESTART, LDAP_OPT_HOST_NAME, LDAP_OPT_ERROR_STRING,
     LDAP_OPT_MATCHED_DN. These are described in 
     <ulink 
url="&url.ldap.openldap-c-api;">draft-ietf-ldapext-ldap-c-api-xx.txt</ulink>
     </para>
    <para>This function is only available when using OpenLDAP 2.x.x OR Netscape 
Directory SDK x.x, and was
     added in PHP 4.0.4</para>

     <para>
     <example>
      <title>Check protocol version</title>
<programlisting role="php">
// $ds is a valid link identifier for a directory server
if (ldap_get_option($ds, LDAP_OPT_PROTOCOL_VERSION, $version))
    echo "Using protocol version $version";
else
    echo "Unable to determine protocol version";
</programlisting>
     </example>
     </para>

     <para>
      See also <function>ldap_set_option</function>.</para>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-get-values">
   <refnamediv>
    <refname>ldap_get_values</refname>
    <refpurpose>Get all values from a result entry</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>ldap_get_values</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>int <parameter>result_entry_identifier</parameter></paramdef>
      <paramdef>string <parameter>attribute</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of values for the attribute on success and false
     on error.</para>
    <para>  
     <function>ldap_get_values</function> function is used to read all
     the values of the attribute in the entry in the result. entry is
     specified by the
     <parameter>result_entry_identifier</parameter>. The number of
     values can be found by indexing "count" in the resultant
     array. Individual values are accessed by integer index in the
     array.  The first index is 0.</para>  
    <para>
     This call needs a <parameter>result_entry_identifier</parameter>,
     so needs to be preceded by one of the ldap search calls and one
     of the calls to get an individual entry.</para>
    <para>
     You application will either be hard coded to look for certain
     attributes (such as "surname" or "mail") or you will have to use
     the <function>ldap_get_attributes</function> call to work out
     what attributes exist for a given entry.</para>
    <para>
     LDAP allows more than one entry for an attribute, so it can, for
     example, store a number of email addresses for one person's
     directory entry all labeled with the attribute "mail"

    <informalexample>
<literallayout>
return_value["count"] = number of values for attribute
return_value[0] = first value of attribute
return_value[i] = ith value of attribute
</literallayout>
    </informalexample>

     <example>
      <title>List all values of the "mail" attribute for a 
       directory entry </title>
<programlisting role="php">
// $ds is a valid link identifier for a directory server

// $sr is a valid search result from a prior call to
//     one of the ldap directory search calls

// $entry is a valid entry identifier from a prior call to
//        one of the calls that returns a directory entry

$values = ldap_get_values($ds, $entry,"mail");

echo $values["count"]." email addresses for this entry.&lt;p>";

for ($i=0; $i &lt; $values["count"]; $i++)
    echo $values[$i]."&lt;br>";
</programlisting>
     </example></para>

   </refsect1>
  </refentry>


  <refentry id="function.ldap-get-values-len">
   <refnamediv>
    <refname>ldap_get_values_len</refname>
    <refpurpose>Get all binary values from a result entry</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>ldap_get_values_len</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>int <parameter>result_entry_identifier</parameter></paramdef>
      <paramdef>string <parameter>attribute</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of values for the attribute on success and false
     on error.</para>
    <para>  
     <function>ldap_get_values_len</function> function is used to read all
     the values of the attribute in the entry in the result. entry is
     specified by the
     <parameter>result_entry_identifier</parameter>. The number of
     values can be found by indexing "count" in the resultant
     array. Individual values are accessed by integer index in the
     array.  The first index is 0.</para>
    <para>
     This function is used exactly like
     <function>ldap_get_values</function> except that it handles
     binary data and not string data.</para>
    <note>
     <para>
      This function was added in 4.0.
     </para>
    </note>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-list">
   <refnamediv>
    <refname>ldap_list</refname>
    <refpurpose>Single-level search</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ldap_list</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>string <parameter>base_dn</parameter></paramdef>
      <paramdef>string <parameter>filter</parameter></paramdef>
      <paramdef>array
       <parameter><optional>attributes</optional></parameter></paramdef>
      <paramdef>int 
       <parameter><optional>attrsonly</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>sizelimit</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>timelimit</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>deref</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a search result identifier or false on error.</para>  
    <para>
     <function>ldap_list</function> performs the search for a specified
     filter on the directory with the scope LDAP_SCOPE_ONELEVEL.</para>
    <para>
     LDAP_SCOPE_ONELEVEL means that the search should only return
     information that is at the level immediately below the base dn
     given in the call. (Equivalent to typing "ls" and getting a list
     of files and folders in the current working directory.)</para>
    <para>
     This call takes 5 optional parameters. See <function>ldap_search</function>
     notes.
    <note>
     <para>
       These optional parameters were added in 4.0.2:
      <parameter>attrsonly</parameter>,
      <parameter>sizelimit</parameter>,
      <parameter>timelimit</parameter>,
      <parameter>deref</parameter>.
     </para>
    </note>

    <example>
      <title>Produce a list of all organizational units of an organization 
       </title>
<programlisting role="php3">
// $ds is a valid link identifier for a directory server

$basedn = "o=My Company, c=US";
$justthese = array("ou");

$sr=ldap_list($ds, $basedn, "ou=*", $justthese);

$info = ldap_get_entries($ds, $sr);

for ($i=0; $i&lt;$info["count"]; $i++)
    echo $info[$i]["ou"][0] ;
</programlisting>
</example></para>
  </refsect1>
  </refentry>


  <refentry id="function.ldap-modify">
   <refnamediv>
    <refname>ldap_modify</refname>
    <refpurpose>Modify an LDAP entry</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ldap_modify</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>string <parameter>dn</parameter></paramdef>
      <paramdef>array <parameter>entry</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success and false on error.</para>  
    <para>
     <function>ldap_modify</function> function is used to modify the
     existing entries in the LDAP directory. The structure of the
     entry is same as in <function>ldap_add</function>.</para>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-mod-add">
   <refnamediv>
    <refname>ldap_mod_add</refname>
    <refpurpose>Add attribute values to current attributes</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ldap_mod_add</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>string <parameter>dn</parameter></paramdef>
      <paramdef>array <parameter>entry</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     returns true on success and false on error.</para>  
    <para>
     This function adds attribute(s) to the specified dn.  It
     performs the modification at the attribute level as opposed to the 
     object level.  Object-level additions are done by the 
    <function>ldap_add</function> function.</para>
   </refsect1>
  </refentry>

  <refentry id="function.ldap-mod-del">
   <refnamediv>
    <refname>ldap_mod_del</refname>
    <refpurpose>Delete attribute values from current attributes</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ldap_mod_del</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>string <parameter>dn</parameter></paramdef>
      <paramdef>array <parameter>entry</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     returns true on success and false on error.</para>  
    <para>
     This function removes attribute(s) from the specified dn.  It
     performs the modification at the attribute level as opposed to the 
     object level.  Object-level deletions are done by the 
    <function>ldap_del</function> function.</para>
   </refsect1>
  </refentry>

  <refentry id="function.ldap-mod-replace">
   <refnamediv>
    <refname>ldap_mod_replace</refname>
    <refpurpose>Replace attribute values with new ones</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ldap_mod_replace</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>string <parameter>dn</parameter></paramdef>
      <paramdef>array <parameter>entry</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     returns true on success and false on error.</para>  
    <para>
     This function replaces attribute(s) from the specified dn.  It
     performs the modification at the attribute level as opposed to the 
     object level.  Object-level modifications are done by the 
    <function>ldap_modify</function> function.</para>
   </refsect1>
  </refentry>

  <refentry id="function.ldap-next-attribute">
   <refnamediv>
    <refname>ldap_next_attribute</refname>
    <refpurpose>Get the next attribute in result</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ldap_next_attribute</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>int <parameter>result_entry_identifier</parameter></paramdef>
      <paramdef>int <parameter>ber_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the next attribute in an entry on success and false on
     error.</para>
    <para>  
     <function>ldap_next_attribute</function> is called to retrieve
     the attributes in an entry.  The internal state of the pointer is
     maintained by the <parameter>ber_identifier</parameter>.  It is
     passed by reference to the function. The first call to
     <function>ldap_next_attribute</function> is made with the
     <parameter>result_entry_identifier</parameter> returned from
     <function>ldap_first_attribute</function>.</para>
    <para>
     see also <function>ldap_get_attributes</function></para>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-next-entry">
   <refnamediv>
    <refname>ldap_next_entry</refname>
    <refpurpose>Get next result entry</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ldap_next_entry</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>int <parameter>result_entry_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns entry identifier for the next entry in the result whose
     entries are being read starting with
     <function>ldap_first_entry</function>. If there are no more
     entries in the result then it returns false.</para>
    <para>  
     <function>ldap_next_entry</function> function is used to retrieve
     the entries stored in the result. Successive calls to the
     <function>ldap_next_entry</function> return entries one by one
     till there are no more entries. The first call to
     <function>ldap_next_entry</function> is made after the call to
     <function>ldap_first_entry</function> with the result_identifier
     as returned from the <function>ldap_first_entry</function>.</para>
    <para>
     see also <function>ldap_get_entries</function></para>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-read">
   <refnamediv>
    <refname>ldap_read</refname>
    <refpurpose>Read an entry</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ldap_read</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>string <parameter>base_dn</parameter></paramdef>
      <paramdef>string <parameter>filter</parameter></paramdef>
      <paramdef>array 
       <parameter><optional>attributes</optional></parameter></paramdef>
      <paramdef>int 
       <parameter><optional>attrsonly</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>sizelimit</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>timelimit</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>deref</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a search result identifier or false on error.</para>
    <para>  
     <function>ldap_read</function> performs the search for a
     specified filter on the directory with the scope
     LDAP_SCOPE_BASE. So it is equivalent to reading an entry from the
     directory.</para>
    <para>
     An empty filter is not allowed. If you want to retrieve
     absolutely all information for this entry, use a filter of
     "objectClass=*". If you know which entry types are used on the
     directory server, you might use an appropriate filter such as
     "objectClass=inetOrgPerson".</para>
    <para>
     This call takes 5 optional parameters. See <function>ldap_search</function>
     notes.
    </para>
    <note>
     <para>
      These optional parameters were added in 4.0.2:
      <parameter>attrsonly</parameter>,
      <parameter>sizelimit</parameter>,
      <parameter>timelimit</parameter>,
      <parameter>deref</parameter>.
     </para>
    </note>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-search">
   <refnamediv>
    <refname>ldap_search</refname>
    <refpurpose>Search LDAP tree</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ldap_search</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>string <parameter>base_dn</parameter></paramdef>
      <paramdef>string <parameter>filter</parameter></paramdef>
      <paramdef>array 
       <parameter><optional>attributes</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>attrsonly</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>sizelimit</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>timelimit</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>deref</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a search result identifier or false on error.</para>
    <para>  
     <function>ldap_search</function> performs the search for a
     specified filter on the directory with the scope of
     LDAP_SCOPE_SUBTREE. This is equivalent to searching the entire
     directory. <parameter>base_dn</parameter> specifies the base DN
     for the directory.</para>
    <para>
     There is a optional fourth parameter, that can be added to
     restrict the attributes and values returned by the server to just
     those required. This is much more efficient than the default
     action (which is to return all attributes and their associated
     values). The use of the fourth parameter should therefore be
     considered good practice.</para>
    <para>
     The fourth parameter is a standard PHP string array of the
     required attributes, eg array("mail","sn","cn") Note that the
     "dn" is always returned irrespective of which attributes types
     are requested.</para>
    <para>
     Note too that some directory server hosts will be configured to
     return no more than a preset number of entries. If this occurs,
     the server will indicate that it has only returned a partial
     results set. This occurs also if the sixth parameter 
     <parameter>sizelimit</parameter> has been used to limit the count 
     of fetched entries.
    </para> 
    <para>
     The fifth parameter <parameter>attrsonly</parameter> should be 
     set to 1 if only attribute types are wanted. 
     If set to 0 both attributes types and attribute values are fetched
     which is the default behaviour.
    </para> 
    <para>
     With the sixth parameter <parameter>sizelimit</parameter> it is 
     possible to limit the count of entries fetched. 
     Setting this to 0 means no limit. 
     NOTE: This parameter can NOT override server-side preset sizelimit. 
     You can set it lower though.
    </para> 
    <para>
     The seventh parameter <parameter>timelimit</parameter> sets the number 
     of seconds how long is spend on the search. 
     Setting this to 0 means no limit.
     NOTE: This parameter can NOT override server-side preset timelimit. 
     You can set it lower though.
    </para> 
    <para>
     The eigth parameter <parameter>deref</parameter> specifies how aliases 
     should be handled during the search. It can be one of the following:
     <itemizedlist>
     <listitem>
      <simpara>
       LDAP_DEREF_NEVER - (default) aliases are never dereferenced.
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       LDAP_DEREF_SEARCHING - aliases should be dereferenced during the search
       but not when locating the base object of the search.
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       LDAP_DEREF_FINDING - aliases should be dereferenced when 
       locating the base object but not during the search.
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       LDAP_DEREF_ALWAYS - aliases should be dereferenced always.
      </simpara>
     </listitem>
     </itemizedlist>
    </para>  
    <para>
      These optional parameters were added in 4.0.2:
      <parameter>attrsonly</parameter>,
      <parameter>sizelimit</parameter>,
      <parameter>timelimit</parameter>,
      <parameter>deref</parameter>.
    </para>
    <para>
     The search filter can be simple or advanced, using boolean
     operators in the format described in the LDAP doumentation (see
     the <ulink url="&url.ldap.filters;">Netscape Directory SDK</ulink>
     for full information on filters).</para>
    <para>
     The example below retrieves the organizational unit, surname,
     given name and email address for all people in "My Company" where
     the surname or given name contains the substring $person. This
     example uses a boolean filter to tell the server to look for
     information in more than one attribute.

     <example>
      <title>LDAP search</title>
<programlisting role="php">
// $ds is a valid link identifier for a directory server

// $person is all or part of a person's name, eg "Jo"

$dn = "o=My Company, c=US";
$filter="(|(sn=$person*)(givenname=$person*))";
$justthese = array( "ou", "sn", "givenname", "mail");

$sr=ldap_search($ds, $dn, $filter, $justthese);

$info = ldap_get_entries($ds, $sr);

print $info["count"]." entries returned&lt;p>";
</programlisting>
      </example></para>

   </refsect1>
  </refentry>


  <refentry id="function.ldap-set-option">
   <refnamediv>
    <refname>ldap_set_option</refname>
    <refpurpose>Set the value of the given option</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>ldap_set_option</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
      <paramdef>int <parameter>option</parameter></paramdef>
      <paramdef>mixed <parameter>newval</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets the value of the specified option to be
     <parameter>newval</parameter>, and returns true on success and false
     on error.</para>  
    <para>
     The parameter <parameter>option</parameter> can be one of:
     LDAP_OPT_DEREF, LDAP_OPT_SIZELIMIT, LDAP_OPT_TIMELIMIT,
     LDAP_OPT_PROTOCOL_VERSION, LDAP_OPT_ERROR_NUMBER, LDAP_OPT_REFERRALS,
     LDAP_OPT_RESTART, LDAP_OPT_HOST_NAME, LDAP_OPT_ERROR_STRING,
     LDAP_OPT_MATCHED_DN. These are described in 
     <ulink 
url="&url.ldap.openldap-c-api;">draft-ietf-ldapext-ldap-c-api-xx.txt</ulink></para>
    <para>This function is only available when using OpenLDAP 2.x.x OR Netscape 
Directory SDK x.x, and was
     added in PHP 4.0.4</para>

     <para>
     <example>
      <title>Set protocol version</title>
<programlisting role="php">
// $ds is a valid link identifier for a directory server
if (ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3))
    echo "Using LDAPv3";
else
    echo "Failed to set protocol version to 3";
</programlisting>
     </example>
     </para>

     <para>
      See also <function>ldap_get_option</function>.</para>
   </refsect1>
  </refentry>


  <refentry id="function.ldap-unbind">
   <refnamediv>
    <refname>ldap_unbind</refname>
    <refpurpose>Unbind from LDAP directory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ldap_unbind</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success and false on error.</para>  
    <para>
     <function>ldap_unbind</function> function unbinds from the LDAP
     directory.</para>
   </refsect1>
  </refentry>
 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/mail.xml
+++ phpdoc/kr/functions/mail.xml
 <reference id="ref.mail">
  <title>Mail functions</title>
  <titleabbrev>Mail</titleabbrev>
  <partintro>
  <simpara>
    The <function>mail</function> function allows you to send mail.</simpara>
  </partintro>


  <refentry id="function.mail">
   <refnamediv>
    <refname>mail</refname>
    <refpurpose>send mail</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>mail</function></funcdef>
      <paramdef>string <parameter>to</parameter></paramdef>
      <paramdef>string <parameter>subject</parameter></paramdef>
      <paramdef>string <parameter>message</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>additional_headers</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
      <function>Mail</function> automatically mails the message specified
      in <parameter>message</parameter> to the receiver specified in
      <parameter>to</parameter>. Multiple recipients can be specified by
      putting a comma between each address in <parameter>to</parameter>.
    </simpara>
    <para>
     <example>
      <title>Sending mail.</title>
      <programlisting>
mail("[EMAIL PROTECTED]", "My Subject", "Line 1\nLine 2\nLine 3");
      </programlisting>
     </example></para>
    <simpara>
     If a fourth string argument is passed, this string is inserted at
     the end of the header.  This is typically used to add extra
     headers.  Multiple extra headers are separated with a newline.</simpara>
    <para>
     <example>
      <title>Sending mail with extra headers.</title>
      <programlisting>
mail("[EMAIL PROTECTED]", "the subject", $message,
     "From: webmaster@$SERVER_NAME\nReply-To: webmaster@$SERVER_NAME\nX-Mailer: PHP/" 
. phpversion());
      </programlisting>
     </example>
     You can also use fairly simple string building techniques to
     build complex email messages.
     <example>
      <title>Sending complex email.</title>
      <programlisting>
/* recipients */
$recipient .= "Mary &lt;[EMAIL PROTECTED]>" . ", " ; //note the comma
$recipient .= "Kelly &lt;[EMAIL PROTECTED]> . ", ";
$recipient .= "[EMAIL PROTECTED]";

/* subject */
$subject = "Birthday Reminders for August";

/* message */
$message .= "The following email includes a formatted ASCII table\n";
$message .= "Day \t\tMonth \t\tYear\n";
$message .= "3rd \t\tAug \t\t1970\n";
$message .= "17rd\t\tAug \t\t1973\n";

/* you can add a stock signature */ 
$message .= "--\r\n"; //Signature delimiter
$message .= "Birthday reminder copylefted by public domain";

/* additional header pieces for errors, From cc's, bcc's, etc */

$headers .= "From: Birthday Reminder &lt;[EMAIL PROTECTED]>\n";
$headers .= "X-Sender: &lt;[EMAIL PROTECTED]>\n"; 
$headers .= "X-Mailer: PHP\n"; // mailer
$headers .= "X-Priority: 1\n"; // Urgent message!
$headers .= "Return-Path: &lt;[EMAIL PROTECTED]>\n";  // Return path for errors

/* If you want to send html mail, uncomment the following line */
// $headers .= "Content-Type: text/html; charset=iso-8859-1\n"; // Mime type

$headers .= "cc:[EMAIL PROTECTED]\n"; // CC to
$headers .= "bcc:[EMAIL PROTECTED], [EMAIL PROTECTED]\n"; // BCCs to

/* and now mail it */
mail($recipient, $subject, $message, $headers);
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ezmlm-hash">
   <refnamediv>
    <refname>ezmlm_hash</refname>
    <refpurpose>Calculate the hash value needed by EZMLM</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ezmlm_hash</function></funcdef>
      <paramdef>string <parameter>addr</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>ezmlm_hash</function> calculates the hash value needed
     when keeping EZMLM mailing lists in a MySQL database.
    </simpara>
    <para>
     <example>
      <title>Calculating the hash and subscribing a user</title>
      <programlisting>
$user = "[EMAIL PROTECTED]";
$hash = ezmlm_hash ($user);
$query = sprintf ("INSERT INTO sample VALUES (%s, '%s')", $hash, $user);
$db->query($query); // using PHPLIB db interface
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

 </reference>

 <!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/math.xml
+++ phpdoc/kr/functions/math.xml
 <reference id="ref.math">
  <title>Mathematical Functions</title>
  <titleabbrev>Math.</titleabbrev>
  
  <partintro>
   <sect1 id="math.intro">
    <title>Introduction</title>
    <para>
     These math functions will only handle values within the range of
     the long and double types on your computer.  If you need to
     handle bigger numbers, take a look at the <link
     linkend="ref.bc">arbitrary precision math functions</link>.
    </para>
    <sect2 id="math.constants">
     <title>Math constants</title>
     <para>
      The following values are defined as constants in PHP by the math
      extension:
      <table>
       <title>Math constants</title>
       <tgroup cols="3">
    <thead>
     <row>
      <entry>Constant</entry>
      <entry>Value</entry>
      <entry>Description</entry>
     </row>
    </thead>
    <tbody>
    <row>
     <entry>M_PI</entry>
     <entry>3.14159265358979323846</entry>
     <entry>Pi</entry>
    </row>
    <row>
     <entry>M_E</entry>
     <entry>2.7182818284590452354</entry>
     <entry>e</entry>
    </row>
    <row>
     <entry>M_LOG2E</entry> 
     <entry>1.4426950408889634074</entry>   
     <entry>log_2 e</entry>
    </row>
    <row>
     <entry>M_LOG10E</entry>
     <entry>0.43429448190325182765</entry>  
     <entry>log_10 e</entry>
    </row>
    <row>
     <entry>M_LN2</entry>   
     <entry>0.69314718055994530942</entry>      
     <entry>log_e 2</entry>
    </row>
    <row>
     <entry>M_LN10</entry>  
     <entry>2.30258509299404568402</entry>  
     <entry>log_e 10</entry>
    </row>
    <row>
     <entry>M_PI_2</entry>
     <entry>1.57079632679489661923</entry>  
     <entry>pi/2</entry>
    </row>
    <row>
     <entry>M_PI_4</entry>
    <entry>0.78539816339744830962</entry>   
     <entry>pi/4</entry>
    </row>
    <row>
     <entry>M_1_PI</entry>
     <entry>0.31830988618379067154</entry>  
     <entry>1/pi</entry>
    </row>
    <row>
     <entry>M_2_PI</entry>
     <entry>0.63661977236758134308</entry>  
     <entry>2/pi</entry>
    </row>
    <row>
     <entry>M_SQRTPI</entry>    
     <entry>1.77245385090551602729</entry>  
     <entry>sqrt(pi) [4.0.2]</entry>
    </row>
    <row>
     <entry>M_2_SQRTPI</entry>  
     <entry>1.12837916709551257390</entry>  
     <entry>2/sqrt(pi)</entry>
    </row>
    <row>
     <entry>M_SQRT2</entry> 
     <entry>1.41421356237309504880</entry>  
     <entry>sqrt(2)</entry>
    </row>
    <row>
     <entry>M_SQRT3</entry> 
     <entry>1.73205080756887729352</entry>  
     <entry>sqrt(3) [4.0.2]</entry>
    </row>
    <row>
     <entry>M_SQRT1_2</entry>   
     <entry>0.70710678118654752440</entry>  
     <entry>1/sqrt(2)</entry>
    </row>
    <row>
     <entry>M_LNPI</entry>  
     <entry>1.14472988584940017414</entry>  
     <entry>log_e(pi) [4.0.2]</entry>
    </row>
    <row>
     <entry>M_EULER</entry> 
     <entry>0.57721566490153286061</entry>  
     <entry>Euler constant [4.0.2]</entry>
    </row>
    </tbody>
       </tgroup>
      </table>
     Only M_PI is available in PHP versions up to and including PHP4RC1.
     All other constants are available starting with PHP 4.0. Constants
     labelled [4.0.2] were added in PHP 4.0.2.
     </para>
    </sect2>
   </sect1>
  </partintro>

  <refentry id="function.abs">
   <refnamediv>
    <refname>abs</refname>
    <refpurpose>Absolute value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>abs</function></funcdef>
      <paramdef>mixed <parameter>number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the absolute value of number.  If the argument number is
     float, return type is also float, otherwise it is int.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.acos">
   <refnamediv>
    <refname>acos</refname>
    <refpurpose>Arc cosine</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>float <function>acos</function></funcdef>
      <paramdef>float <parameter>arg</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the arc cosine of arg in radians.
    </para>
    <para>
     See also <function>asin</function> and <function>atan</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.asin">
   <refnamediv>
    <refname>asin</refname>
    <refpurpose>Arc sine</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>float <function>asin</function></funcdef>
      <paramdef>float <parameter>arg</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the arc sine of arg in radians.
    </para>
    <para>
     See also <function>acos</function> and <function>atan</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.atan">
   <refnamediv>
    <refname>atan</refname>
    <refpurpose>Arc tangent</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>float <function>atan</function></funcdef>
      <paramdef>float <parameter>arg</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the arc tangent of arg in radians.
    </para>
    <para>
     See also <function>asin</function> and <function>acos</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.atan2">
   <refnamediv>
    <refname>atan2</refname>
    <refpurpose>arc tangent of two variables</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>float <function>atan2</function></funcdef>
      <paramdef>float <parameter>y</parameter></paramdef>
      <paramdef>float <parameter>x</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     This function calculates the arc tangent of the two variables
     <parameter>x</parameter> and <parameter>y</parameter>.  It is
     similar to calculating the arc tangent of
     <parameter>y</parameter> / <parameter>x</parameter>, except that
     the signs of both arguments are used to determine the quadrant of
     the result.
    </simpara>
    <simpara>
     The function returns the result in radians, which is between -PI
     and PI (inclusive).
    </simpara>
    <para>
     See also <function>acos</function> and <function>atan</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.base-convert">
   <refnamediv>
    <refname>base_convert</refname>
    <refpurpose>Convert a number between arbitrary bases</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>base_convert</function></funcdef>
      <paramdef>string <parameter>number</parameter></paramdef>
      <paramdef>int <parameter>frombase</parameter></paramdef>
      <paramdef>int <parameter>tobase</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string containing <parameter>number</parameter>
     represented in base <parameter>tobase</parameter>.  The base in
     which <parameter>number</parameter> is given is specified in
     <parameter>frombase</parameter>.  Both
     <parameter>frombase</parameter> and <parameter>tobase</parameter>
     have to be between 2 and 36, inclusive.  Digits in numbers with a
     base higher than 10 will be represented with the letters a-z,
     with a meaning 10, b meaning 11 and z meaning 35.
     <example>
      <title><function>Base_convert</function></title>
      <programlisting role="php">
$binary = base_convert ($hexadecimal, 16, 2);
</programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.bindec">
   <refnamediv>
    <refname>bindec</refname>
    <refpurpose>Binary to decimal</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>bindec</function></funcdef>
      <paramdef>string <parameter>binary_string</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the decimal equivalent of the binary number represented by
     the binary_string argument.
    </para>
    <para>
     Octdec converts a binary number to a decimal number. The largest
     number that can be converted is 31 bits of 1's or 2147483647 in
     decimal.
    </para>
    <para>
     See also the <function>decbin</function>
     function.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ceil">
   <refnamediv>
    <refname>ceil</refname>
    <refpurpose>Round fractions up</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ceil</function></funcdef>
      <paramdef>float <parameter>number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the next highest integer value from
     <parameter>number</parameter>. Using <function>ceil</function>
     on integers is absolutely a waste of time.
     <informalexample>
      <programlisting role="php">
$x = ceil(4.25); 
//  which would make $x=5
      </programlisting>
     </informalexample>
    </para>
    <simpara>
     NOTE: PHP/FI 2's <function>ceil</function> returned a
     float. Use: <literal>$new = (double)ceil($number);</literal> to
     get the old behaviour.
    </simpara>
    <simpara>
     See also <function>floor</function> and
     <function>round</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.cos">
   <refnamediv>
    <refname>cos</refname>
    <refpurpose>Cosine</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>float <function>cos</function></funcdef>
      <paramdef>float <parameter>arg</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the cosine of arg in radians.
    </para>
    <para>
     See also <function>sin</function> and <function>tan</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.decbin">
   <refnamediv>
    <refname>decbin</refname>
    <refpurpose>Decimal to binary</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>decbin</function></funcdef>
      <paramdef>int <parameter>number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string containing a binary representation of the given
     number argument.  The largest number that can be converted is
     2147483647 in decimal resulting to a string of 31 1's.
    </para>
    <para>
     See also the <function>bindec</function> function.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.dechex">
   <refnamediv>
    <refname>dechex</refname>
    <refpurpose>Decimal to hexadecimal</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>dechex</function></funcdef>
      <paramdef>int <parameter>number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string containing a hexadecimal representation of the
     given number argument.  The largest number that can
     be converted is 2147483647 in decimal resulting to "7fffffff".
    </para>
    <para>
     See also the <function>hexdec</function> function.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.decoct">
   <refnamediv>
    <refname>decoct</refname>
    <refpurpose>Decimal to octal</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>decoct</function></funcdef>
      <paramdef>int <parameter>number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string containing an octal representation of the given
     number argument.  The largest number that can be converted is
     2147483647 in decimal resulting to "17777777777". 
    </para>
    <para>
     See also <function>octdec</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.deg2rad">
   <refnamediv>
    <refname>deg2rad</refname>
    <refpurpose>
     Converts the number in degrees to the radian equivalent
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>double <function>deg2rad</function></funcdef>
      <paramdef>double <parameter>number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function converts <parameter>number</parameter> from degrees
     to the radian equivalent.
    </para>
    <para>
     See also <function>rad2deg</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.exp">
   <refnamediv>
    <refname>exp</refname>
    <refpurpose>e to the power of ...</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>float <function>exp</function></funcdef>
      <paramdef>float <parameter>arg</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns e raised to the power of <parameter>arg</parameter>.
    </para>
    <para>
     See also <function>pow</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.floor">
   <refnamediv>
    <refname>floor</refname>
    <refpurpose>Round fractions down</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>floor</function></funcdef>
      <paramdef>float <parameter>number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns the next lowest integer value from
     <parameter>number</parameter>. Using <function>floor</function>
     on integers is absolutely a waste of time.
    </simpara>
    <simpara>
     NOTE: PHP/FI 2's <function>floor</function> returned a
     float. Use: <literal>$new = (double)floor($number);</literal> to
     get the old behaviour.
    </simpara>
    <simpara>
     See also <function>ceil</function> and
     <function>round</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.getrandmax">
   <refnamediv>
    <refname>getrandmax</refname>
    <refpurpose>Show largest possible random value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>getrandmax</function></funcdef>
      <paramdef>void </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns the maximum value that can be returned by a call to
     <function>rand</function>.
    </simpara>
    <simpara>
     See also <function>rand</function>, <function>srand</function>,
     <function>mt_rand</function>, <function>mt_srand</function>, and
     <function>mt_getrandmax</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.hexdec">
   <refnamediv>
    <refname>hexdec</refname>
    <refpurpose>Hexadecimal to decimal</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>hexdec</function></funcdef>
      <paramdef>string <parameter>hex_string</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the decimal equivalent of the hexadecimal number
     represented by the hex_string argument.  HexDec converts a
     hexadecimal string to a decimal number. The largest number that
     can be converted is 7fffffff or 2147483647 in decimal.
    </para>
    <para>
     See also the <function>dechex</function> function.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.lcg-value">
   <refnamediv>
    <refname>lcg_value</refname>
    <refpurpose>Combined linear congruential generator</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>double <function>lcg_value</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>lcg_value</function> returns a pseudo random number in
     the range of (0, 1).  The function combines two CGs with periods
     of 2^31 - 85 and 2^31 - 249. The period of this function is equal
     to the product of both primes.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.log">
   <refnamediv>
    <refname>log</refname>
    <refpurpose>Natural logarithm</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>float <function>log</function></funcdef>
      <paramdef>float <parameter>arg</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the natural logarithm of arg.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.log10">
   <refnamediv>
    <refname>log10</refname>
    <refpurpose>Base-10 logarithm</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>float <function>log10</function></funcdef>
      <paramdef>float <parameter>arg</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the base-10 logarithm of <parameter>arg</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.max">
   <refnamediv>
    <refname>max</refname>
    <refpurpose>Find highest value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>max</function></funcdef>
      <paramdef>mixed <parameter>arg1</parameter></paramdef>
      <paramdef>mixed <parameter>arg2</parameter></paramdef>
      <paramdef>mixed <parameter>argn</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>max</function> returns the numerically highest of the
     parameter values.
    </para>
    <para>
     If the first parameter is an array, <function>max</function>
     returns the highest value in that array.  If the first parameter
     is an integer, string or double, you need at least two parameters
     and <function>max</function> returns the biggest of these values.
     You can compare an unlimited number of values.
    </para>
    <para>
     If one or more of the values is a double, all the values will be
     treated as doubles, and a double is returned.  If none of the
     values is a double, all of them will be treated as integers, and
     an integer is returned.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.min">
   <refnamediv>
    <refname>min</refname>
    <refpurpose>Find lowest value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>min</function></funcdef>
      <paramdef>mixed <parameter>arg1</parameter></paramdef>
      <paramdef>mixed <parameter>arg2</parameter></paramdef>
      <paramdef>mixed <parameter>argn</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Min</function> returns the numerically lowest of the
     parameter values.
    </para>
    <para>
     If the first parameter is an array, <function>min</function>
     returns the lowest value in that array.  If the first parameter
     is an integer, string or double, you need at least two parameters
     and <function>min</function> returns the lowest of these values.
     You can compare an unlimited number of values.
    </para>
    <para>
     If one or more of the values is a double, all the values will be
     treated as doubles, and a double is returned.  If none of the
     values is a double, all of them will be treated as integers, and
     an integer is returned.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mt-rand">
   <refnamediv>
    <refname>mt_rand</refname>
    <refpurpose>Generate a better random value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mt_rand</function></funcdef>
      <paramdef>int
       <parameter><optional>min</optional></parameter>
      </paramdef>
      <paramdef>int
       <parameter><optional>max</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Many random number generators of older libcs have dubious or
     unknown characteristics and are slow. By default, PHP uses the
     libc random number generator with the <function>rand</function>
     function.  <function>mt_rand</function> function is a drop-in
     replacement for this.  It uses a random number generator with
     known characteristics, the Mersenne Twister, which will produce
     random numbers that should be suitable for seeding some kinds
     of cryptography (see the home pages for details) and is four
     times faster than what the average libc provides. The Homepage
     of the Mersenne Twister can be found at
     <ulink url="&url.mersenne;">&url.mersenne;</ulink>, and an
     optimized version of the MT source is available from
     <ulink url="&url.mersenne.twister;">&url.mersenne.twister;
     </ulink>.
    </simpara>
    <simpara>
     If called without the optional <parameter>min</parameter>,
     <parameter>max</parameter> arguments <function>mt_rand</function>
     returns a pseudo-random value between 0 and
     <constant>RAND_MAX</constant>.  If you want a random number
     between 5 and 15 (inclusive), for example, use <literal>mt_rand
     (5, 15)</literal>.
    </simpara>
    <simpara>
     Remember to seed the random number generator before use with
     <function>mt_srand</function>.
    </simpara>
    <note>
     <para>
      In versions before 3.0.7 the meaning of
      <parameter>max</parameter> was <parameter>range</parameter>. To
      get the same results in these versions the short example should
      be <literal>mt_rand (5, 11)</literal> to get a random number
      between 5 and 15.
     </para>
    </note>
    <simpara>
     See also <function>mt_srand</function>,
     <function>mt_getrandmax</function>, <function>srand</function>,
     <function>rand</function> and <function>getrandmax</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.mt-srand">
   <refnamediv>
    <refname>mt_srand</refname>
    <refpurpose>Seed the better random number generator</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>mt_srand</function></funcdef>
      <paramdef>int <parameter>seed</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>    
    <para>
     Seeds the random number generator with
     <parameter>seed</parameter>.
     <informalexample>
      <programlisting role="php">
// seed with microseconds since last "whole" second
mt_srand ((double) microtime() * 1000000);
$randval = mt_rand();
      </programlisting>
     </informalexample>
    </para>
    <simpara>
     See also <function>mt_rand</function>,
     <function>mt_getrandmax</function>, <function>srand</function>,
     <function>rand</function>, and
     <function>getrandmax</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.mt-getrandmax">
   <refnamediv>
    <refname>mt_getrandmax</refname>
    <refpurpose>Show largest possible random value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mt_getrandmax</function></funcdef>
      <paramdef>void </paramdef>
     </funcprototype>
    </funcsynopsis>    
    <simpara>
     Returns the maximum value that can be returned by a call to
     <function>mt_rand</function>.
    </simpara>
    <simpara>
     See also <function>mt_rand</function>,
     <function>mt_srand</function> <function>rand</function>,
     <function>srand</function>, and
     <function>getrandmax</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.number-format">
   <refnamediv>
    <refname>number_format</refname>
    <refpurpose>Format a number with grouped thousands</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>number_format</function></funcdef>
      <paramdef>float <parameter>number</parameter></paramdef>
      <paramdef>int <parameter>decimals</parameter></paramdef>
      <paramdef>string <parameter>dec_point</parameter></paramdef>
      <paramdef>string <parameter>thousands_sep</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Number_format</function> returns a formatted version of
     <parameter>number</parameter>.  This function accepts either one,
     two or four parameters (not three):
    </para>
    <para>If only one parameter is given,
     <parameter>Number</parameter> will be formatted without decimals,
     but with a comma (",") between every group of thousands.
    </para>
    <para>
     If two parameters are given, <parameter>number</parameter> will
     be formatted with <parameter>decimals</parameter> decimals with a
     dot (".") in front, and a comma (",") between every group of
     thousands.
    </para>
    <para>
     If all four parameters are given, <parameter>number</parameter>
     will be formatted with <parameter>decimals</parameter> decimals,
     <parameter>dec_point</parameter> instead of a dot (".") before
     the decimals and <parameter>thousands_sep</parameter> instead of
     a comma (",") between every group of thousands.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.octdec">
   <refnamediv>
    <refname>octdec</refname>
    <refpurpose>Octal to decimal</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>octdec</function></funcdef>
      <paramdef>string <parameter>octal_string</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the decimal equivalent of the octal number
     represented by the octal_string argument.
     OctDec converts an octal string to a decimal number. The largest
     number that can be converted is 17777777777 or 2147483647 in
     decimal.
    </para>
    <para>
     See also <function>decoct</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pi">
   <refnamediv>
    <refname>pi</refname>
    <refpurpose>Get value of pi</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>double <function>pi</function></funcdef>
      <paramdef>void </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns an approximation of pi.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.pow">
   <refnamediv>
    <refname>pow</refname>
    <refpurpose>Exponential expression</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>float <function>pow</function></funcdef>
      <paramdef>float <parameter>base</parameter></paramdef>
      <paramdef>float <parameter>exp</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns base raised to the power of exp.
    </para>
    <para> 
     See also <function>exp</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.rad2deg">
   <refnamediv>
    <refname>rad2deg</refname>
    <refpurpose>
     Converts the radian number to the equivalent number in degrees
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>double <function>rad2deg</function></funcdef>
      <paramdef>double <parameter>number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function converts <parameter>number</parameter> from radian
     to degrees.
    </para>
    <para>
     See also <function>deg2rad</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.rand">
   <refnamediv>
    <refname>rand</refname>
    <refpurpose>Generate a random value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>rand</function></funcdef>
      <paramdef>
       <parameter><optional>int min</optional></parameter>
      </paramdef>
      <paramdef>
       <parameter><optional>int max</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     If called without the optional <parameter>min</parameter>,
     <parameter>max</parameter> arguments <function>rand</function>
     returns a pseudo-random value between 0 and
     <constant>RAND_MAX</constant>.  If you want a random number
     between 5 and 15 (inclusive), for example, use <literal>rand (5,
     15)</literal>. 
    </simpara>
    <simpara>
     Remember to seed the random number generator before use with
     <function>srand</function>.
    </simpara>
    <note>
     <para>
      In versions before 3.0.7 the meaning of
      <parameter>max</parameter> was <parameter>range</parameter>. To
      get the same results in these versions the short example should
      be <literal>rand (5, 11)</literal> to get a random number
      between 5 and 15.
     </para>
    </note>
    <simpara>
     See also <function>srand</function>,
     <function>getrandmax</function>, <function>mt_rand</function>,
     <function>mt_srand</function>, and
     <function>mt_getrandmax</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.round">
   <refnamediv>
    <refname>round</refname>
    <refpurpose>Rounds a float</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>double <function>round</function></funcdef>
      <paramdef>double <parameter>val</parameter></paramdef>
      <paramdef>int
       <parameter><optional>precision</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the rounded value of <parameter>val</parameter> to
     specified <parameter>precision</parameter> 
     (number of digits after the decimal point).
     <informalexample>
      <programlisting role="php">
$foo = round (3.4);  // $foo == 3.0
$foo = round (3.5);  // $foo == 4.0
$foo = round (3.6);  // $foo == 4.0

$foo = round (1.95583, 2);  // $foo == 1.96
      </programlisting>
     </informalexample>
    </para>
                <note>
                 <simpara> 
                        The <parameter>precision</parameter> parameter is only
                        available in PHP 4. 
                 </simpara>
                </note>
    <simpara>
     See also <function>ceil</function> and
     <function>floor</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.sin">
   <refnamediv>
    <refname>sin</refname>
    <refpurpose>Sine</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>float <function>sin</function></funcdef>
      <paramdef>float <parameter>arg</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the sine of arg in radians.
    </para>
    <para>
     See also <function>cos</function> and <function>tan</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sqrt">
   <refnamediv>
    <refname>sqrt</refname>
    <refpurpose>Square root</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>float <function>sqrt</function></funcdef>
      <paramdef>float <parameter>arg</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the square root of <parameter>arg</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.srand">
   <refnamediv>
    <refname>srand</refname>
    <refpurpose>Seed the random number generator</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>srand</function></funcdef>
      <paramdef>int <parameter>seed</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Seeds the random number generator with
     <parameter>seed</parameter>.
     <informalexample>
      <programlisting role="php">
// seed with microseconds since last "whole" second
srand ((double) microtime() * 1000000);
$randval = rand();
      </programlisting>
     </informalexample>
    </para>
    <simpara>
     See also <function>rand</function>,
     <function>getrandmax</function>, <function>mt_rand</function>,
     <function>mt_srand</function>, and
     <function>mt_getrandmax</function>.
    </simpara>    
   </refsect1>
  </refentry>

  <refentry id="function.tan">
   <refnamediv>
    <refname>tan</refname>
    <refpurpose>Tangent</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>float <function>tan</function></funcdef>
      <paramdef>float <parameter>arg</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the tangent of arg in radians.
    </para>
    <para>
     See also <function>sin</function> and <function>cos</function>.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/mcal.xml
+++ phpdoc/kr/functions/mcal.xml
 <reference id="ref.mcal">
  <title>MCAL functions</title>
  <titleabbrev>MCAL</titleabbrev>

  <partintro>
   <para>
    MCAL stands for Modular Calendar Access Library.
   </para>
   <para>
    Libmcal is a C library for accessing calendars. It's written to be
    very modular, with plugable drivers. MCAL is the calendar
    equivalent of the IMAP module for mailboxes.
   </para>
   <para>
    With mcal support, a calendar stream can be opened much like the
    mailbox stream with the IMAP support. Calendars can be local file
    stores, remote ICAP servers, or other formats that are supported
    by the mcal library.
   </para>
   <para>
    Calendar events can be pulled up, queried, and stored. There is
    also support for calendar triggers (alarms) and reoccuring events.
   </para>
   <para>
    With libmcal, central calendar servers can be accessed and used,
    removing the need for any specific database or local file
    programming.
   </para>
   <para>
    To get these functions to work, you have to compile PHP with
    <option role="configure">--with-mcal</option>. That requires the
    mcal library to be installed. Grab the latest version from
    <ulink url="&url.mcal;">&url.mcal;</ulink> and compile and install
    it.
   </para>
   <para>
    The following constants are defined when using the MCAL module:

    MCAL_SUNDAY,
    MCAL_MONDAY,
    MCAL_TUESDAY,
    MCAL_WEDNESDAY,
    MCAL_THURSDAY,
    MCAL_FRIDAY,
    MCAL_SATURDAY,

    MCAL_RECUR_NONE,
    MCAL_RECUR_DAILY,
    MCAL_RECUR_WEEKLY,
    MCAL_RECUR_MONTHLY_MDAY,
    MCAL_RECUR_MONTHLY_WDAY,
    MCAL_RECUR_YEARLY,

    MCAL_JANUARY,
    MCAL_FEBRUARY,
    MCAL_MARCH,
    MCAL_APRIL,
    MCAL_MAY,
    MCAL_JUNE,
    MCAL_JULY,
    MCAL_AUGUGT,
    MCAL_SEPTEMBER,
    MCAL_OCTOBER,
    MCAL_NOVEMBER, and
    MCAL_DECEMBER.

    Most of the functions use an internal event structure that is
    unique for each stream.  This alleviates the need to pass around
    large objects between functions. There are convenience functions
    for setting, initializing, and retrieving the event structure
    values.
   </para>
  </partintro>

  <refentry id="function.mcal-open">
   <refnamediv>
    <refname>mcal_open</refname>
    <refpurpose>Opens up an MCAL connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_open</function></funcdef>
      <paramdef>string <parameter>calendar</parameter></paramdef>
      <paramdef>string <parameter>username</parameter></paramdef>
      <paramdef>string <parameter>password</parameter></paramdef>
      <paramdef>int <parameter>options</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an MCAL stream on success, false on error.
    </para>  
    <para>
     <function>mcal_open</function> opens up an MCAL connection to the
     specified <parameter>calendar</parameter> store. If the optional
     <parameter>options</parameter> is specified, passes the
     <parameter>options</parameter> to that mailbox also. The streams
     internal event structure is also initialized upon connection.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-popen">
   <refnamediv>
    <refname>mcal_popen</refname>
    <refpurpose>Opens up a persistant MCAL connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_popen</function></funcdef>
      <paramdef>string <parameter>calendar</parameter></paramdef>
      <paramdef>string <parameter>username</parameter></paramdef>
      <paramdef>string <parameter>password</parameter></paramdef>
      <paramdef>int <parameter>options</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an MCAL stream on success, false on error.
    </para>  
    <para>
     <function>mcal_popen</function> opens up an MCAL connection to the
     specified <parameter>calendar</parameter> store. If the optional
     <parameter>options</parameter> is specified, passes the
     <parameter>options</parameter> to that mailbox also. The streams
     internal event structure is also initialized upon connection.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-reopen">
   <refnamediv>
    <refname>mcal_reopen</refname>
    <refpurpose>Reopens an MCAL connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_reopen</function></funcdef>
      <paramdef>string <parameter>calendar</parameter></paramdef>
      <paramdef>int <parameter>options</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Reopens an MCAL stream to a new calendar.
    </para>  
    <para>
     <function>mcal_reopen</function> reopens  an MCAL connection to the
     specified <parameter>calendar</parameter> store. If the optional
     <parameter>options</parameter> is specified, passes the
     <parameter>options</parameter> to that mailbox also.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-close">
   <refnamediv>
    <refname>mcal_close</refname>
    <refpurpose>Close an MCAL stream</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_close</function></funcdef>
      <paramdef>int <parameter>mcal_stream</parameter></paramdef>
      <paramdef>int <parameter>flags</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Closes the given mcal stream.
    </para> 
   </refsect1>
  </refentry>

  <refentry id="function.mcal-create-calendar">
   <refnamediv>
    <refname>mcal_create_calendar</refname>
    <refpurpose>Create a new MCAL calendar </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mcal_create_calendar</function></funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
      <paramdef>string <parameter>calendar</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Creates a new calendar named <parameter>calendar</parameter>.
    </para> 
   </refsect1>
  </refentry>
  
  <refentry id="function.mcal-rename-calendar">
   <refnamediv>
    <refname>mcal_rename_calendar</refname>
    <refpurpose>Rename an MCAL calendar </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mcal_rename_calendar</function></funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
      <paramdef>string <parameter>old_name</parameter></paramdef>
      <paramdef>string <parameter>new_name</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Renames the calendar <parameter>old_name</parameter> to
     <parameter>new_name</parameter>.
    </para> 
   </refsect1>
  </refentry>
  
  <refentry id="function.mcal-delete-calendar">
   <refnamediv>
    <refname>mcal_delete_calendar</refname>
    <refpurpose>Delete an MCAL calendar </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mcal_delete_calendar</function></funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
      <paramdef>string <parameter>calendar</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Deletes the calendar named <parameter>calendar</parameter>.
    </para> 
   </refsect1>
  </refentry>

  <refentry id="function.mcal-fetch-event">
   <refnamediv>
    <refname>mcal_fetch_event</refname>
    <refpurpose>
     Fetches an event from the calendar stream
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>object <function>mcal_fetch_event</function></funcdef>
      <paramdef>int <parameter>mcal_stream</parameter></paramdef>
      <paramdef>int <parameter>event_id</parameter></paramdef>
      <paramdef>int <parameter><optional>options</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_fetch_event</function> fetches an event from the 
     calendar stream specified by <parameter>id</parameter>.
    </para>
    <para>
     Returns an event object consisting of:
     <itemizedlist>
      <listitem><simpara>
        int id - ID of that event.</simpara></listitem>
      <listitem><simpara>
        int public - TRUE if the event if public, FALSE if it is
        private.</simpara></listitem>
      <listitem><simpara>
        string category - Category string of the event.</simpara></listitem> 
      <listitem><simpara>
        string title - Title string of the event.</simpara></listitem>
      <listitem><simpara>
        string description - Description string of the event.</simpara></listitem>
      <listitem><simpara>
        int alarm - number of minutes before the event to send an
        alarm/reminder.</simpara></listitem>
      <listitem><simpara>
        object start - Object containing a datetime entry.</simpara></listitem>
      <listitem><simpara>
        object end - Object containing a datetime entry.</simpara></listitem>
      <listitem><simpara>
        int recur_type   - recurrence type</simpara></listitem>
      <listitem><simpara>
        int recur_interval   - recurrence interval</simpara></listitem>
      <listitem><simpara>
        datetime recur_enddate   - recurrence end date</simpara></listitem>
      <listitem><simpara>
        int recur_data   - recurrence data</simpara></listitem>
     </itemizedlist>

     All datetime entries consist of an object that contains:

     <itemizedlist>
      <listitem><simpara>
        int year - year</simpara></listitem>
      <listitem><simpara>
        int month - month</simpara></listitem>
      <listitem><simpara>
        int mday  - day of month</simpara></listitem>
      <listitem><simpara>
        int hour  - hour</simpara></listitem>
      <listitem><simpara>
        int min   - minutes</simpara></listitem>
      <listitem><simpara>
        int sec   - seconds</simpara></listitem>         
      <listitem><simpara>
        int alarm   - minutes before event to send an alarm</simpara></listitem>       
  
     </itemizedlist></para>
   </refsect1>
  </refentry>


  <refentry id="function.mcal-list-events">
   <refnamediv>
    <refname>mcal_list_events</refname>
    <refpurpose>
     Return a list of IDs for a date or a range of dates.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>mcal_list_events</function></funcdef>
      <paramdef>int <parameter>mcal_stream</parameter></paramdef>
      <paramdef>object<parameter>begin_date</parameter></paramdef>
      <paramdef>object
       <parameter><optional>end_date</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of ID's that are between the start and end
     dates, or if just a stream is given, uses the start and end dates
     in the global event structure.
    </para>
    <para> 
     <function>mcal_list_events</function> function takes in an
     beginning date and an optional end date for a calendar stream. An
     array of event id's that are between the given dates or the
     internal event dates are returned.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.mcal-append-event">
   <refnamediv>
    <refname>mcal_append_event</refname>
    <refpurpose>Store a new event into an MCAL calendar</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_append_event</function></funcdef>
      <paramdef>int <parameter>mcal_stream</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>mcal_append_event</function> Stores the global event
     into an MCAL calendar for the given stream.
    </para>
    <para>
     Returns the id of the newly inserted event.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.mcal-store-event">
   <refnamediv>
    <refname>mcal_store_event</refname>
    <refpurpose>Modify an existing event in an MCAL calendar</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_store_event</function></funcdef>
      <paramdef>int <parameter>mcal_stream</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>mcal_store_event</function> Stores the modifications
     to the current global event for the given stream.
    </para>
    <para>
     Returns true on success and false on error.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.mcal-delete-event">
   <refnamediv>
    <refname>mcal_delete_event</refname>
    <refpurpose>Delete an event from an MCAL calendar</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_delete_event</function></funcdef>
      <paramdef>int <parameter>mcal_stream</parameter></paramdef>
      <paramdef>int <parameter><optional>event_id</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_delete_event</function> deletes the calendar event
     specified by the event_id.</para>
    <para>
     Returns true.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-snooze">
   <refnamediv>
    <refname>mcal_snooze</refname>
    <refpurpose>Turn off an alarm for an event</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_snooze</function></funcdef>
      <paramdef>int <parameter>id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_snooze</function> turns off an alarm for a
     calendar event specified by the id.
    </para>
    <para>
     Returns true.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-list-alarms">
   <refnamediv>
    <refname>mcal_list_alarms</refname>
    <refpurpose>
     Return a list of events that has an alarm triggered at the given
     datetime
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>mcal_list_alarms</function></funcdef>
      <paramdef>int <parameter>mcal_stream</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>begin_year</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>begin_month</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>begin_day</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>end_year</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>end_month</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>end_day</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of event ID's that has an alarm going off
     between the start and end dates, or if just a stream is given,
     uses the start and end dates in the global event structure.
    </para>
    <para> 
     <function>mcal_list_events</function> function takes in an
     optional beginning date and an end date for a calendar stream. An
     array of event id's that are between the given dates or the
     internal event dates are returned.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-event-init">
   <refnamediv>
    <refname>mcal_event_init</refname>
    <refpurpose>
     Initializes a streams global event structure
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_event_init</function></funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_event_init</function> initializes a streams global
     event structure. this effectively sets all elements of the
     structure to 0, or the default settings.
    </para>
    <para>
     Returns true.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-event-set-category">
   <refnamediv>
    <refname>mcal_event_set_category</refname>
    <refpurpose>
     Sets the category of the streams global event structure
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_event_set_category</function></funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
      <paramdef>string <parameter>category</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_event_set_category</function> sets the streams
     global event structure's category to the given string.
    </para>
    <para>
     Returns true.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-event-set-title">
   <refnamediv>
    <refname>mcal_event_set_title</refname>
    <refpurpose>
     Sets the title of the streams global event structure
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_event_set_title</function></funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
      <paramdef>string <parameter>title</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_event_set_title</function> sets the streams global
     event structure's title to the given string.
    </para>
    <para>
     Returns true.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-event-set-description">
   <refnamediv>
    <refname>mcal_event_set_description</refname>
    <refpurpose>
     Sets the description of the streams global event structure
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>mcal_event_set_description</function>
      </funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
      <paramdef>string <parameter>description</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_event_set_description</function> sets the streams
     global event structure's description to the given string.
    </para>
    <para>
     Returns true.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-event-set-start">
   <refnamediv>
    <refname>mcal_event_set_start</refname>
    <refpurpose>
     Sets the start date and time of the streams global event
     structure
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_event_set_start</function></funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
      <paramdef>int <parameter>year</parameter></paramdef>
      <paramdef>int <parameter>month</parameter></paramdef>
      <paramdef>int 
       <parameter>
        <optional>day</optional>
       </parameter>
      </paramdef>
      <paramdef>int 
       <parameter>
        <optional>hour</optional>
       </parameter>
      </paramdef>
      <paramdef>int 
       <parameter>
        <optional>min</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter>
        <optional>sec</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_event_set_start</function> sets the streams global
     event structure's start date and time to the given values.
    </para>
    <para>
     Returns true.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-event-set-end">
   <refnamediv>
    <refname>mcal_event_set_end</refname>
    <refpurpose>
     Sets the end date and time of the streams global event structure
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_event_set_end</function></funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
      <paramdef>int <parameter>year</parameter></paramdef>
      <paramdef>int <parameter>month</parameter></paramdef>
      <paramdef>int 
       <parameter>
        <optional>day</optional>
       </parameter>
      </paramdef>
      <paramdef>int 
       <parameter>
        <optional>hour</optional>
       </parameter>
      </paramdef>
      <paramdef>int 
       <parameter>
        <optional>min</optional>
       </parameter>
      </paramdef>
      <paramdef>int 
       <parameter>
        <optional>sec</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_event_set_end</function> sets the streams global
     event structure's end date and time to the given values.
    </para>
    <para>
     Returns true.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-event-set-alarm">
   <refnamediv>
    <refname>mcal_event_set_alarm</refname>
    <refpurpose>
     Sets the alarm of the streams global event structure
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_event_set_alarm</function></funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
      <paramdef>int <parameter>alarm</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_event_set_alarm</function> sets the streams global
     event structure's alarm to the given minutes before the event.
    </para>
    <para>
     Returns true.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-event-set-class">
   <refnamediv>
    <refname>mcal_event_set_class</refname>
    <refpurpose>
     Sets the class of the streams global event structure
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_event_set_class</function></funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
      <paramdef>int <parameter>class</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_event_set_class</function> sets the streams global
     event structure's class to the given value. The class is either 1
     for public, or 0 for private.
    </para>
    <para>
     Returns true.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.mcal-is-leap-year">
   <refnamediv>
    <refname>mcal_is_leap_year</refname>
    <refpurpose>
     Returns if the given year is a leap year or not
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_is_leap_year</function></funcdef>
      <paramdef>int <parameter>year</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_is_leap_year</function> returns 1 if the given
     year is a leap year, 0 if not.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-days-in-month">
   <refnamediv>
    <refname>mcal_days_in_month</refname>
    <refpurpose>
     Returns the number of days in the given month
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_days_in_month</function></funcdef>
      <paramdef>int <parameter>month</parameter></paramdef>
      <paramdef>int <parameter>leap year</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_days_in_month</function> Returns the number of
     days in the given month, taking into account if the given year is
     a leap year or not.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-date-valid">
   <refnamediv>
    <refname>mcal_date_valid</refname>
    <refpurpose>
     Returns true if the given year, month, day is a valid date
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_date_valid</function></funcdef>
      <paramdef>int <parameter>year</parameter></paramdef>
      <paramdef>int <parameter>month</parameter></paramdef>
      <paramdef>int <parameter>day</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_date_valid</function> Returns true if the given
     year, month and day is a valid date, false if not.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-time-valid">
   <refnamediv>
    <refname>mcal_time_valid</refname>
    <refpurpose>
     Returns true if the given year, month, day is a valid time
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_time_valid</function></funcdef>
      <paramdef>int <parameter>hour</parameter></paramdef>
      <paramdef>int <parameter>minutes</parameter></paramdef>
      <paramdef>int <parameter>seconds</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_time_valid</function> Returns true if the given
     hour, minutes and seconds is a valid time, false if not.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-day-of-week">
   <refnamediv>
    <refname>mcal_day_of_week</refname>
    <refpurpose>
     Returns the day of the week of the given date
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_</function></funcdef>
      <paramdef>int <parameter>year</parameter></paramdef>
      <paramdef>int <parameter>month</parameter></paramdef>
      <paramdef>int <parameter>day</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_day_of_week</function> returns the day of the week
     of the given date.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-day-of-year">
   <refnamediv>
    <refname>mcal_day_of_year</refname>
    <refpurpose>
     Returns the day of the year of the given date
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_</function></funcdef>
      <paramdef>int <parameter>year</parameter></paramdef>
      <paramdef>int <parameter>month</parameter></paramdef>
      <paramdef>int <parameter>day</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_day_of_year</function> returns the day of the year
     of the given date.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-date-compare">
   <refnamediv>
    <refname>mcal_date_compare</refname>
    <refpurpose>Compares two dates</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_date_compare</function></funcdef>
      <paramdef>int <parameter>a_year</parameter></paramdef>
      <paramdef>int <parameter>a_month</parameter></paramdef>
      <paramdef>int <parameter>a_day</parameter></paramdef>
      <paramdef>int <parameter>b_year</parameter></paramdef>
      <paramdef>int <parameter>b_month</parameter></paramdef>
      <paramdef>int <parameter>b_day</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_date_compare</function> Compares the two given
     dates, returns &lt;0, 0, >0 if a&lt;b, a==b, a>b respectively.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-next-recurrence">
   <refnamediv>
    <refname>mcal_next_recurrence</refname>
    <refpurpose>Returns the next recurrence of the event</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcal_next_recurrence</function></funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
      <paramdef>int <parameter>weekstart</parameter></paramdef>
      <paramdef>array <parameter>next</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_next_recurrence</function> returns an object
     filled with the next date the event occurs, on or after the
     supplied date.  Returns empty date field if event does not occur
     or something is invalid. Uses weekstart to determine what day is
     considered the beginning of the week.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-event-set-recur-none">
   <refnamediv>
    <refname>mcal_event_set_recur_none</refname>
    <refpurpose>
     Sets the recurrence of the streams global event structure
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>mcal_event_set_recur_none</function>
      </funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_event_set_recur_none</function> sets the streams
     global event structure to not recur (event->recur_type is set to
     MCAL_RECUR_NONE).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-event-set-recur-daily">
   <refnamediv>
    <refname>mcal_event_set_recur_daily</refname>
    <refpurpose>
     Sets the recurrence of the streams global event structure
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>mcal_event_set_recur_daily</function>
      </funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
      <paramdef>int <parameter>year</parameter></paramdef>
      <paramdef>int <parameter>month</parameter></paramdef>
      <paramdef>int <parameter>day</parameter></paramdef>
      <paramdef>int <parameter>interval</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_event_set_recur_daily</function> sets the streams
     global event structure's recurrence to the given value to be
     reoccuring on a daily basis, ending at the given date.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-event-set-recur-weekly">
   <refnamediv>
    <refname>mcal_event_set_recur_weekly</refname>
    <refpurpose>
     Sets the recurrence of the streams global event structure
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>mcal_event_set_recur_weekly</function>
      </funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
      <paramdef>int <parameter>year</parameter></paramdef>
      <paramdef>int <parameter>month</parameter></paramdef>
      <paramdef>int <parameter>day</parameter></paramdef>
      <paramdef>int <parameter>interval</parameter></paramdef>
      <paramdef>int <parameter>weekdays</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_event_set_recur_weekly</function> sets the streams
     global event structure's recurrence to the given value to be
     reoccuring on a weekly basis, ending at the given date.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-event-set-recur-monthly-mday">
   <refnamediv>
    <refname>mcal_event_set_recur_monthly_mday</refname>
    <refpurpose>
     Sets the recurrence of the streams global event structure
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>mcal_event_set_recur_monthly_mday</function>
      </funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
      <paramdef>int <parameter>year</parameter></paramdef>
      <paramdef>int <parameter>month</parameter></paramdef>
      <paramdef>int <parameter>day</parameter></paramdef>
      <paramdef>int <parameter>interval</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_event_set_recur_monthly_mday</function> sets the
     streams global event structure's recurrence to the given value to
     be reoccuring on a monthly by month day basis, ending at the
     given date.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-event-set-recur-monthly-wday">
   <refnamediv>
    <refname>mcal_event_set_recur_monthly_wday</refname>
    <refpurpose>
     Sets the recurrence of the streams global event structure
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>mcal_event_set_recur_monthly_wday</function>
      </funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
      <paramdef>int <parameter>year</parameter></paramdef>
      <paramdef>int <parameter>month</parameter></paramdef>
      <paramdef>int <parameter>day</parameter></paramdef>
      <paramdef>int <parameter>interval</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_event_set_recur_monthly_wday</function> sets the
     streams global event structure's recurrence to the given value to
     be reoccuring on a monthly by week basis, ending at the given
     date.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-event-set-recur-yearly">
   <refnamediv>
    <refname>mcal_event_set_recur_yearly</refname>
    <refpurpose>
     Sets the recurrence of the streams global event structure
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>mcal_event_set_recur_yearly</function>
      </funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
      <paramdef>int <parameter>year</parameter></paramdef>
      <paramdef>int <parameter>month</parameter></paramdef>
      <paramdef>int <parameter>day</parameter></paramdef>
      <paramdef>int <parameter>interval</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_event_set_recur_yearly</function> sets the streams
     global event structure's recurrence to the given value to be
     reoccuring on a yearly basis,ending at the given date.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-fetch-current-stream-event">
   <refnamediv>
    <refname>mcal_fetch_current_stream_event</refname>
    <refpurpose>
     Returns an object containing the current streams event structure
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>object 
       <function>mcal_fetch_current_stream_event</function>
      </funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_fetch_current_stream_event</function>
     returns the current stream's event structure as an object
     containing:

     <itemizedlist>
      <listitem><simpara>
        int id - ID of that event.</simpara></listitem>
      <listitem><simpara>
        int public - TRUE if the event if public, FALSE if it is
        private.</simpara></listitem>
      <listitem><simpara>
        string category - Category string of the event.</simpara></listitem> 
      <listitem><simpara>
        string title - Title string of the event.</simpara></listitem>
      <listitem><simpara>
        string description - Description string of the event.</simpara></listitem>
      <listitem><simpara>
        int alarm - number of minutes before the event to send an
        alarm/reminder.</simpara></listitem>
      <listitem><simpara>
        object start - Object containing a datetime entry.</simpara></listitem>
      <listitem><simpara>
        object end - Object containing a datetime entry.</simpara></listitem>
      <listitem><simpara>
        int recur_type   - recurrence type</simpara></listitem>
      <listitem><simpara>
        int recur_interval   - recurrence interval</simpara></listitem>
      <listitem><simpara>
        datetime recur_enddate   - recurrence end date</simpara></listitem>
      <listitem><simpara>
        int recur_data   - recurrence data</simpara></listitem>
     </itemizedlist>

     All datetime entries consist of an object that contains:

     <itemizedlist>
      <listitem><simpara>
        int year - year</simpara></listitem>
      <listitem><simpara>
        int month - month</simpara></listitem>
      <listitem><simpara>
        int mday  - day of month</simpara></listitem>
      <listitem><simpara>
        int hour  - hour</simpara></listitem>
      <listitem><simpara>
        int min   - minutes</simpara></listitem>
      <listitem><simpara>
        int sec   - seconds</simpara></listitem>         
      <listitem><simpara>
        int alarm   - minutes before event to send an alarm</simpara></listitem>       
  
     </itemizedlist>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-event-add-attribute">
   <refnamediv>
    <refname>mcal_event_add_attribute</refname>
    <refpurpose>
     Adds an attribute and a value to the streams global event structure
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>mcal_event_add_attribute</function>
      </funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
      <paramdef>string <parameter>attribute</parameter></paramdef>
      <paramdef>string <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_event_add_attribute</function> adds an attribute
     to the stream's global event structure with the value given by
     "value".
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcal-expunge">
   <refnamediv>
    <refname>mcal_expunge</refname>
    <refpurpose>
     Deletes all events marked for being expunged.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int
       <function>mcal_expunge</function>
      </funcdef>
      <paramdef>int <parameter>stream</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     <function>mcal_expunge</function> Deletes all events which have
     been previously marked for deletion.
    </para>
   </refsect1>
  </refentry>

</reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/mcrypt.xml
+++ phpdoc/kr/functions/mcrypt.xml
 <reference id="ref.mcrypt">
  <title>Mcrypt Encryption Functions</title>
  <titleabbrev>mcrypt</titleabbrev>
  
  <partintro>
   <para>
    These functions work using <ulink
    url="&url.mcrypt;">mcrypt</ulink>.
   </para>
   <para>
    This is an interface to the mcrypt library, which supports a wide
    variety of block algorithms such as DES, TripleDES, Blowfish
    (default), 3-WAY, SAFER-SK64, SAFER-SK128, TWOFISH, TEA, RC2 and
    GOST in CBC, OFB, CFB and ECB cipher modes. Additionally, it
    supports RC6 and IDEA which are considered "non-free".
   </para>
   <para>
    If you linked against libmcrypt 2.4.x, the following additional
    block algorithms are supported: CAST, LOKI97, RIJNDAEL, SAFERPLUS,
    SERPENT and the following stream ciphers: ENIGMA (crypt), PANAMA,
    RC4 and WAKE. With libmcrypt 2.4.x another cipher mode is also
    available; nOFB.
   </para>
   <para>
    To use it, download libmcrypt-x.x.tar.gz from <ulink
    url="&url.mcrypt;">here</ulink> and follow the included
    installation instructions. You need to compile PHP with the
    <option role="configure">--with-mcrypt</option> parameter to
    enable this extension. Make sure you compile libmcrypt with the
    option <option role="configure">--disable-posix-threads</option>.
   </para>
   <para>
    Mcrypt can be used to encrypt and decrypt using the above
    mentioned ciphers. If you linked against libmcrypt-2.2.x, the
    four important mcrypt commands (<function>mcrypt_cfb</function>,
    <function>mcrypt_cbc</function>, <function>mcrypt_ecb</function>,
    and <function>mcrypt_ofb</function>) can operate in both modes
    which are named MCRYPT_ENCRYPT and MCRYPT_DECRYPT, respectively.
    <example>
     <title>Encrypt an input value with TripleDES under 2.2.x in ECB mode</title>
     <programlisting role="php">
&lt;?php
$key = "this is a very secret key";
$input = "Let us meet at 9 o'clock at the secret place.";

$encrypted_data = mcrypt_ecb (MCRYPT_3DES, $key, $input, MCRYPT_ENCRYPT);
?&gt;
     </programlisting>
    </example>
    This example will give you the encrypted data as a string in
    <literal>$encrypted_data</literal>.
   </para>
   <para>
    If you linked against libmcrypt 2.4.x, these functions are still
    available, but it is recommended that you use the advanced functions.
    <example>
     <title>Encrypt an input value with TripleDES under 2.4.x in ECB mode</title>
     <programlisting role="php">
&lt;?php
$key = "this is a very secret key";
$input = "Let us meet at 9 o'clock at the secret place.";

$td = mcrypt_module_open (MCRYPT_TripleDES, "", MCRYPT_MODE_ECB, "");
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), MCRYPT_RAND);
mcrypt_generic_init ($td, $key, $iv);
$encrypted_data = mcrypt_generic ($td, $input);
mcrypt_generic_end ($td);
?&gt;
     </programlisting>
    </example>
    This example will give you the encrypted data as a string in
    <literal>$encrypted_data</literal>.
   </para>
   <para>
    Mcrypt can operate in four block cipher modes (CBC, OFB, CFB, and
    ECB). If linked against libmcrypt-2.4.x mcrypt can also operate
    in the block cipher mode nOFB and in STREAM mode. Then there are
    also constants in the form MCRYPT_MODE_mode for use with several
    functions. We will outline the normal use for each of these modes.
    For a more complete reference and discussion see 
    &book.applied.cryptography;.
    <itemizedlist>
     <listitem>
      <simpara>
       ECB (electronic codebook) is suitable for random data, such as
       encrypting other keys. Since data there is short and random,
       the disadvantages of ECB have a favorable negative
       effect.
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       CBC (cipher block chaining) is especially suitable for
       encrypting files where the security is increased over ECB
       significantly.
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       CFB (cipher feedback) is the best mode for encrypting byte
       streams where single bytes must be encrypted.
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       OFB (output feedback, in 8bit) is comparable to CFB, but
       can be used in applications where error propagation cannot
       be tolerated. It's insecure (because it operates in 8bit
       mode) so it is not recommended to use it.
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       nOFB (output feedback, in nbit) is comparable to OFB, but
       more secure because it operates on the block size of the
       algorithm.
      </simpara>
     </listitem> 
     <listitem>
      <simpara>
       STREAM is an extra mode to include some stream algorithms
       like WAKE or RC4.
      </simpara>
     </listitem> 
    </itemizedlist>
   </para>
   <para>
    PHP does not support encrypting/decrypting bit streams
    currently. As of now, PHP only supports handling of strings.
   </para>
   <para>
    For a complete list of supported ciphers, see the defines at the
    end of <filename>mcrypt.h</filename>. The general rule with the
    mcrypt-2.2.x API is that you can access the cipher from PHP with
    MCRYPT_ciphername. With the mcrypt-2.4.x API these constants also
    work, but it is possible to specify the name of the cipher as
    a string with a call to <function>mcrypt_module_open</function>.
   </para>
   <para>
    Here is a short list of ciphers which are currently supported by
    the mcrypt extension. If a cipher is not listed here, but is
    listed by mcrypt as supported, you can safely assume that this
    documentation is outdated.
    <itemizedlist>
     <listitem>
      <simpara>
       MCRYPT_3DES
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_ARCFOUR_IV (libmcrypt 2.4.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_ARCFOUR (libmcrypt 2.4.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_BLOWFISH
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_CAST_128
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_CAST_256
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_CRYPT
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_DES
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_DES_COMPAT (libmcrypt 2.2.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_ENIGMA (libmcrypt 2.4.x only, alias for MCRYPT_CRYPT)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_GOST
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_IDEA (non-free)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_LOKI97 (libmcrypt 2.4.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_MARS (libmcrypt 2.4.x only, non-free)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_PANAMA (libmcrypt 2.4.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_RIJNDAEL_128 (libmcrypt 2.4.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_RIJNDAEL_192 (libmcrypt 2.4.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_RIJNDAEL_256 (libmcrypt 2.4.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_RC2
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_RC4 (libmcrypt 2.2.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_RC6 (libmcrypt 2.4.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_RC6_128 (libmcrypt 2.2.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_RC6_192 (libmcrypt 2.2.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_RC6_256 (libmcrypt 2.2.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_SAFER64
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_SAFER128
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_SAFERPLUS (libmcrypt 2.4.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_SERPENT (libmcrypt 2.4.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_SERPENT_128 (libmcrypt 2.2.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_SERPENT_192 (libmcrypt 2.2.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_SERPENT_256 (libmcrypt 2.2.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_SKIPJACK (libmcrypt 2.4.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_TEAN (libmcrypt 2.2.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_THREEWAY
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_TRIPLEDES (libmcrypt 2.4.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_TWOFISH (for older mcrypt 2.x versions, or mcrypt 2.4.x )
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_TWOFISH128 (TWOFISHxxx are available in newer 2.x versions, but not in 
the 2.4.x versions)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_TWOFISH192
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_TWOFISH256
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_WAKE (libmcrypt 2.4.x only)
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MCRYPT_XTEA (libmcrypt 2.4.x only)
      </simpara>
     </listitem>
    </itemizedlist>
   </para>
   <para>
    You must (in CFB and OFB mode) or can (in CBC mode) supply an
    initialization vector (IV) to the respective cipher function. The
    IV must be unique and must be the same when
    decrypting/encrypting. With data which is stored encrypted, you
    can take the output of a function of the index under which the
    data is stored (e.g.  the MD5 key of the filename).
    Alternatively, you can transmit the IV together with the encrypted
    data (see chapter 9.3 of &book.applied.cryptography; for a
    discussion of this topic).
   </para>
  </partintro>
  
  <refentry id="function.mcrypt-get-cipher-name">
   <refnamediv>
    <refname>mcrypt_get_cipher_name</refname>
    <refpurpose>Get the name of the specified cipher</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mcrypt_get_cipher_name</function></funcdef>
      <paramdef>int <parameter>cipher</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mcrypt_get_cipher_name</function></funcdef>
      <paramdef>string <parameter>cipher</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Mcrypt_get_cipher_name</function> is used to get the
     name of the specified cipher.
    </para>
    <para>
     <function>Mcrypt_get_cipher_name</function> takes the cipher
     number as an argument (libmcrypt 2.2.x) or takes the cipher name
     as an argument (libmcrypt 2.4.x) and returns the name of the cipher
     or false, if the cipher does not exist.
    </para>
    <para>
     <example>
      <title><function>Mcrypt_get_cipher_name</function> Example</title>
      <programlisting role="php">
&lt;?php
$cipher = MCRYPT_TripleDES;

print mcrypt_get_cipher_name ($cipher);
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     The above example will produce:
     <programlisting>
3DES
     </programlisting>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.mcrypt-get-block-size">
   <refnamediv>
    <refname>mcrypt_get_block_size</refname>
    <refpurpose>Get the block size of the specified cipher</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcrypt_get_block_size</function></funcdef>
      <paramdef>int <parameter>cipher</parameter></paramdef>
     </funcprototype>
     <funcprototype>
      <funcdef>int <function>mcrypt_get_block_size</function></funcdef>
      <paramdef>string <parameter>cipher</parameter></paramdef>
      <paramdef>string <parameter>module</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The first prototype is when linked against libmcrypt 2.2.x, the
     second when linked against libmcrypt 2.4.x.
    </para>
    <para>
     <function>Mcrypt_get_block_size</function> is used to get the
     size of a block of the specified <parameter>cipher</parameter>.
    </para>
    <para>
     <function>Mcrypt_get_block_size</function> takes one or two
     arguments, the <parameter>cipher</parameter> and
     <parameter>module</parameter>, and returns the size in bytes.
    </para> 
    <para>
     See also: <function>mcrypt_get_key_size</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.mcrypt-get-key-size">
   <refnamediv>
    <refname>mcrypt_get_key_size</refname>
    <refpurpose>Get the key size of the specified cipher</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcrypt_get_key_size</function></funcdef>
      <paramdef>int <parameter>cipher</parameter></paramdef>
     </funcprototype>
     <funcprototype>
      <funcdef>int <function>mcrypt_get_key_size</function></funcdef>
      <paramdef>string <parameter>cipher</parameter></paramdef>
      <paramdef>string <parameter>module</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The first prototype is when linked against libmcrypt 2.2.x, the
     second when linked against libmcrypt 2.4.x.
    </para>
    <para>
     <function>Mcrypt_get_key_size</function> is used to get the size
     of a key of the specified <parameter>cipher</parameter>.
    </para>
    <para>
     <function>Mcrypt_get_key_size</function> takes one or two
     arguments, the <parameter>cipher</parameter> and
     <parameter>module</parameter>, and returns the size in bytes.
    </para> 
    <para>
     See also: <function>mcrypt_get_block_size</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.mcrypt-create-iv">
   <refnamediv>
    <refname>mcrypt_create_iv</refname>
    <refpurpose>
     Create an initialization vector (IV) from a random source
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string
      <function>mcrypt_create_iv</function></funcdef>
      <paramdef>int <parameter>size</parameter></paramdef>
      <paramdef>int <parameter>source</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Mcrypt_create_iv</function> is used to create an IV.
    </para>
    <para>
     <function>mcrypt_create_iv</function> takes two arguments,
     <parameter>size</parameter> determines the size of the IV,
     <parameter>source</parameter> specifies the source of the IV.
    </para>
    <para>
     The source can be MCRYPT_RAND (system random number generator),
     MCRYPT_DEV_RANDOM (read data from /dev/random) and
     MCRYPT_DEV_URANDOM (read data from /dev/urandom). If you use
     MCRYPT_RAND, make sure to call srand() before to initialize the
     random number generator.
    </para>
    <para>
     <example>
      <title><function>Mcrypt_create_iv</function> example</title>
      <programlisting role="php">
&lt;?php
$cipher = MCRYPT_TripleDES;
$block_size = mcrypt_get_block_size ($cipher);
$iv = mcrypt_create_iv ($block_size, MCRYPT_DEV_RANDOM);
?&gt;
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.mcrypt-cbc">
   <refnamediv>
    <refname>mcrypt_cbc</refname>
    <refpurpose>Encrypt/decrypt data in CBC mode</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mcrypt_cbc</function></funcdef>
      <paramdef>int <parameter>cipher</parameter></paramdef>
      <paramdef>string <parameter>key</parameter></paramdef>
      <paramdef>string <parameter>data</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>iv</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mcrypt_cbc</function></funcdef>
      <paramdef>string <parameter>cipher</parameter></paramdef>
      <paramdef>string <parameter>key</parameter></paramdef>
      <paramdef>string <parameter>data</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>iv</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The first prototype is when linked against libmcrypt 2.2.x, the
     second when linked against libmcrypt 2.4.x.
    </para>
    <para>
     <function>Mcrypt_cbc</function> encrypts or decrypts (depending
     on <parameter>mode</parameter>) the <parameter>data</parameter>
     with <parameter>cipher</parameter> and <parameter>key</parameter>
     in CBC cipher mode and returns the resulting string.
    </para>
    <para>
     <parameter>Cipher</parameter> is one of the MCRYPT_ciphername
     constants.
    </para>
    <para>
     <parameter>Key</parameter> is the key supplied to the
     algorithm. It must be kept secret.
    </para>
    <para>
     <parameter>Data</parameter> is the data which shall be
     encrypted/decrypted.
    </para>
    <para>
     <parameter>Mode</parameter> is MCRYPT_ENCRYPT or MCRYPT_DECRYPT.
    </para>
    <para>
     <parameter>IV</parameter> is the optional initialization vector.
    </para>
    <para>
     See also: <function>mcrypt_cfb</function>,
     <function>mcrypt_ecb</function>, and
     <function>mcrypt_ofb</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcrypt-cfb">
   <refnamediv>
    <refname>mcrypt_cfb</refname>
    <refpurpose>Encrypt/decrypt data in CFB mode</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mcrypt_cfb</function></funcdef>
      <paramdef>int <parameter>cipher</parameter></paramdef>
      <paramdef>string <parameter>key</parameter></paramdef>
      <paramdef>string <parameter>data</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
      <paramdef>string <parameter>iv</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mcrypt_cfb</function></funcdef>
      <paramdef>string <parameter>cipher</parameter></paramdef>
      <paramdef>string <parameter>key</parameter></paramdef>
      <paramdef>string <parameter>data</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>iv</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The first prototype is when linked against libmcrypt 2.2.x, the
     second when linked against libmcrypt 2.4.x.
    </para>
    <para>
     <function>Mcrypt_cfb</function> encrypts or decrypts (depending
     on <parameter>mode</parameter>) the <parameter>data</parameter>
     with <parameter>cipher</parameter> and <parameter>key</parameter>
     in CFB cipher mode and returns the resulting string.
    </para>
    <para>
     <parameter>Cipher</parameter> is one of the MCRYPT_ciphername
     constants.
    </para>
    <para>
     <parameter>Key</parameter> is the key supplied to the
     algorithm. It must be kept secret.
    </para>
    <para>
     <parameter>Data</parameter> is the data which shall be
     encrypted/decrypted.
    </para> 
    <para>
     <parameter>Mode</parameter> is MCRYPT_ENCRYPT or MCRYPT_DECRYPT.
    </para>
    <para>
     <parameter>IV</parameter> is the initialization vector.
    </para>
    <para>
     See also: <function>mcrypt_cbc</function>,
     <function>mcrypt_ecb</function>, and
     <function>mcrypt_ofb</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.mcrypt-ecb">
   <refnamediv>
    <refname>mcrypt_ecb</refname>
    <refpurpose>Encrypt/decrypt data in ECB mode</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mcrypt_ecb</function></funcdef>
      <paramdef>int <parameter>cipher</parameter></paramdef>
      <paramdef>string <parameter>key</parameter></paramdef>
      <paramdef>string <parameter>data</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mcrypt_ecb</function></funcdef>
      <paramdef>string <parameter>cipher</parameter></paramdef>
      <paramdef>string <parameter>key</parameter></paramdef>
      <paramdef>string <parameter>data</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>iv</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The first prototype is when linked against libmcrypt 2.2.x, the
     second when linked against libmcrypt 2.4.x.
    </para>
    <para>
     <function>Mcrypt_ecb</function> encrypts or decrypts (depending
     on <parameter>mode</parameter>) the <parameter>data</parameter>
     with <parameter>cipher</parameter> and <parameter>key</parameter>
     in ECB cipher mode and returns the resulting string.
    </para>
    <para>
     <parameter>Cipher</parameter> is one of the MCRYPT_ciphername
     constants.
    </para>
    <para>
     <parameter>Key</parameter> is the key supplied to the
     algorithm. It must be kept secret.
    </para>
    <para>
     <parameter>Data</parameter> is the data which shall be
     encrypted/decrypted.
    </para>
    <para>
     <parameter>Mode</parameter> is MCRYPT_ENCRYPT or MCRYPT_DECRYPT.
    </para>
    <para>
     See also: <function>mcrypt_cbc</function>,
     <function>mcrypt_cfb</function>, and
     <function>mcrypt_ofb</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcrypt-ofb">
   <refnamediv>
    <refname>mcrypt_ofb</refname>
    <refpurpose>Encrypt/decrypt data in OFB mode</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mcrypt_ofb</function></funcdef>
      <paramdef>int <parameter>cipher</parameter></paramdef>
      <paramdef>string <parameter>key</parameter></paramdef>
      <paramdef>string <parameter>data</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
      <paramdef>string <parameter>iv</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>     
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mcrypt_ofb</function></funcdef>
      <paramdef>string <parameter>cipher</parameter></paramdef>
      <paramdef>string <parameter>key</parameter></paramdef>
      <paramdef>string <parameter>data</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>iv</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The first prototype is when linked against libmcrypt 2.2.x, the
     second when linked against libmcrypt 2.4.x.
    </para>
    <para>
     <function>Mcrypt_ofb</function> encrypts or decrypts (depending
     on <parameter>mode</parameter>) the <parameter>data</parameter>
     with <parameter>cipher</parameter> and <parameter>key</parameter>
     in OFB cipher mode and returns the resulting string.
    </para>    
    <para>
     <parameter>Cipher</parameter> is one of the MCRYPT_ciphername
     constants.
    </para>
    <para>
     <parameter>Key</parameter> is the key supplied to the
     algorithm. It must be kept secret.
    </para>
    <para>
     <parameter>Data</parameter> is the data which shall be
     encrypted/decrypted.
    </para> 
    <para>
     <parameter>Mode</parameter> is MCRYPT_ENCRYPT or MCRYPT_DECRYPT.
    </para>
    <para>
     <parameter>IV</parameter> is the initialization vector.
    </para>
    <para>
     See also: <function>mcrypt_cbc</function>,
     <function>mcrypt_cfb</function>, and
     <function>mcrypt_ecb</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.mcrypt-list-algorithms">
   <refnamediv>
    <refname>mcrypt_list_algorithms</refname>
    <refpurpose>Get an array of all supported ciphers</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>mcrypt_list_algorithms</function></funcdef>
      <paramdef>string
           <parameter>
            <optional>lib_dir</optional>
           </parameter>
          </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Mcrypt_list_algorithms</function> is used to get an
     array of all supported algorithms in the
    </para>
    <para>
     <parameter>lib_dir</parameter>.
     <function>Mcrypt_list_algorithms</function> takes as optional
     parameter a directory which specifies the directory where all
     algorithms are located. If not specifies, the value of the
         mcrypt.algorithms_dir php.ini directive is used.
    </para>
    <para>
     <example>
      <title><function>Mcrypt_list_algorithms</function> Example</title>
      <programlisting role="php">
&lt;?php
$algorithms = mcrypt_list_algorithms ("/usr/local/lib/libmcrypt");

foreach ($algorithms as $cipher) {
        echo $cipher."/n";
}
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     The above example will produce a list with all supported
         algorithms in the "/usr/local/lib/libmcrypt" directory.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.mcrypt-list-modes">
   <refnamediv>
    <refname>mcrypt_list_modes</refname>
    <refpurpose>Get an array of all supported modes</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>mcrypt_list_modes</function></funcdef>
      <paramdef>string
           <parameter>
            <optional>lib_dir</optional>
           </parameter>
          </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Mcrypt_list_modes</function> is used to get an
     array of all supported modes in the
     <parameter>lib_dir</parameter>.
    </para>
    <para>
     <function>Mcrypt_list_modes</function> takes as optional
     parameter a directory which specifies the directory where all
     modes are located. If not specifies, the value of the
         mcrypt.modes_dir php.ini directive is used.
    </para>
    <para>
     <example>
      <title><function>Mcrypt_list_modes</function> Example</title>
      <programlisting role="php">
&lt;?php
$modes = mcrypt_list_modes ();

foreach ($modes as $mode) {
        echo "$mode &lt;/br&gt;";
}
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     The above example will produce a list with all supported
         algorithms in the default mode directory. If it is not set
     with the ini directive mcrypt.modes_dir, the default directory
     of mcrypt is used (which is /usr/local/lib/libmcrypt).
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.mcrypt-get-iv-size">
   <refnamediv>
    <refname>mcrypt_get_iv_size</refname>
    <refpurpose>Returns the size of the IV belonging to a specific cipher/mode 
combination</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcrypt_get_iv_size</function></funcdef>
      <paramdef>string <parameter>cipher</parameter></paramdef>
      <paramdef>string <parameter>mode</parameter></paramdef>
     </funcprototype>
     <funcprototype>
      <funcdef>int <function>mcrypt_get_iv_size</function></funcdef>
      <paramdef>resource <parameter>td</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The first prototype is when linked against libmcrypt 2.2.x, the
     second when linked against libmcrypt 2.4.x.
    </para>
    <para>
     <function>Mcrypt_get_iv_size</function> returns the size of
     the Initialisation Vector (IV) in bytes. On error the function
     returns FALSE. If the IV is ignored in the specified cipher/mode
     combination zero is returned.
    </para>
    <para>
     <parameter>Cipher</parameter> is one of the MCRYPT_ciphername
     constants of the name of the algorithm as string.
    </para>
    <para>
     <parameter>Mode</parameter> is one of the MCRYPT_MODE_modename
     constants of one of "ecb", "cbc", "cfb", "ofb", "nofb" or 
     "stream".
    </para>
    <para>
     <parameter>Td</parameter> is the algorithm specified.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.mcrypt-encrypt">
   <refnamediv>
    <refname>mcrypt_encrypt</refname>
    <refpurpose>Encrypts plaintext with given parameters</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mcrypt_encrypt</function></funcdef>
      <paramdef>string <parameter>cipher</parameter></paramdef>
      <paramdef>string <parameter>key</parameter></paramdef>
      <paramdef>string <parameter>data</parameter></paramdef>
      <paramdef>string <parameter>mode</parameter></paramdef>
      <paramdef>string 
       <parameter>
        <optional>iv</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Mcrypt_encrypt</function> encrypts the data
     and returns the encrypted data.
    </para>
    <para>
     <parameter>Cipher</parameter> is one of the MCRYPT_ciphername
     constants of the name of the algorithm as string.
    </para>
    <para>
     <parameter>Key</parameter> is the key with which the data
     will be encrypted. If it's smaller that the required keysize, it
     is padded with '\0'. It is better not to use ASCII strings for
     keys. It is recommended to use the mhash functions to create a key 
     from a string.
    </para>
    <para>
     <parameter>Data</parameter> is the data that will be encrypted
     with the given cipher and mode. If the size of the data is not
     n * blocksize, the data will be padded with '\0'. The returned
     crypttext can be larger that the size of the data that is given
     by <parameter>data</parameter>.
    </para>
    <para>
     <parameter>Mode</parameter> is one of the MCRYPT_MODE_modename
     constants of one of "ecb", "cbc", "cfb", "ofb", "nofb" or 
     "stream".
    </para>
    <para>
     The <parameter>IV</parameter> parameter is used for the
     initialisation in CBC, CFB, OFB modes, and in some algorithms
     in STREAM mode. If you do not supply an IV, while it is needed
     for an algorithm, the function issues a warning and uses an
     IV with all bytes set to '\0'.
    </para>
    <para>
     <example>
      <title><function>Mcrypt_encrypt</function> Example</title>
      <programlisting role="php">
&lt;?php
$iv = mcrypt_create_iv (mcrypt_get_iv_size (MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), 
MCRYPT_RAND);
$key = "This is a very secret key";
$text = "Meet me at 11 o'clock behind the monument.";
echo strlen ($text)."\n";

$crypttext = mcrypt_encrypt (MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, $iv);
echo strlen ($crypttext)."\n";
?&gt;
      </programlisting>
     </example>
     The above example will print out:
     <programlisting>
42
64
     </programlisting>
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.mcrypt-decrypt">
   <refnamediv>
    <refname>mcrypt_decrypt</refname>
    <refpurpose>Decrypts crypttext with given parameters</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mcrypt_decrypt</function></funcdef>
      <paramdef>string <parameter>cipher</parameter></paramdef>
      <paramdef>string <parameter>key</parameter></paramdef>
      <paramdef>string <parameter>data</parameter></paramdef>
      <paramdef>string <parameter>mode</parameter></paramdef>
      <paramdef>string 
       <parameter>
        <optional>iv</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Mcrypt_decrypt</function> decrypts the data
     and returns the unencrypted data.
    </para>
    <para>
     <parameter>Cipher</parameter> is one of the MCRYPT_ciphername
     constants of the name of the algorithm as string.
    </para>
    <para>
     <parameter>Key</parameter> is the key with which the data
     is encrypted. If it's smaller that the required keysize, it
     is padded with '\0'.
    </para>
    <para>
     <parameter>Data</parameter> is the data that will be decrypted
     with the given cipher and mode. If the size of the data is not
     n * blocksize, the data will be padded with '\0'.
    </para>
    <para>
     <parameter>Mode</parameter> is one of the MCRYPT_MODE_modename
     constants of one of "ecb", "cbc", "cfb", "ofb", "nofb" or 
     "stream".
    </para>
    <para>
     The <parameter>IV</parameter> parameter is used for the
     initialisation in CBC, CFB, OFB modes, and in some algorithms
     in STREAM mode. If you do not supply an IV, while it is needed
     for an algorithm, the function issues a warning and uses an
     IV with all bytes set to '\0'.
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.mcrypt-module-open">
   <refnamediv>
    <refname>mcrypt_module_open</refname>
    <refpurpose>This function opens the module of the algorithm and the mode to be 
used</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>mcrypt_module_open</function></funcdef>
      <paramdef>string <parameter>algorithm</parameter></paramdef>
      <paramdef>string <parameter>algorithm_directory</parameter></paramdef>
      <paramdef>string <parameter>mode</parameter></paramdef>
      <paramdef>string <parameter>mode_directory</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function opens the module of the algorithm and the mode
     to be used. The name of the algorithm is specified in algorithm,
     eg "twofish" or is one of the MCRYPT_ciphername constants.
     The library is closed by calling 
     <function>mcrypt_module_close</function>, but there is no need
     to call that function if <function>mcrypt_generic_end</function>
     is called. Normally it returns an encryption descriptor, or
     FALSE on error.
    </para>
    <para>
     The <parameter>algorithm_directory</parameter> and
     <parameter>mode_directory</parameter> are used to locate the
     encryption modules. When you supply a directory name, it is used.
     When you set one of these to the empty string (""), the value set
     by the <parameter>mcrypt.algorithms_dir</parameter> or
     <parameter>mcrypt.modes_dir</parameter> ini-directive is used.
     When these are not set, the default directory are used that are
     compiled in into libmcrypt (usally /usr/local/lib/libmcrypt).
    </para>
    <para>
     <example>
      <title><function>Mcrypt_module_open</function> Example</title>
      <programlisting role="php">
&lt;?php
$td = mcrypt_module_open (MCRYPT_DES, "", MCRYPT_MODE_ECB, "/usr/lib/mcrypt-modes");
?&gt;
      </programlisting>
     </example>
     The above example will try to open the DES cipher from the default
     directory and the EBC mode from the directory /usr/lib/mcrypt-modes.
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.mcrypt-generic-init">
   <refnamediv>
    <refname>mcrypt_generic_init</refname>
    <refpurpose>This function initializes all buffers needed for 
encryption</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcrypt_generic_init</function></funcdef>
      <paramdef>resource <parameter>td</parameter></paramdef>
      <paramdef>string <parameter>key</parameter></paramdef>
      <paramdef>string <parameter>iv</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The maximum length of the key should be the one obtained by
     calling <function>mcrypt_enc_get_key_size</function> and every
     value smaller than this is legal. The IV should normally have
     the size of the algorithms block size, but you must obtain the
     size by calling <function>mcrypt_enc_get_iv_size</function>.
     IV is ignored in ECB. IV MUST exist in CFB, CBC, STREAM, nOFB
     and OFB modes. It needs to be random and unique (but not secret).
     The same IV must be used for encryption/decryption. If you do not
     want to use it you should set it to zeros, but this is not
     recommended. The function returns (-1) on error.
    </para>
    <para>
     You need to call this function before every
     <function>mcrypt_generic</function> or
     <function>mdecrypt_generic</function>.
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.mcrypt-generic">
   <refnamediv>
    <refname>mcrypt_generic</refname>
    <refpurpose>This function encrypts data</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mcrypt_generic</function></funcdef>
      <paramdef>resource <parameter>td</parameter></paramdef>
      <paramdef>string <parameter>data</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function encrypts data. The data is padded with "\0"
     to make sure the length of the data is n * blocksize. This
     function returns the encrypted data. Note that the length
     of the returned string can in fact be longer then the input,
     due to the padding of the data.
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.mdecrypt-generic">
   <refnamediv>
    <refname>mdecrypt_generic</refname>
    <refpurpose>This function decrypts data</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mdecrypt_generic</function></funcdef>
      <paramdef>resource <parameter>td</parameter></paramdef>
      <paramdef>string <parameter>data</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function decrypts data. Note that the length of the
     returned string can in fact be longer then the unencrypted
     string, due to the padding of the data.
    </para>
    <para>
     <example>
      <title><function>Mdecrypt_generic</function> Example</title>
      <programlisting role="php">
&lt;?php
$iv_size = mcrypt_enc_get_iv_size ($td));
$iv = @mcrypt_create_iv ($iv_size, MCRYPT_RAND);

if (@mcrypt_generic_init ($td, $key, $iv) != -1)
{
    $c_t = mcrypt_generic ($td, $plain_text);
    @mcrypt_generic_init ($td, $key, $iv);
    $p_t = mdecrypt_generic ($td, $c_t);
}
if (strncmp ($p_t, $plain_text, strlen($plain_text)) == 0)
    echo "ok";
else
    echo "error";
?&gt;
      </programlisting>
     </example>
     The above example shows how to check if the data before the
     encryption is the same as the data after the decryption.
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.mcrypt-generic-end">
   <refnamediv>
    <refname>mcrypt_generic_end</refname>
    <refpurpose>This function terminates encryption</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>mcrypt_generic_end</function></funcdef>
      <paramdef>resource <parameter>td</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function terminates encryption specified by the encryption
     descriptor (td). Actually it clears all buffers, and closes
     all the modules used. Returns FALSE on error, or TRUE on succes.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcrypt-enc-self-test">
   <refnamediv>
    <refname>mcrypt_enc_self_test</refname>
    <refpurpose>This function runs a self test on the opened module</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcrypt_enc_self_test</function></funcdef>
      <paramdef>resource <parameter>td</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function runs the self test on the algorithm specified by the
     descriptor td. If the self test succeeds it returns zero. In case
     of an error, it returns 1.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcrypt-enc-is-block-algorithm-mode">
   <refnamediv>
    <refname>mcrypt_enc_is_block_algorithm_mode</refname>
    <refpurpose>Checks whether the encryption of the opened mode works on 
blocks</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcrypt_enc_is_block_algorithm_mode</function></funcdef>
      <paramdef>resource <parameter>td</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns 1 if the mode is for use with block algorithms,
     otherwise it returns 0. (eg. 0 for stream, and 1 for cbc, cfb, ofb).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcrypt-enc-is-block-algorithm">
   <refnamediv>
    <refname>mcrypt_enc_is_block_algorithm</refname>
    <refpurpose>Checks whether the algorithm of the opened mode is a block 
algorithm</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcrypt_enc_is_block_algorithm</function></funcdef>
      <paramdef>resource <parameter>td</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns 1 if the algorithm is a block algorithm,
     or 0 if it is a stream algorithm.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcrypt-enc-is-block-mode">
   <refnamediv>
    <refname>mcrypt_enc_is_block_mode</refname>
    <refpurpose>Checks whether the opened mode outputs blocks</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcrypt_enc_is_block_mode</function></funcdef>
      <paramdef>resource <parameter>td</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns 1 if the mode outputs blocks of bytes or
     0 if it outputs bytes. (eg. 1 for cbc and ecb, and 0 for cfb and
     stream).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcrypt-enc-get-block-size">
   <refnamediv>
    <refname>mcrypt_enc_get_block_size</refname>
    <refpurpose>Returns the blocksize of the opened algorithm</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcrypt_enc_get_block_size</function></funcdef>
      <paramdef>resource <parameter>td</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns the block size of the algorithm specified by
     the encryption descriptor td in bytes.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcrypt-enc-get-key-size">
   <refnamediv>
    <refname>mcrypt_enc_get_key_size</refname>
    <refpurpose>Returns the maximum supported keysize of the opened mode</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcrypt_enc_get_key_size</function></funcdef>
      <paramdef>resource <parameter>td</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns the maximum supported key size of the
     algorithm specified by the encryption descriptor td in bytes.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcrypt-enc-get-supported-key-sizes">
   <refnamediv>
    <refname>mcrypt_enc_get_supported_key_sizes</refname>
    <refpurpose>Returns an array with the supported keysizes of the opened 
algorithm</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>mcrypt_enc_get_supported_key_sizes</function></funcdef>
      <paramdef>resource <parameter>td</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array with the key sizes supported by the algorithm
     specified by the encryption descriptor. If it returns an empty
     array then all key sizes between 1 and
     <function>mcrypt_enc_get_key_size</function> are supported by the
     algorithm.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcrypt-enc-get-iv-size">
   <refnamediv>
    <refname>mcrypt_enc_get_iv_size</refname>
    <refpurpose>Returns the size of the IV of the opened algorithm</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcrypt_enc_get_iv_size</function></funcdef>
      <paramdef>resource <parameter>td</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns the size of the iv of the algorithm
     specified by the encryption descriptor in bytes. If it returns
     '0' then the IV is ignored in the algorithm. An IV is used in
     cbc, cfb and ofb modes, and in some algorithms in stream mode.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcrypt-enc-get-algorithms-name">
   <refnamediv>
    <refname>mcrypt_enc_get_algorithms_name</refname>
    <refpurpose>Returns the name of the opened algorithm</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mcrypt_enc_get_algorithms_name</function></funcdef>
      <paramdef>resource <parameter>td</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns the name of the algorithm.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcrypt-enc-get-modes-name">
   <refnamediv>
    <refname>mcrypt_enc_get_modes_name</refname>
    <refpurpose>Returns the name of the opened mode</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mcrypt_enc_get_modes_name</function></funcdef>
      <paramdef>resource <parameter>td</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns the name of the mode.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcrypt-module-self-test">
   <refnamediv>
    <refname>mcrypt_module_self_test</refname>
    <refpurpose>This function runs a self test on the specified module</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>mcrypt_module_self_test</function></funcdef>
      <paramdef>string <parameter>algorithm</parameter></paramdef>
      <paramdef>string <parameter><optional>lib_dir</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function runs the self test on the algorithm specified.
     The optional <parameter>lib_dir</parameter> parameter can contain
     the location of where the algorithm module is on the system.
    </para>
    <para>
     The function returns TRUE if the self test succeeds, or FALSE when
     if fails.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcrypt-module-is-block-algorithm-mode">
   <refnamediv>
    <refname>mcrypt_module_is_block_algorithm_mode</refname>
    <refpurpose>This function returns if the the specified module is a block algorithm 
or not</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool 
<function>mcrypt_module_is_block_algorithm_mode</function></funcdef>
      <paramdef>string <parameter>mode</parameter></paramdef>
      <paramdef>string <parameter><optional>lib_dir</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns TRUE if the mode is for use with block algorithms,
     otherwise it returns 0. (eg. 0 for stream, and 1 for cbc, cfb, ofb).
     The optional <parameter>lib_dir</parameter> parameter can contain
     the location where the mode module is on the system.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcrypt-module-is-block-algorithm">
   <refnamediv>
    <refname>mcrypt_module_is_block_algorithm</refname>
    <refpurpose>This function checks whether the specified algorithm is a block 
algorithm</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>mcrypt_module_is_block_algorithm</function></funcdef>
      <paramdef>string <parameter>algorithm</parameter></paramdef>
      <paramdef>string <parameter><optional>lib_dir</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns TRUE if the specified algorithm is a block
     algorithm, or FALSE is it is a stream algorithm.
     The optional <parameter>lib_dir</parameter> parameter can contain
     the location where the algorithm module is on the system.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcrypt-module-is-block-mode">
   <refnamediv>
    <refname>mcrypt_module_is_block_mode</refname>
    <refpurpose>This function returns if the the specified mode outputs blocks or 
not</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>mcrypt_module_is_block_mode</function></funcdef>
      <paramdef>string <parameter>mode</parameter></paramdef>
      <paramdef>string <parameter><optional>lib_dir</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns TRUE if the mode outputs blocks of bytes or
     FALSE if it outputs just bytes. (eg. 1 for cbc and ecb, and 0 for cfb
     and stream). The optional <parameter>lib_dir</parameter> parameter
     can contain the location where the mode module is on the system.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcrypt-module-get-algo-block-size">
   <refnamediv>
    <refname>mcrypt_module_get_algo_block_size</refname>
    <refpurpose>Returns the blocksize of the specified algorithm</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcrypt_module_get_algo_block_size</function></funcdef>
      <paramdef>string <parameter>algorithm</parameter></paramdef>
      <paramdef>string <parameter><optional>lib_dir</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns the block size of the algorithm specified in
     bytes. The optional <parameter>lib_dir</parameter> parameter
     can contain the location where the mode module is on the system.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcrypt-module-get-algo-key-size">
   <refnamediv>
    <refname>mcrypt_module_get_algo_key_size</refname>
    <refpurpose>Returns the maximum supported keysize of the opened mode</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mcrypt_module_get_algo_key_size</function></funcdef>
      <paramdef>string <parameter>algorithm</parameter></paramdef>
      <paramdef>string <parameter><optional>lib_dir</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns the maximum supported key size of the
     algorithm specified in bytes. The optional
     <parameter>lib_dir</parameter> parameter can contain the
     location where the mode module is on the system.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mcrypt-module-get-algo-supported-key-sizes">
   <refnamediv>
    <refname>mcrypt_module_get_algo_supported_key_sizes</refname>
    <refpurpose>Returns an array with the supported keysizes of the opened 
algorithm</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array 
<function>mcrypt_module_enc_get_algo_supported_key_sizes</function></funcdef>
      <paramdef>string <parameter>algorithm</parameter></paramdef>
      <paramdef>string <parameter><optional>lib_dir</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array with the key sizes supported by the specified
     algorithm. If it returns an empty array then all key sizes
     between 1 and <function>mcrypt_module_get_algo_key_size</function>
     are supported by the algorithm. The optional
     <parameter>lib_dir</parameter> parameter can contain the
     location where the mode module is on the system.
    </para>
   </refsect1>
  </refentry>
 
 </reference> 

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/mhash.xml
+++ phpdoc/kr/functions/mhash.xml
 <reference id="ref.mhash">
  <title>Mhash Functions</title>
  <titleabbrev>mhash</titleabbrev>
  
  <partintro>
   <para>
    These functions are intended to work with <ulink
    url="&url.mhash;">mhash</ulink>.</para>
   <para>
    This is an interface to the mhash library. mhash supports a wide
    variety of hash algorithms such as MD5, SHA1, GOST, and many
    others.
   </para>
   <para>
    To use it, download the mhash distribution from <ulink
    url="&url.mhash;">its web site</ulink> and follow the included
    installation instructions. You need to compile PHP with the
    <option role="configure">--with-mhash</option> parameter to enable
    this extension.
   </para>
   <para>
    Mhash can be used to create checksums, message digests, message
    authentication codes, and more.
   </para>
   <para>
    <example>
     <title>Compute the MD5 digest and hmac and print it out as hex</title>
     <programlisting role="php">
&lt;?php
$input = "what do ya want for nothing?";
$hash = mhash (MHASH_MD5, $input);
print "The hash is ".bin2hex ($hash)."\n&lt;br>";
$hash = mhash (MHASH_MD5, $input, "Jefe");
print "The hmac is ".bin2hex ($hash)."\n&lt;br>";
?&gt;
     </programlisting>
    </example>
    This will produce:
    <programlisting>
The hash is d03cb659cbf9192dcd066272249f8412 
The hmac is 750c783e6ab0b503eaa86e310a5db738 
    </programlisting>
    For a complete list of supported hashes, refer to the
    documentation of mhash. The general rule is that you can access
    the hash algorithm from PHP with MHASH_HASHNAME. For example, to
    access TIGER you use the PHP constant MHASH_TIGER.
   </para>
   <para>
    Here is a list of hashes which are currently supported by mhash. If a
    hash is not listed here, but is listed by mhash as supported, you can
    safely assume that this documentation is outdated.
    <itemizedlist>
     <listitem>
      <simpara>
       MHASH_MD5
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MHASH_SHA1
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MHASH_HAVAL256
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MHASH_HAVAL192
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MHASH_HAVAL160
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MHASH_HAVAL128
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MHASH_RIPEMD160
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MHASH_GOST
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MHASH_TIGER
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MHASH_CRC32
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       MHASH_CRC32B
      </simpara>
     </listitem>
    </itemizedlist>
   </para>
  </partintro>
  
  <refentry id="function.mhash-get-hash-name">
   <refnamediv>
    <refname>mhash_get_hash_name</refname>
    <refpurpose>Get the name of the specified hash</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mhash_get_hash_name</function></funcdef>
      <paramdef>int <parameter>hash</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Mhash_get_hash_name</function> is used to get the name
     of the specified hash.
    </para>
    <para>
     <function>mhash_get_hash_name</function> takes the hash id as an
     argument and returns the name of the hash or false, if the hash
     does not exist.
    </para>
    <para>
     <example>
      <title><function>Mhash_get_hash_name</function> Example</title>
      <programlisting>
&lt;?php
$hash = MHASH_MD5;

print mhash_get_hash_name ($hash);
?&gt;
      </programlisting>
     </example>
     The above example will print out:
     <programlisting>
MD5
     </programlisting>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.mhash-get-block-size">
   <refnamediv>
    <refname>mhash_get_block_size</refname>
    <refpurpose>Get the block size of the specified hash</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mhash_get_block_size</function></funcdef>
      <paramdef>int <parameter>hash</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Mhash_get_block_size</function> is used to get the size
     of a block of the specified <parameter>hash</parameter>.
    </para>
    <para>
     <function>Mhash_get_block_size</function> takes one argument, the
     <parameter>hash</parameter> and returns the size in bytes or
     false, if the <parameter>hash</parameter> does not exist.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.mhash-count">
   <refnamediv>
    <refname>mhash_count</refname>
    <refpurpose>Get the highest available hash id</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mhash_count</function></funcdef>
      <paramdef>void </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Mhash_count</function> returns the highest available hash
     id. Hashes are numbered from 0 to this hash id.
    </para>
    <para>
     <example>
      <title>Traversing all hashes</title>
      <programlisting role="php">
&lt;?php

$nr = mhash_count();

for ($i = 0; $i &lt;= $nr; $i++) {
    echo sprintf ("The blocksize of %s is %d\n", 
        mhash_get_hash_name ($i),
        mhash_get_block_size ($i));
}
?&gt;
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.mhash">
   <refnamediv>
    <refname>mhash</refname>
    <refpurpose>Compute hash</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mhash</function></funcdef>
      <paramdef>int <parameter>hash</parameter></paramdef>
      <paramdef>string <parameter>data</parameter></paramdef>
      <paramdef>string <parameter>[ key ]</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Mhash</function> applies a hash function specified by
     <parameter>hash</parameter> to the <parameter>data</parameter> and
     returns the resulting hash (also called digest). If the <parameter> 
key</parameter>
     is specified it will return the resulting HMAC. HMAC is keyed hashing
     for message authentication, or simply a message digest that depends on 
     the specified key. Not all algorithms supported in mhash can be used in 
     HMAC mode. In case of an error returns false.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mhash-keygen-s2k">
   <refnamediv>
    <refname>mhash_keygen_s2k</refname>
    <refpurpose>Generates a key</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mhash_keygen_s2k</function></funcdef>
      <paramdef>int <parameter>hash</parameter></paramdef>
      <paramdef>string <parameter>password</parameter></paramdef>
      <paramdef>string <parameter>salt</parameter></paramdef>
      <paramdef>int <parameter>bytes</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Mhash_keygen_s2k</function> generates a key that is
     <parameter>bytes</parameter> long, from a user given password.
     This is the Salted S2K algorithm as specified in the OpenPGP
     document (RFC 2440). That algorithm will use the specified
     <parameter>hash</parameter> algorithm to create the key.
     The <parameter>salt</parameter> must be different and random
     enough for every key you generate in order to create different keys.
     That salt must be known when you check the keys, thus it is
     a good idea to append the key to it. Salt has a fixed length
     of 8 bytes and will be padded with zeros if you supply less bytes.
     Keep in mind that user supplied passwords are not really suitable
     to be used as keys in cryptographic algorithms, since users normally
     choose keys they can write on keyboard. These passwords use
     only 6 to 7 bits per character (or less). It is highly recommended
     to use some kind of tranformation (like this function) to the user 
     supplied key.
    </para>
   </refsect1>
  </refentry>

 </reference> 

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/misc.xml
+++ phpdoc/kr/functions/misc.xml
 <reference id="ref.misc">
  <title>Miscellaneous functions</title>
  <titleabbrev>Misc.</titleabbrev>

  <partintro>
   <para>
    These functions were placed here because none of the other
    categories seemed to fit.
   </para>
  </partintro>

  <refentry id="function.connection-aborted">
   <refnamediv>
    <refname>connection_aborted</refname>
    <refpurpose>Returns true if client disconnected</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>connection_aborted</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns true if client disconnected.  See the <link
     linkend="features.connection-handling">Connection Handling</link>
     description in the <link linkend="features">Features</link>
     chapter for a complete explanation.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.connection-status">
   <refnamediv>
    <refname>connection_status</refname>
    <refpurpose>Returns connection status bitfield</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>connection_status</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns the connection status bitfield.  See the <link
     linkend="features.connection-handling">Connection Handling</link>
     description in the <link linkend="features">Features</link>
     chapter for a complete explanation.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.connection-timeout">
   <refnamediv>
    <refname>connection_timeout</refname>
    <refpurpose>Return true if script timed out</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>connection_timeout</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns true if script timed out.    See the <link
     linkend="features.connection-handling">Connection Handling</link>
     description in the <link linkend="features">Features</link>
     chapter for a complete explanation.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.define">
   <refnamediv>
    <refname>define</refname>
    <refpurpose>Defines a named constant.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>define</function></funcdef>
      <paramdef>string <parameter>name</parameter></paramdef>
      <paramdef>mixed <parameter>value</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>case_insensitive</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Defines a named constant, which is similar to a variable except:
     <itemizedlist>
      <listitem>
       <simpara>
    Constants do not have a dollar sign '$' before them;
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    Constants may be accessed anywhere without regard to variable
    scoping rules;
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    Constants may not be redefined or undefined once they have
    been set; and
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    Constants may only evaluate to scalar values.
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     The name of the constant is given by <parameter>name</parameter>;
     the value is given by <parameter>value</parameter>.
    </para>
    <para>
     The optional third parameter
     <parameter>case_insensitive</parameter> is also available. If the
     value <emphasis>1</emphasis> is given, then the constant will be
     defined case-insensitive. The default behaviour is
     case-sensitive; i.e. CONSTANT and Constant represent different
     values.
    </para>
    <para>
     <example>
      <title>Defining Constants</title>
      <programlisting role="php">
&lt;?php
define ("CONSTANT", "Hello world.");
echo CONSTANT; // outputs "Hello world."
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     <function>Define</function> returns TRUE on success and FALSE if
     an error occurs.
    </para>
    <para>
     See also <function>defined</function> and the section on <link
     linkend="language.constants">Constants</link>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.defined">
   <refnamediv>
    <refname>defined</refname>
    <refpurpose>
     Checks whether a given named constant exists
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>defined</function></funcdef>
      <paramdef>string <parameter>name</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true if the named constant given by
     <parameter>name</parameter> has been defined, false otherwise.
      <example>
      <title>Checking Constants</title>
      <programlisting role="php">
&lt;?php
if (defined("CONSTANT")){ // Note that it should be quoted
    echo CONSTANT; //
    }
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>define</function> and the section on <link
     linkend="language.constants">Constants</link>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.die">
   <refnamediv>
    <refname>die</refname>
    <refpurpose>
     Output a message and terminate the current script
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>die</function></funcdef>
      <paramdef>string <parameter>message</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     This language construct outputs a message and terminates parsing
     of the script.  It does not return anything.
    </simpara>
    <para>
     <example>
      <title>die example</title>
      <programlisting role="php">
&lt;?php
$filename = '/path/to/data-file';
$file = fopen ($filename, 'r')
    or die("unable to open file ($filename)");
?&gt;
      </programlisting>
     </example>
    </para>
    <simpara>
     See also <function>exit</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.eval">
   <refnamediv>
    <refname>eval</refname>
    <refpurpose>Evaluate a string as PHP code</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>eval</function></funcdef>
      <paramdef>string <parameter>code_str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>eval</function> evaluates the string given in
     <parameter>code_str</parameter> as PHP code. Among other things,
     this can be useful for storing code in a database text field for
     later execution.
    </simpara>
    <simpara>
     There are some factors to keep in mind when using
     <function>eval</function>. Remember that the string passed must
     be valid PHP code, including things like terminating statements
     with a semicolon so the parser doesn't die on the line after the
     <function>eval</function>, and properly escaping things in
     <parameter>code_str</parameter>.
    </simpara> 
    <simpara>
     Also remember that variables given values under
     <function>eval</function> will retain these values in the main
     script afterwards.
    </simpara>
    <simpara>
     A <literal>return</literal> statement will terminate the evaluation of 
     the string immediatley. In PHP 4 you may use <literal>return</literal>
     to return a value that will become the result of the 
     <function>eval</function> function while in PHP 3 
     <function>eval</function> was of type <literal>void</literal> and did 
     never return anything.
    </simpara>
    <para>
     <example>
      <title>
       <function>Eval</function> example - simple text merge
      </title>
      <programlisting role="php">
&lt;?php
$string = 'cup';
$name = 'coffee';
$str = 'This is a $string with my $name in it.&lt;br&gt;';
echo $str;
eval ("\$str = \"$str\";");
echo $str;
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     The above example will show:
     <programlisting>
This is a $string with my $name in it.
This is a cup with my coffee in it.
     </programlisting>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.exit">
   <refnamediv>
    <refname>exit</refname>
    <refpurpose>Terminate current script</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>exit</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     This language construct terminates parsing of the script.    It
     does not return.
    </simpara>
    <simpara>
     See also <function>die</function>.
    </simpara>
   </refsect1>
  </refentry> 

  <refentry id="function.get-browser">
   <refnamediv>
    <refname>get_browser</refname>
    <refpurpose>
     Tells what the user's browser is capable of
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>object <function>get_browser</function></funcdef>
      <paramdef>string 
       <parameter><optional>user_agent</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>get_browser</function> attempts to determine the
     capabilities of the user's browser. This is done by looking up
     the browser's information in the
     <filename>browscap.ini</filename> file. By default, the value of
     $HTTP_USER_AGENT is used; however, you can alter this (i.e., look
     up another browser's info) by passing the optional
     <parameter>user_agent</parameter> parameter to
     <function>get_browser</function>.
    </simpara>
    <simpara>
     The information is returned in an object, which will contain
     various data elements representing, for instance, the browser's
     major and minor version numbers and ID string; true/false values
     for features such as frames, JavaScript, and cookies; and so
     forth.
    </simpara>
    <simpara>
     While <filename>browscap.ini</filename> contains information on
     many browsers, it relies on user updates to keep the database
     current. The format of the file is fairly self-explanatory.
    </simpara>
    <para>
     The following example shows how one might list all available
     information retrieved about the user's browser.
     <example>
      <title><function>Get_browser</function> example</title>
      <programlisting role="php">
&lt;?php
function list_array ($array) {
    while (list ($key, $value) = each ($array)) {
    $str .= "&lt;b&gt;$key:&lt;/b&gt; $value&lt;br&gt;\n";
    }
    return $str;
}
echo "$HTTP_USER_AGENT&lt;hr&gt;\n";
$browser = get_browser();
echo list_array ((array) $browser);
?&gt;
      </programlisting>
     </example>
    </para>
    <simpara>
     The output of the above script would look something like this:
    </simpara>
    <programlisting>
Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586)&lt;hr&gt;
&lt;b&gt;browser_name_pattern:&lt;/b&gt; Mozilla/4\.5.*&lt;br&gt;
&lt;b&gt;parent:&lt;/b&gt; Netscape 4.0&lt;br&gt;
&lt;b&gt;platform:&lt;/b&gt; Unknown&lt;br&gt;
&lt;b&gt;majorver:&lt;/b&gt; 4&lt;br&gt;
&lt;b&gt;minorver:&lt;/b&gt; 5&lt;br&gt;
&lt;b&gt;browser:&lt;/b&gt; Netscape&lt;br&gt;
&lt;b&gt;version:&lt;/b&gt; 4&lt;br&gt;
&lt;b&gt;frames:&lt;/b&gt; 1&lt;br&gt;
&lt;b&gt;tables:&lt;/b&gt; 1&lt;br&gt;
&lt;b&gt;cookies:&lt;/b&gt; 1&lt;br&gt;
&lt;b&gt;backgroundsounds:&lt;/b&gt; &lt;br&gt;
&lt;b&gt;vbscript:&lt;/b&gt; &lt;br&gt;
&lt;b&gt;javascript:&lt;/b&gt; 1&lt;br&gt;
&lt;b&gt;javaapplets:&lt;/b&gt; 1&lt;br&gt;
&lt;b&gt;activexcontrols:&lt;/b&gt; &lt;br&gt;
&lt;b&gt;beta:&lt;/b&gt; &lt;br&gt;
&lt;b&gt;crawler:&lt;/b&gt; &lt;br&gt;
&lt;b&gt;authenticodeupdate:&lt;/b&gt; &lt;br&gt;
&lt;b&gt;msn:&lt;/b&gt; &lt;br&gt;
    </programlisting>
    <simpara>
     In order for this to work, your <link
     linkend="ini.sect.browscap">browscap</link> configuration file
     setting must point to the correct location of the
     <filename>browscap.ini</filename> file.
    </simpara>
    <simpara>
     For more information (including locations from which you may
     obtain a <filename>browscap.ini</filename> file), check the PHP
     FAQ at <ulink
     url="&url.php.faq;">&url.php.faq;</ulink>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.highlight-file">
   <refnamediv>
    <refname>highlight_file</refname>
    <refpurpose>Syntax highlighting of a file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>highlight_file</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     The <function>highlight_file</function> function prints out a syntax
     higlighted version of the code contained in <parameter>filename</parameter> 
     using the colors defined in the built-in syntax highlighter for PHP.
     It returns true on success, false otherwise (PHP 4).
    </simpara>
   <para>
     <example>
      <title>Creating a source highlighting URL</title>
      <simpara>
       To setup a URL that can code hightlight any script that you pass to
       it, we will make use of the &quot;ForceType&quot; directive in
       Apache to generate a nice URL pattern, and use the 
       function <function>highlight_file</function> to show a nice looking
       code list.
      </simpara>
      <simpara>
       In your httpd.conf you can add the following:
      </simpara>
      <para>
       <informalexample><programlisting>
&lt;Location /source&gt;
    ForceType application/x-httpd-php
&lt;/Location&gt;
       </programlisting></informalexample>
      </para>
      <simpara>
       And then make a file named &quot;source&quot; and put it in your
       web root directory.
      </simpara>
      <para>
       <programlisting role="php">
&lt;HTML&gt;
&lt;HEAD&gt;
&lt;TITLE&gt;Source Display&lt;/TITLE&gt;
&lt;/HEAD&gt;
&lt;BODY BGCOLOR=&quot;white&quot;&gt;
&lt;?php
    $script = getenv (&quot;PATH_TRANSLATED&quot;);
    if(!$script) {
    echo &quot;&lt;BR&gt;&lt;B&gt;ERROR: Script Name needed&lt;/B&gt;&lt;BR&gt;&quot;;
    } else {
    if (ereg(&quot;(\.php|\.inc)$&quot;,$script)) {
    echo &quot;&lt;H1&gt;Source of: $PATH_INFO&lt;/H1&gt;\n&lt;HR&gt;\n&quot;;
    highlight_file($script);
    } else {
    echo &quot;&lt;H1&gt;ERROR: Only PHP or include script names are 
allowed&lt;/H1&gt;&quot;; 
    }
    }
    echo &quot;&lt;HR&gt;Processed: &quot;.date(&quot;Y/M/d H:i:s&quot;,time());
?&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;
       </programlisting>
      </para>
      <simpara>
       Then you can use an URL like the one below to display a colorized
       version of a script located in &quot;/path/to/script.php&quot; 
       in your web site.
      </simpara>
      <para>
       <informalexample>
    <programlisting>
http://your.server.com/source/path/to/script.php
    </programlisting>
       </informalexample>
      </para>
     </example>
    </para>
    <simpara>
     See also <function>highlight_string</function>,
     <function>show_source</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.highlight-string">
   <refnamediv>
    <refname>highlight_string</refname>
    <refpurpose>Syntax highlighting of a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>highlight_string</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     The <function>highlight_string</function> function prints out a syntax
     highlighted version of <parameter>str</parameter> using the colors defined 
     in the built-in syntax highlighter for PHP.
     It returns true on success, false otherwise (PHP 4).
    </simpara>
    <simpara>
     See also <function>highlight_file</function>,
     <function>show_source</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ignore-user-abort">
   <refnamediv>
    <refname>ignore_user_abort</refname>
    <refpurpose>
     Set whether a client disconnect should abort script execution
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ignore_user_abort</function></funcdef>
      <paramdef>int 
       <parameter><optional>setting</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     This function sets whether a client disconnect should cause a
     script to be aborted.    It will return the previous setting and
     can be called without an argument to not change the current
     setting and only return the current setting.  See the <link
     linkend="features.connection-handling">Connection Handling</link>
     section in the <link linkend="features">Features</link> chapter
     for a complete description of connection handling in PHP.
    </simpara>
   </refsect1>
  </refentry> 
    
  <refentry id="function.iptcparse">
   <refnamediv>
    <refname>iptcparse</refname>
    <refpurpose>
     Parse a binary IPTC <ulink url="&url.iptc;">&url.iptc;</ulink>
     block into single tags.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>iptcparse</function></funcdef>
      <paramdef>string <parameter>iptcblock</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     This function parses a binary IPTC block into its single tags. It
     returns an array using the tagmarker as an index and the value as
     the value. It returns false on error or if no IPTC data was
     found.  See <function>GetImageSize</function> for a sample.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.leak">
   <refnamediv>
    <refname>leak</refname>
    <refpurpose>Leak memory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>leak</function></funcdef>
      <paramdef>int <parameter>bytes</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Leak</function> leaks the specified amount of memory.
    </simpara>
    <simpara>
     This is useful when debugging the memory manager, which
     automatically cleans up "leaked" memory when each request is
     completed.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.pack">
   <refnamediv>
    <refname>pack</refname>
    <refpurpose>Pack data into binary string.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>pack</function></funcdef>
      <paramdef>string <parameter>format</parameter></paramdef>
      <paramdef>mixed 
       <parameter><optional>args</optional></parameter> ...
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Pack given arguments into binary string according to
     <parameter>format</parameter>. Returns binary string containing
     data.
    </para>
    <para>
     The idea to this function was taken from Perl and all formatting
     codes work the same as there, however, there are some formatting
     codes that are missing such as Perl's "u" format code. The format
     string consists of format codes followed by an optional repeater
     argument. The repeater argument can be either an integer value or
     * for repeating to the end of the input data. For a, A, h, H the
     repeat count specifies how many characters of one data argument
     are taken, for @ it is the absolute position where to put the
     next data, for everything else the repeat count specifies how
     many data arguments are consumed and packed into the resulting
     binary string. Currently implemented are
     <itemizedlist>
      <listitem>
       <simpara>
    a NUL-padded string
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    A SPACE-padded string
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    h Hex string, low nibble first
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    H Hex string, high nibble first
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    c signed char
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    C unsigned char
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    s signed short (always 16 bit, machine byte order)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    S unsigned short (always 16 bit, machine byte order)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    n unsigned short (always 16 bit, big endian byte order)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    v unsigned short (always 16 bit, little endian byte order)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    i signed integer (machine dependent size and byte order)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    I unsigned integer (machine dependent size and byte order)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    l signed long (always 32 bit, machine byte order)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    L unsigned long (always 32 bit, machine byte order)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    N unsigned long (always 32 bit, big endian byte order)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    V unsigned long (always 32 bit, little endian byte order)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    f float (machine dependent size and representation)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    d double (machine dependent size and representation)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    x NUL byte
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    X Back up one byte
       </simpara>
      </listitem>
      <listitem>
       <simpara>
    @ NUL-fill to absolute position
       </simpara>
      </listitem>
     </itemizedlist>
     <example>
      <title><function>Pack</function> format string</title>
      <programlisting role="php">
$binarydata = pack ("nvc*", 0x1234, 0x5678, 65, 66);
      </programlisting>
      <para>
       The resulting binary string will be 6 bytes long and contain
       the byte sequence 0x12, 0x34, 0x78, 0x56, 0x41, 0x42.
      </para>
     </example>
    </para>
    <para>
     Note that the distinction between signed and unsigned values only 
     affects the function <function>unpack</function>, where as
     function <function>pack</function> gives the same result for
     signed and unsigned format codes.
    </para>
    <para>
     Also note that PHP internally stores integral values as signed
     values of a machine dependent size. If you give it an unsigned
     integral value too large to be stored that way it is converted to
     a double which often yields an undesired result.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.show-source">
   <refnamediv>
    <refname>show_source</refname>
    <refpurpose>Syntax highlighting of a file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>show_source</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     The <function>show_source</function> function prints out a syntax
     higlighted version of the code contained in <parameter>filename</parameter> 
     using the colors defined in the built-in syntax highlighter for PHP.
     It returns true on success, false otherwise (PHP 4).
    </simpara>
    <note>
     <simpara>
      This function is an alias for the function
      <function>highlight_file</function>
     </simpara>
    </note>
    <simpara>
     See also <function>highlight_string</function>,
     <function>highlight_file</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.sleep">
   <refnamediv>
    <refname>sleep</refname>
    <refpurpose>Delay execution</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>sleep</function></funcdef>
      <paramdef>int <parameter>seconds</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     The sleep function delays program execution for the given number
     of <parameter>seconds</parameter>.
    </simpara>
    <simpara>
     See also <function>usleep</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.uniqid">
   <refnamediv>
    <refname>uniqid</refname>
    <refpurpose>Generate a unique id</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>uniqid</function></funcdef>
      <paramdef>string <parameter>prefix</parameter></paramdef>
      <paramdef>boolean 
       <parameter><optional>lcg</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Uniqid</function> returns a prefixed unique identifier
     based on the current time in microseconds. The prefix can be
     useful for instance if you generate identifiers simultaneously on
     several hosts that might happen to generate the identifier at the
     same microsecond.    <parameter>Prefix</parameter> can be up to 114
     characters long.
    </simpara>
    <simpara>
     If the optional <parameter>lcg</parameter> parameter is true,
     <function>uniqid</function> will add additional "combined LCG"
     entropy at the end of the return value, which should make the
     results more unique.
    </simpara>
    <simpara>
     With an empty <parameter>prefix</parameter>, the returned string
     will be 13 characters long.  If <parameter>lcg</parameter> is
     true, it will be 23 characters.
    </simpara>
    <note>
     <simpara>
      The <parameter>lcg</parameter> parameter is only available in
      PHP 4 and PHP 3.0.13 and later.
     </simpara>
    </note>
    <para>
     If you need a unique identifier or token and you intend to give
     out that token to the user via the network (i.e. session cookies),
     it is recommended that you use something along the lines of
     <informalexample>
      <programlisting role="php">
$token = md5 (uniqid ("")); // no random portion
$better_token = md5 (uniqid (rand())); // better, difficult to guess
      </programlisting>
     </informalexample>
    </para>
    <simpara>
     This will create a 32 character identifier (a 128 bit hex number)
     that is extremely difficult to predict.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.unpack">
   <refnamediv>
    <refname>unpack</refname>
    <refpurpose>Unpack data from binary string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>unpack</function></funcdef>
      <paramdef>string <parameter>format</parameter></paramdef>
      <paramdef>string <parameter>data</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Unpack</function> from binary string into array
     according to <parameter>format</parameter>. Returns array
     containing unpacked elements of binary string.
    </para>
    <para>
     <function>Unpack</function> works slightly different from Perl as
     the unpacked data is stored in an associative array. To
     accomplish this you have to name the different format codes and
     separate them by a slash /.
     <example>
      <title><function>Unpack</function> format string</title>
      <programlisting role="php">
$array = unpack ("c2chars/nint", $binarydata);
      </programlisting>
      <para>
       The resulting array will contain the entries "chars1",
       "chars2" and "int".
      </para>
     </example>
    </para>
    <para>
     For an explanation of the format codes see also:
     <function>pack</function>
    </para>
    <para>
     Note that PHP internally stores integral values as signed. If you
     unpack a large unsigned long and it is of the same size as PHP
     internally stored values the result will be a negative number
     even though unsigned unpacking was specified.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.usleep">
   <refnamediv>
    <refname>usleep</refname>
    <refpurpose>Delay execution in microseconds</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>usleep</function></funcdef>
      <paramdef>int <parameter>micro_seconds</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     The <function>usleep</function> function delays program execution
     for the given number of <parameter>micro_seconds</parameter>.
    </simpara>
    <simpara>
     See also <function>sleep</function>.
    </simpara>
    <note>
     <simpara>
      This function does not work on Windows systems.
     </simpara>
    </note>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/msql.xml
+++ phpdoc/kr/functions/msql.xml
 <reference id="ref.msql">
  <title>mSQL functions</title>
  <titleabbrev>mSQL</titleabbrev>
  <partintro>
   <simpara>
    These functions allow you to access mSQL database servers. In
    order to have these functions available, you must compile php
    with msql support by using the
    <option role="configure">--with-msql[=dir]</option> option. The default
    location is /usr/local/Hughes.
   </simpara>
   <simpara>
    More information about mSQL can be found at <ulink
    url="&url.msql;">&url.msql;</ulink>.
   </simpara>
  </partintro>

  <refentry id="function.msql">
   <refnamediv>
    <refname>msql</refname>
    <refpurpose>Send mSQL query</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql</function></funcdef>
      <paramdef>string <parameter>database</parameter></paramdef>
      <paramdef>string <parameter>query</parameter></paramdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns a positive mSQL query identifier to the query result, or
     false on error.
    </para>  
    <para>
     <function>msql</function> selects a database and executes a query
     on it.  If the optional link identifier isn't specified, the
     function will try to find an open link to the mSQL server and if
     no such link is found it'll try to create one as if
     <function>msql_connect</function> was called with no arguments
     (see <function>msql_connect</function>).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-affected-rows">
   <refnamediv>
    <refname>msql_affected_rows</refname> 
    <refpurpose>Returns number of affected rows</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_affected_rows</function></funcdef>
      <paramdef>int <parameter>query_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns number of affected ("touched") rows by a specific query
     (i.e. the number of rows returned by a SELECT, the number of rows
     modified by an update, or the number of rows removed by a
     delete).
    </para>
    <para>
     See also: <function>msql_query</function>.
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.msql-close">
   <refnamediv>
    <refname>msql_close</refname> 
    <refpurpose>Close mSQL connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_close</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on error.
    </para>
    <para>
     <function>msql_close</function> closes the link to a mSQL
     database that's associated with the specified link identifier.
     If the link identifier isn't specified, the last opened link is
     assumed.
    </para>
    <para>
     Note that this isn't usually necessary, as non-persistent open
     links are automatically closed at the end of the script's
     execution.
    </para>
    <para>
     <function>msql_close</function> will not close persistent links
     generated by <function>msql_pconnect</function>.
    </para>
    <para>
     See also: <function>msql_connect</function> and
     <function>msql_pconnect</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-connect">
   <refnamediv>
    <refname>msql_connect</refname>
    <refpurpose>Open mSQL connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_connect</function></funcdef>
      <paramdef>string
       <parameter>
        <optional>hostname</optional>
       </parameter>
      </paramdef>
      <paramdef>string
       <parameter>
        <optional>hostname<optional>:port</optional></optional>
       </parameter>
      </paramdef>
      <paramdef>string
       <parameter>
        <optional>username</optional>
       </parameter>
      </paramdef>
      <paramdef>string
       <parameter>
        <optional>password</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a positive mSQL link identifier on success, or false on
     error.
    </para>
    <para>
     <function>msql_connect</function> establishes a connection to a
     mSQL server.  The hostname argument is optional, and if it's
     missing, localhost is assumed.
    </para>
    <para>
     In case a second call is made to
     <function>msql_connect</function> with the same arguments, no new
     link will be established, but instead, the link identifier of the
     already opened link will be returned.
    </para>
    <para>
     The link to the server will be closed as soon as the execution of
     the script ends, unless it's closed earlier by explicitly calling
     <function>msql_close</function>.
    </para>
    <para>
     See also <function>msql_pconnect</function>,
     <function>msql_close</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-create-db">
   <refnamediv>
    <refname>msql_create_db</refname>
    <refpurpose>Create mSQL database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_create_db</function></funcdef>
      <paramdef>string <parameter>database name</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>link_identifier</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     msql_create_db() attempts to create a new database on the server
     associated with the specified link identifier.
    </para>
    <para> See also: <function>msql_drop_db</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-createdb">
   <refnamediv>
    <refname>msql_createdb</refname>
    <refpurpose>Create mSQL database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_createdb</function></funcdef>
      <paramdef>string <parameter>database name</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>link_identifier</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Identical to <function>msql_create_db</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-data-seek">
   <refnamediv>
    <refname>msql_data_seek</refname>
    <refpurpose>Move internal row pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_data_seek</function></funcdef>
      <paramdef>int <parameter>query_identifier</parameter></paramdef>
      <paramdef>int <parameter>row_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on failure.
    </para>
    <para>
     <function>msql_data_seek</function> moves the internal row
     pointer of the mSQL result associated with the specified query
     identifier to pointer to the specifyed row number.  The next call
     to <function>msql_fetch_row</function> would return that
     row.
    </para> 
    <para> 
     See also: <function>msql_fetch_row</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-dbname">
   <refnamediv>
    <refname>msql_dbname</refname>
    <refpurpose>Get current mSQL database name</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>msql_dbname</function></funcdef>
      <paramdef>int <parameter>query_identifier</parameter></paramdef>
      <paramdef>int <parameter>i</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>msql_dbname</function> returns the database name stored
     in position <parameter>i</parameter> of the result pointer
     returned from the <function>msql_listdbs</function> function. The
     <function>msql_numrows</function> function can be used to
     determine how many database names are available.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-drop-db">
   <refnamediv>
    <refname>msql_drop_db</refname>
    <refpurpose>Drop (delete) mSQL database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_drop_db</function></funcdef>
      <paramdef>string <parameter>database_name</parameter></paramdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on failure.
    </para>
    <para>
     <function>msql_drop_db</function> attempts to drop (remove) an
     entire database from the server associated with the specified
     link identifier.
    </para>
    <para>
     See also: <function>msql_create_db</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-dropdb">
   <refnamediv>
    <refname>msql_dropdb</refname>
    <refpurpose>Drop (delete) mSQL database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <para>
     See <function>msql_drop_db</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-error">
   <refnamediv>
    <refname>msql_error</refname>
    <refpurpose>Returns error message of last msql call</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>msql_error</function></funcdef>
      <paramdef> <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Errors coming back from the mSQL database backend no longer
     issue warnings. Instead, use these functions to retrieve the
     error string.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-fetch-array">
   <refnamediv>
    <refname>msql_fetch_array</refname>
    <refpurpose>Fetch row as array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_fetch_array</function></funcdef>
      <paramdef>int <parameter>query_identifier</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>result_type</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array that corresponds to the fetched row, or false if
     there are no more rows.
    </para>
    <para>
     <function>msql_fetch_array</function> is an extended version of
     <function>msql_fetch_row</function>.  In addition to storing the
     data in the numeric indices of the result array, it also stores
     the data in associative indices, using the field names as keys.
    </para>
    <para>
     The second optional argument <parameter>result_type</parameter>
     in <function>msql_fetch_array</function> is a constant and can
     take the following values: MSQL_ASSOC, MSQL_NUM, and MYSQL_BOTH.
    </para>
    <para>
     Be careful if you are retrieving results from a query that may
     return a record that contains only one field that has a value of
     0 (or an empty string, or NULL).
    </para>  
    <para> 
     An important thing to note is that using
     <function>msql_fetch_array</function> is NOT significantly slower
     than using <function>msql_fetch_row</function>, while it provides
     a significant added value.
    </para>  
    <para>
     For further details, also see
     <function>msql_fetch_row</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-fetch-field">
   <refnamediv>
    <refname>msql_fetch_field</refname>
    <refpurpose>Get field information</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>object <function>msql_fetch_field</function></funcdef>
      <paramdef>int <parameter>query_identifier</parameter></paramdef>
      <paramdef>int <parameter>field_offset</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an object containing field information
    </para>
    <para>  
     <function>msql_fetch_field</function> can be used in order to
     obtain information about fields in a certain query result.  If
     the field offset isn't specified, the next field that wasn't yet
     retreived by <function>msql_fetch_field</function> is retreived.
    </para> 
    <para> 
     The properties of the object are:
     <itemizedlist>
      <listitem>
       <simpara>
        name - column name
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        table - name of the table the column belongs to
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        not_null - 1 if the column cannot be null
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        primary_key - 1 if the column is a primary key
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        unique - 1 if the column is a unique key
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        type - the type of the column
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para> 
     See also <function>msql_field_seek</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-fetch-object">
   <refnamediv>
    <refname>msql_fetch_object</refname>
    <refpurpose>Fetch row as object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_fetch_object</function></funcdef>
      <paramdef>int <parameter>query_identifier</parameter></paramdef>
      <paramdef>int
       <parameter><optional>result_type</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an object with properties that correspond to the fetched
     row, or false if there are no more rows.
    </para>  
    <para>
     <function>msql_fetch_object</function> is similar to
     <function>msql_fetch_array</function>, with one difference - an
     object is returned, instead of an array.  Indirectly, that means
     that you can only access the data by the field names, and not by
     their offsets (numbers are illegal property names).
    </para>  
    <para>
     The optional second argument <parameter>result_type</parameter>
     in <function>msql_fetch_array</function> is a constant and can
     take the following values: MSQL_ASSOC, MSQL_NUM, and MSQL_BOTH.
    </para>
    <para>
     Speed-wise, the function is identical to
     <function>msql_fetch_array</function>, and almost as quick as
     <function>msql_fetch_row</function> (the difference is
     insignificant).
    </para>  
    <para> See also:
     <function>msql_fetch_array</function> and
     <function>msql_fetch_row</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-fetch-row">
   <refnamediv>
    <refname>msql_fetch_row</refname>
    <refpurpose>Get row as enumerated array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>msql_fetch_row</function></funcdef>
      <paramdef>int <parameter>query_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array that corresponds to the fetched row, or false if
     there are no more rows.
    </para>
    <para>
     <function>msql_fetch_row</function> fetches one row of data from
     the result associated with the specified query identifier.  The
     row is returned as an array.  Each result column is stored in an
     array offset, starting at offset 0.
    </para>  
    <para> 
     Subsequent call to <function>msql_fetch_row</function> would
     return the next row in the result set, or false if there are no
     more rows.
    </para>
    <para> 
     See also: <function>msql_fetch_array</function>,
     <function>msql_fetch_object</function>,
     <function>msql_data_seek</function>, and
     <function>msql_result</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-fieldname">
   <refnamediv>
    <refname>msql_fieldname</refname>
    <refpurpose>Get field name</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>msql_fieldname</function></funcdef>
      <paramdef>int <parameter>query_identifier</parameter></paramdef>
      <paramdef>int <parameter>field</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>msql_fieldname</function> returns the name of the
     specified field.  <parameter>query_identifier</parameter> is the
     query identifier, and <parameter>field</parameter> is the field
     index.  <literal>msql_fieldname($result, 2);</literal> will
     return the name of the second field in the result associated with
     the result identifier.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-field-seek">
   <refnamediv>
    <refname>msql_field_seek</refname>
    <refpurpose>Set field offset</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_field_seek</function></funcdef>
      <paramdef>int <parameter>query_identifier</parameter></paramdef>
      <paramdef>int <parameter>field_offset</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Seeks to the specified field offset.  If the next call to
     <function>msql_fetch_field</function> won't include a field
     offset, this field would be returned.
    </para>
    <para> 
     See also: <function>msql_fetch_field</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-fieldtable">
   <refnamediv>
    <refname>msql_fieldtable</refname>
    <refpurpose>Get table name for field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_fieldtable</function></funcdef>
      <paramdef>int <parameter>query_identifier</parameter></paramdef>
      <paramdef>int <parameter>field</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the name of the table <parameter>field</parameter> was
     fetched from.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-fieldtype">
   <refnamediv>
    <refname>msql_fieldtype</refname>
    <refpurpose>Get field type</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>msql_fieldtype</function></funcdef>
      <paramdef>int <parameter>query_identifier</parameter></paramdef>
      <paramdef>int <parameter>i</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>msql_fieldtype</function> is similar to the
     <function>msql_fieldname</function> function.  The arguments are
     identical, but the field type is returned.  This will be one of
     "int", "char" or "real".
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-fieldflags">
   <refnamediv>
    <refname>msql_fieldflags</refname>
    <refpurpose>Get field flags</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>msql_fieldflags</function></funcdef>
      <paramdef>int <parameter>query_identifier</parameter></paramdef>
      <paramdef>int <parameter>i</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>msql_fieldflags</function> returns the field flags of
     the specified field. Currently this is either, "not null",
     "primary key", a combination of the two or "" (an empty string).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-fieldlen">
   <refnamediv>
    <refname>msql_fieldlen</refname>
    <refpurpose>Get field length</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_fieldlen</function></funcdef>
      <paramdef>int <parameter>query_identifier</parameter></paramdef>
      <paramdef>int <parameter>i</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>msql_fieldlen</function> returns the length of the
     specified field.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-free-result">
   <refnamediv>
    <refname>msql_free_result</refname>
    <refpurpose>Free result memory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_free_result</function></funcdef>
      <paramdef>int <parameter>query_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>msql_free_result</function> frees the memory associated
     with <parameter>query_identifier</parameter>.  When PHP completes a
     request, this memory is freed automatically, so you only need to
     call this function when you want to make sure you don't use too
     much memory while the script is running.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-freeresult">
   <refnamediv>
    <refname>msql_freeresult</refname>
    <refpurpose>Free result memory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <para>See <function>msql_free_result</function></para>
   </refsect1>
  </refentry>


  <refentry id="function.msql-list-fields">
   <refnamediv>
    <refname>msql_list_fields</refname>
    <refpurpose>List result fields</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_list_fields</function></funcdef>
      <paramdef>string <parameter>database</parameter></paramdef>
      <paramdef>string <parameter>tablename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>msql_list_fields</function> retrieves information about
     the given tablename. Arguments are the database name and the
     table name. A result pointer is returned which can be used with
     <function>msql_fieldflags</function>,
     <function>msql_fieldlen</function>,
     <function>msql_fieldname</function>, and
     <function>msql_fieldtype</function>.  A query identifier is a
     positive integer. The function returns <literal>-1</literal> if a
     error occurs. A string describing the error will be placed in
     <literal>$phperrmsg</literal>, and unless the function was called
     as <literal>@msql_list_fields()</literal> then this error string
     will also be printed out.
    </para>
    <para>
     See also <function>msql_error</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-listfields">
   <refnamediv>
    <refname>msql_listfields</refname>
    <refpurpose>List result fields</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <para>
     See <function>msql_list_fields</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-list-dbs">
   <refnamediv>
    <refname>msql_list_dbs</refname>
    <refpurpose>List mSQL databases on server</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_list_dbs</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>msql_list_dbs</function> will return a result pointer
     containing the databases available from the current msql
     daemon. Use the <function>msql_dbname</function> function to
     traverse this result pointer.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-listdbs">
   <refnamediv>
    <refname>msql_listdbs</refname>
    <refpurpose>List mSQL databases on server</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <para>
     See <function>msql_list_dbs</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-list-tables">
   <refnamediv>
    <refname>msql_list_tables</refname>
    <refpurpose>List tables in an mSQL database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_list_tables</function></funcdef>
      <paramdef>string <parameter>database</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>msql_list_tables</function> takes a database name and
     result pointer much like the <function>msql</function>
     function. The <function>msql_tablename</function> function should
     be used to extract the actual table names from the result
     pointer.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-listtables">
   <refnamediv>
    <refname>msql_listtables</refname>
    <refpurpose>List tables in an mSQL database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <para>
     See <function>msql_list_tables</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-num-fields">
   <refnamediv>
    <refname>msql_num_fields</refname>
    <refpurpose>Get number of fields in result</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_num_fields</function></funcdef>
      <paramdef>int <parameter>query_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>msql_num_fields</function> returns the number of fields
     in a result set.
    </para>
    <para>
     See also: <function>msql</function>,
     <function>msql_query</function>,
     <function>msql_fetch_field</function>, and
     <function>msql_num_rows</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-num-rows">
   <refnamediv>
    <refname>msql_num_rows</refname>
    <refpurpose>Get number of rows in result</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_num_rows</function></funcdef>
      <paramdef>int <parameter>query_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Msql_num_rows</function> returns the number of rows in
     a result set.
    </para>
    <para>
     See also: <function>msql</function>,
     <function>msql_query</function>, and
     <function>msql_fetch_row</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-numfields">
   <refnamediv>
    <refname>msql_numfields</refname>
    <refpurpose>Get number of fields in result</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_numfields</function></funcdef>
      <paramdef>int <parameter>query_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>  
     Identical to <function>msql_num_fields</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-numrows">
   <refnamediv>
    <refname>msql_numrows</refname>
    <refpurpose>Get number of rows in result</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_numrows</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>  
     Identical to <function>msql_num_rows</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-pconnect">
   <refnamediv>
    <refname>msql_pconnect</refname>
    <refpurpose>Open persistent mSQL connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_pconnect</function></funcdef>
      <paramdef>string
       <parameter>
        <optional>hostname</optional>
       </parameter>
      </paramdef>
      <paramdef>string
       <parameter>
        <optional>hostname<optional>:port</optional></optional>
       </parameter>
      </paramdef>
      <paramdef>string
       <parameter>
        <optional>username</optional>
       </parameter>
      </paramdef>
      <paramdef>string
       <parameter>
        <optional>password</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a positive mSQL persistent link identifier on success, or
     false on error.
    </para>
    <para> 
     <function>msql_pconnect</function> acts very much like
     <function>msql_connect</function> with two major differences.
    </para>
    <para> 
     First, when connecting, the function would first try to
     find a (persistent) link that's already open with the same host.
     If one is found, an identifier for it will be returned instead of
     opening a new connection.
    </para>
    <para> 
     Second, the connection to the SQL server will not be closed when
     the execution of the script ends.  Instead, the link will remain
     open for future use (<function>msql_close</function> will not
     close links established by <function>msql_pconnect</function>).
    </para>
    <para> 
     This type of links is therefore called 'persistent'.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-query">
   <refnamediv>
    <refname>msql_query</refname>
    <refpurpose>Send mSQL query</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_query</function></funcdef>
      <paramdef>string <parameter>query</parameter></paramdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>msql_query</function> sends a query to the currently
     active database on the server that's associated with the
     specified link identifier.  If the link identifier isn't
     specified, the last opened link is assumed.  If no link is open,
     the function tries to establish a link as if
     <function>msql_connect</function> was called, and use it.
    </para>
    <para>
     Returns a positive mSQL query identifier on success, or false on
     error.
    </para>
    <para>
     See also: <function>msql</function>,
     <function>msql_select_db</function>, and
     <function>msql_connect</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-regcase">
   <refnamediv>
    <refname>msql_regcase</refname>
    <refpurpose>
     Make regular expression for case insensitive match
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <para>See <function>sql_regcase</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-result">
   <refnamediv>
    <refname>msql_result</refname>
    <refpurpose>Get result data</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_result</function></funcdef>
      <paramdef>int <parameter>query_identifier</parameter></paramdef>
      <paramdef>int <parameter>i</parameter></paramdef>
      <paramdef>mixed <parameter>field</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the contents of the cell at the row and offset in the
     specified mSQL result set.
    </para>  
    <para> 
     <function>msql_result</function> returns the contents of one cell
     from a mSQL result set.  The field argument can be the field's
     offset, or the field's name, or the field's table dot field's
     name (fieldname.tablename).  If the column name has been aliased
     ('select foo as bar from ...'), use the alias instead of the
     column name.
    </para>
    <para> 
     When working on large result sets, you should consider using one
     of the functions that fetch an entire row (specified below).  As
     these functions return the contents of multiple cells in one
     function call, they're MUCH quicker than
     <function>msql_result</function>.  Also, note that specifying a
     numeric offset for the field argument is much quicker than
     specifying a fieldname or tablename.fieldname argument.
    </para>
    <para> 
     Recommended high-performance alternatives:
     <function>msql_fetch_row</function>,
     <function>msql_fetch_array</function>, and
     <function>msql_fetch_object</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-select-db">
   <refnamediv>
    <refname>msql_select_db</refname>
    <refpurpose>Select mSQL database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>msql_select_db</function></funcdef>
      <paramdef>string <parameter>database_name</parameter></paramdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on error.
    </para>
    <para>  
     <function>msql_select_db</function> sets the current active
     database on the server that's associated with the specified link
     identifier.  If no link identifier is specified, the last opened
     link is assumed.  If no link is open, the function will try to
     establish a link as if <function>msql_connect</function> was
     called, and use it.
    </para>
    <para> 
     Every subsequent call to <function>msql_query</function> will be
     made on the active database.
    </para>
    <para>
     See also: <function>msql_connect</function>,
     <function>msql_pconnect</function>, and
     <function>msql_query</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-selectdb">
   <refnamediv>
    <refname>msql_selectdb</refname>
    <refpurpose>Select mSQL database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <para>See <function>msql_select_db</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.msql-tablename">
   <refnamediv>
    <refname>msql_tablename</refname>
    <refpurpose>Get table name of field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>msql_tablename</function></funcdef>
      <paramdef>int <parameter>query_identifier</parameter></paramdef>
      <paramdef>int <parameter>field</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>    
     <function>msql_tablename</function> takes a result pointer
     returned by the <function>msql_list_tables</function> function as
     well as an integer index and returns the name of a table. The
     <function>msql_numrows</function> function may be used to
     determine the number of tables in the result pointer.
     <example>
      <title><function>msql_tablename</function> example</title>
      <programlisting role="php">
&lt;?php 
msql_connect ("localhost");
$result = msql_list_tables ("wisconsin");
$i = 0;
while ($i &lt; msql_numrows ($result)) {
    $tb_names[$i] = msql_tablename ($result, $i);
    echo $tb_names[$i] . "&lt;BR>";
    $i++; 
}
?>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/mssql.xml
+++ phpdoc/kr/functions/mssql.xml
 <reference id="ref.mssql">
  <title>Microsoft SQL Server functions</title>
  <titleabbrev>MS SQL Server</titleabbrev>

  <refentry id="function.mssql-close">
   <refnamediv>
    <refname>mssql_close</refname>
    <refpurpose>Close MS SQL Server connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mssql_close</function></funcdef>
      <paramdef>int 
       <parameter><optional>link_identifier</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns: true on success, false on error.
    </para>
    <para> 
     <function>Mssql_close</function> closes the link to a MS SQL
     Server database that's associated with the specified link
     identifier.  If the link identifier isn't specified, the last
     opened link is assumed.
    </para>
    <para> 
     Note that this isn't usually necessary, as non-persistent open
     links are automatically closed at the end of the script's
     execution.
    </para>
    <para> 
     <function>Mssql_close</function> will not close persistent links
     generated by <function>mssql_pconnect</function>.
    </para>
    <para> 
     See also: <function>mssql_connect</function>,
     <function>mssql_pconnect</function>.  
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mssql-connect">
   <refnamediv>
    <refname>mssql_connect</refname>
    <refpurpose>Open MS SQL server connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mssql_connect</function></funcdef>
      <paramdef>string 
       <parameter><optional>servername</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>username</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>password</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns: A positive MS SQL link identifier on success, or false
     on error.
    </para>
    <para> 
     <function>Mssql_connect</function> establishes a connection to a
     MS SQL server.  The servername argument has to be a valid
     servername that is defined in the 'interfaces' file.
    </para>
    <para> 
     In case a second call is made to
     <function>mssql_connect</function> with the same arguments, no
     new link will be established, but instead, the link identifier of
     the already opened link will be returned.
    </para>
    <para> 
     The link to the server will be closed as soon as the execution of
     the script ends, unless it's closed earlier by explicitly calling
     <function>mssql_close</function>.
    </para>
    <para>
     See also <function>mssql_pconnect</function>,
     <function>mssql_close</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mssql-data-seek">
   <refnamediv>
    <refname>mssql_data_seek</refname>
    <refpurpose>Move internal row pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mssql_data_seek</function></funcdef>
      <paramdef>int <parameter>result_identifier</parameter></paramdef>
      <paramdef>int <parameter>row_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns: true on success, false on failure.
    </para>
    <para> 
     <function>Mssql_data_seek</function> moves the internal row
     pointer of the MS SQL result associated with the specified result
     identifier to point to the specified row number. The next call
     to <function>mssql_fetch_row</function> would return that row.
    </para>
    <para> 
     See also: <function>mssql_data_seek</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mssql-fetch-array">
   <refnamediv>
    <refname>mssql_fetch_array</refname>
    <refpurpose>Fetch row as array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mssql_fetch_array</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns: An array that corresponds to the fetched row, or false
     if there are no more rows.
    </para>
    <para>
     <function>Mssql_fetch_array</function> is an extended version of
     <function>mssql_fetch_row</function>.  In addition to storing the
     data in the numeric indices of the result array, it also stores
     the data in associative indices, using the field names as keys.
    </para>
    <para>
     An important thing to note is that using
     <function>mssql_fetch_array</function> is NOT significantly
     slower than using <function>mssql_fetch_row</function>, while it
     provides a significant added value.
    </para>
    <para>
     For further details, also see
     <function>mssql_fetch_row</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mssql-fetch-field">
   <refnamediv>
    <refname>mssql_fetch_field</refname>
    <refpurpose>Get field information</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>object <function>mssql_fetch_field</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>field_offset</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an object containing field information.  
    </para>
    <para>
     <function>Mssql_fetch_field</function> can be used in order to
     obtain information about fields in a certain query result. If
     the field offset isn't specified, the next field that wasn't yet
     retrieved by <function>mssql_fetch_field</function> is retrieved.
    </para>
    <para>
     The properties of the object are:
    </para>
    <itemizedlist>
     <listitem>
      <simpara>
       name - column name.  if the column is a result of a function,
       this property is set to computed#N, where #N is a serial
       number.
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       column_source - the table from which the column was taken
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       max_length - maximum length of the column
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       numeric - 1 if the column is numeric
      </simpara></listitem> 
    </itemizedlist>
    <para>
     See also <function>mssql_field_seek</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mssql-fetch-object">
   <refnamediv>
    <refname>mssql_fetch_object</refname>
    <refpurpose>Fetch row as object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mssql_fetch_object</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns: An object with properties that correspond to the fetched
     row, or false if there are no more rows.
    </para>
    <para> 
     <function>Mssql_fetch_object</function> is similar to
     <function>mssql_fetch_array</function>, with one difference - an
     object is returned, instead of an array.  Indirectly, that means
     that you can only access the data by the field names, and not by
     their offsets (numbers are illegal property names).
    </para>
    <para>
     Speed-wise, the function is identical to
     <function>mssql_fetch_array</function>, and almost as quick as
     <function>mssql_fetch_row</function> (the difference is
     insignificant).
    </para>
    <para> 
     See also: <function>mssql_fetch-array</function> and
     <function>mssql_fetch-row</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mssql-fetch-row">
   <refnamediv>
    <refname>mssql_fetch_row</refname>
    <refpurpose>Get row as enumerated array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>mssql_fetch_row</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns: An array that corresponds to the fetched row, or false
     if there are no more rows.
    </para>
    <para>
     <function>Mssql_fetch_row</function> fetches one row of data from
     the result associated with the specified result identifier.  The
     row is returned as an array.  Each result column is stored in an
     array offset, starting at offset 0.
    </para>
    <para>
     Subsequent call to <function>mssql_fetch_rows</function> would
     return the next row in the result set, or false if there are no
     more rows.
    </para>
    <para>
     See also: <function>mssql_fetch_array</function>,
     <function>mssql_fetch_object</function>,
     <function>mssql_data_seek</function>,
     <function>mssql_fetch_lengths</function>, and
     <function>mssql_result</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mssql-field-length">
   <refnamediv>
    <refname>mssql_field_length</refname>
    <refpurpose>Get the length of a field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mssql_field_length</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>offset</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
   </refsect1>
  </refentry>

  <refentry id="function.mssql-field-name">
   <refnamediv>
    <refname>mssql_field_name</refname>
    <refpurpose>Get the name of a field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mssql_field_name</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>offset</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
   </refsect1>
  </refentry>

  <refentry id="function.mssql-field-seek">
   <refnamediv>
    <refname>mssql_field_seek</refname>
    <refpurpose>Set field offset</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mssql_field_seek</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int <parameter>field_offset</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Seeks to the specified field offset.  If the next call to
     <function>mssql_fetch_field</function> won't include a field
     offset, this field would be returned.</para>
    <para></para>
    <para>
     See also: <function>mssql_fetch_field</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.mssql-field-type">
   <refnamediv>
    <refname>mssql_field_type</refname>
    <refpurpose>Get the type of a field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mssql_field_type</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>offset</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
   </refsect1>
  </refentry>

  <refentry id="function.mssql-free-result">
   <refnamediv>
    <refname>mssql_free_result</refname>
    <refpurpose>Free result memory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mssql_free_result</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>mssql_free_result</function> only needs to be called
     if you are worried about using too much memory while your script
     is running. All result memory will automatically be freed when
     the script ends. You may call <function>mssql_free_result</function>
     with the result identifier as an argument and the associated
     result memory will be freed.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mssql-get-last-message">
   <refnamediv>
    <refname>mssql_get_last_message</refname>
    <refpurpose>
     Returns the last message from server (over
     min_message_severity?)
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string 
       <function>mssql_get_last_message</function>
      </funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
   </refsect1>
  </refentry>

  <refentry id="function.mssql-min-error-severity">
   <refnamediv>
    <refname>mssql_min_error_severity</refname>
    <refpurpose>Sets the lower error severity</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>mssql_min_error_severity</function>
      </funcdef>
      <paramdef>int <parameter>severity</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
   </refsect1>
  </refentry>

  <refentry id="function.mssql-min-message-severity">
   <refnamediv>
    <refname>mssql_min_message_severity</refname>
    <refpurpose>Sets the lower message severity</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>mssql_min_message_severity</function>
      </funcdef>
      <paramdef>int <parameter>severity</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
   </refsect1>
  </refentry>

  <refentry id="function.mssql-num-fields">
   <refnamediv>
    <refname>mssql_num_fields</refname>
    <refpurpose>Get number of fields in result</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mssql_num_fields</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>Mssql_num_fields</function> returns the number of
     fields in a result set.
    </para>
    <para> 
     See also: <function>mssql_db_query</function>,
     <function>mssql_query</function>,
     <function>mssql_fetch_field</function>, and
     <function>mssql_num_rows</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mssql-num-rows">
   <refnamediv>
    <refname>mssql_num_rows</refname>
    <refpurpose>Get number of rows in result</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mssql_num_rows</function></funcdef>
      <paramdef>string <parameter>result</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Mssql_num_rows</function> returns the number of rows in
     a result set.
    </para>
    <para>
     See also: <function>mssql_db_query</function>,
     <function>mssql_query</function>, and
     <function>mssql_fetch_row</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mssql-pconnect">
   <refnamediv>
    <refname>mssql_pconnect</refname>
    <refpurpose>Open persistent MS SQL connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mssql_pconnect</function></funcdef>
      <paramdef>string 
       <parameter><optional>servername</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>username</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>password</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns: A positive MS SQL persistent link identifier on success,
     or false on error.
    </para>
    <para>
     <function>Mssql_pconnect</function> acts very much like
     <function>mssql_connect</function> with two major differences.
    </para>
    <para> 
     First, when connecting, the function would first try to find a
     (persistent) link that's already open with the same host,
     username and password.  If one is found, an identifier for it
     will be returned instead of opening a new connection.
    </para>
    <para> 
     Second, the connection to the SQL server will not be closed when
     the execution of the script ends.  Instead, the link will remain
     open for future use (<function>mssql_close</function> will not
     close links established by <function>mssql_pconnect</function>).
    </para>
    <para> 
     This type of links is therefore called 'persistent'.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mssql-query">
   <refnamediv>
    <refname>mssql_query</refname>
    <refpurpose>Send MS SQL query</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mssql_query</function></funcdef>
      <paramdef>string <parameter>query</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>link_identifier</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns: A positive MS SQL result identifier on success, or false
     on error.
    </para>
    <para> 
     <function>Mssql_query</function> sends a query to the currently
     active database on the server that's associated with the
     specified link identifier.  If the link identifier isn't
     specified, the last opened link is assumed.  If no link is open,
     the function tries to establish a link as if
     <function>mssql_connect</function> was called, and use it.
    </para>
    <para>
     See also: <function>mssql_db_query</function>,
     <function>mssql_select_db</function>, and
     <function>mssql_connect</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mssql-result">
   <refnamediv>
    <refname>mssql_result</refname>
    <refpurpose>Get result data</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mssql_result</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int <parameter>i</parameter></paramdef>
      <paramdef>mixed <parameter>field</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Mssql_result</function> returns the contents of one
     cell from a MS SQL result set.  The field argument can be the
     field's offset, the field's name or the field's table dot
     field's name (tablename.fieldname).  If the column name has been
     aliased ('select foo as bar from...'), it uses the alias instead of
     the column name.
    </para>
    <para>
     When working on large result sets, you should consider using one
     of the functions that fetch an entire row (specified below).  As
     these functions return the contents of multiple cells in one
     function call, they're MUCH quicker than
     <function>mssql_result</function>.  Also, note that specifying a
     numeric offset for the field argument is much quicker than
     specifying a fieldname or tablename.fieldname argument.
    </para>
    <para>
     Recommended high-performance alternatives:
     <function>mssql_fetch_row</function>,
     <function>mssql_fetch_array</function>, and
     <function>mssql_fetch_object</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mssql-select-db">
   <refnamediv>
    <refname>mssql_select_db</refname>
    <refpurpose>Select MS SQL database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mssql_select_db</function></funcdef>
      <paramdef>string <parameter>database_name</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>link_identifier</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> Returns: true on success, false on error
    </para>
    <para> 
     <function>Mssql_select_db</function> sets the current active
     database on the server that's associated with the specified link
     identifier.  If no link identifier is specified, the last opened
     link is assumed.  If no link is open, the function will try to
     establish a link as if <function>mssql_connect</function> was
     called, and use it.
    </para>
    <para>
     Every subsequent call to <function>mssql_query</function> will be
     made on the active database.
    </para>
    <para> See also:
     <function>mssql_connect</function>, 
     <function>mssql_pconnect</function>, and
     <function>mssql_query</function>
    </para>
   </refsect1>
  </refentry>

</reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/mysql.xml
+++ phpdoc/kr/functions/mysql.xml
 <reference id="ref.mysql">
  <title>MySQL functions</title>
  <titleabbrev>MySQL</titleabbrev>
  <partintro>
   <simpara>
    These functions allow you to access MySQL database servers. In
    order to have these functions available, you must compile php
    with mysql support by using the
    <option role="configure">--with-mysql</option> option. If you
    use this option without specifying the path to mysql, php will
    use the built-in mysql client libraries. Users who run other
    applications that use mysql (for example, running php3 and php4
    as concurrent apache modules, or auth-mysql) should always
    specify the path to mysql:
    <option role="configure">--with-mysql=/path/to/mysql</option>.
    This will force php to use the client libraries installed by
    mysql, avoiding any conflicts.
   </simpara>
   <simpara>
    More information about MySQL can be found at <ulink
    url="&url.mysql;">&url.mysql;</ulink>.
   </simpara>
   <simpara>
    Documentation for MySQL can be found at <ulink
    url="&url.mysql.docs;">&url.mysql.docs;</ulink>.
   </simpara>

  </partintro>

  <refentry id="function.mysql-affected-rows">
   <refnamediv>
    <refname>mysql_affected_rows</refname> 
    <refpurpose>Get number of affected rows in previous MySQL
     operation</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_affected_rows</function></funcdef>
      <paramdef>int 
       <parameter>
        <optional>link_identifier</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>mysql_affected_rows</function> returns the number of
     rows affected by the last INSERT, UPDATE or DELETE query on the
     server associated with the specified link identifier.  If the
     link identifier isn't specified, the last opened link is assumed.
    </para>
    <para>
     If the last query was a DELETE query with no WHERE clause, all
     of the records will have been deleted from the table but this
     function will return zero.
    </para>
    <para>
     This command is not effective for SELECT statements, only on
     statements which modify records. To retrieve the number of rows
     returned from a SELECT, use <function>mysql_num_rows</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-change-user">
   <refnamediv>
    <refname>mysql_change_user</refname> 
    <refpurpose>
     Change logged in user of the active connection
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_change_user</function></funcdef>
      <paramdef>string <parameter>user</parameter></paramdef>
      <paramdef>string <parameter>password</parameter></paramdef>
      <paramdef>string 
       <parameter>
        <optional>database</optional>
       </parameter>
      </paramdef>
      <paramdef>int 
       <parameter>
        <optional>link_identifier</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>mysql_change_user</function> changes the logged in user
     of the current active connection, or the connection given by the 
     optional parameter link_identifier.  If a database is
     specified, this will default or current database after the user
     has been changed.  If the new user and password authorization fails, 
     the current connected user stays active.</para>
     <note><para>This function was introduced in PHP 3.0.13 and
     requires MySQL 3.23.3 or higher.
    </para></note>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-close">
   <refnamediv>
    <refname>mysql_close</refname>
    <refpurpose>Close MySQL connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_close</function></funcdef>
      <paramdef>int 
       <parameter>
        <optional>link_identifier</optional>                   
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns: true on success, false on error.
    </para>
    <para> <function>mysql_close</function> closes the connection to
    the MySQL server that's associated with the specified link
    identifier. If <parameter>link_identifier</parameter> isn't
    specified, the last opened link is used.
    </para>
    <para>
     Using <function>mysql_close</function> isn't usually necessary,
     as non-persistent open links are automatically closed at the end
     of the script's execution.
    </para>
    <note>
     <para> 
      <function>mysql_close</function> will not close persistent links
      created by <function>mysql_pconnect</function>.
     </para>
    </note>
    <example>
     <title>MySQL close example</title>
     <programlisting role="php">
&lt;?php
    $link = mysql_connect ("kraemer", "marliesle", "secret")
        or die ("Could not connect");
    print ("Connected successfully");
    mysql_close ($link);
?>
     </programlisting>
    </example>
    <para> 
     See also: <function>mysql_connect</function>, and
     <function>mysql_pconnect</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-connect">
   <refnamediv>
    <refname>mysql_connect</refname>
    <refpurpose>Open a connection to a MySQL Server</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_connect</function></funcdef>
      <paramdef>string 
       <parameter>
        <optional>hostname
        <optional>:port</optional>
        <optional>:/path/to/socket</optional>
        </optional>
       </parameter>
      </paramdef>
      <paramdef>string 
       <parameter>
        <optional>username</optional>
       </parameter>
      </paramdef>
      <paramdef>string 
       <parameter>
        <optional>password</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns a positive MySQL link identifier on success, or an error
     message on failure.
    </para>
    <para>
     <function>mysql_connect</function> establishes a connection
     to a MySQL server.  The following defaults are assumed for
     missing optional parameters: <parameter>host:port</parameter> =
     'localhost:3306', <parameter>username</parameter> = name of the
     user that owns the server process and 
     <parameter>password</parameter> = empty password.
    </para>
    <para>
     The hostname string can also include a port
     number. eg. &quot;hostname:port&quot; or a path to a socket
     eg. &quot;:/path/to/socket&quot; for the localhost.
     <note>
      <para>
       Support for &quot;:port&quot; was added in PHP 3.0B4.
      </para>
      <para>
       Support for &quot;:/path/to/socket&quot; was added in
       PHP 3.0.10.
      </para>
      <para>
      You can suppress the error message on failure by prepending '@'
      to the function name.
      </para>
     </note>
    </para>
    <para>
     If a second call is made to <function>mysql_connect</function>
     with the same arguments, no new link will be established, but
     instead, the link identifier of the already opened link will be
     returned.
    </para>
    <para>
     The link to the server will be closed as soon as the execution of
     the script ends, unless it's closed earlier by explicitly calling
     <function>mysql_close</function>.
    </para>  
    <example>
     <title>MySQL connect example</title>
     <programlisting role="php">
&lt;?php
    $link = mysql_connect ("kraemer", "marliesle", "secret")
        or die ("Could not connect");
    print ("Connected successfully");
    mysql_close ($link);
?>
     </programlisting>
    </example>
    <para> See also
     <function>mysql_pconnect</function>, and
     <function>mysql_close</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-create-db">
   <refnamediv>
    <refname>mysql_create_db</refname>
    <refpurpose>Create a MySQL database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_create_db</function></funcdef>
      <paramdef>string <parameter>database name</parameter></paramdef>
      <paramdef>int 
       <parameter>
        <optional>link_identifier</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>mysql_create_db</function> attempts to create a new
     database on the server associated with the specified link
     identifier.
    </para>
    <example>
     <title>MySQL create database example</title>
     <programlisting role="php">
&lt;?php
    $link = mysql_pconnect ("kron", "jutta", "geheim")
        or die ("Could not connect");
    if (mysql_create_db ("my_db")) {
        print ("Database created successfully\n");
    } else {
        printf ("Error creating database: %s\n", mysql_error ());
    }
?>
     </programlisting>
    </example>
    <para> 
     For downwards compatibility <function>mysql_createdb</function>
     can also be used.
    </para>
    <para> 
     See also: <function>mysql_drop_db</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-data-seek">
   <refnamediv>
    <refname>mysql_data_seek</refname>
    <refpurpose>Move internal result pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_data_seek</function></funcdef>
      <paramdef>int <parameter>result_identifier</parameter></paramdef>
      <paramdef>int <parameter>row_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns: true on success, false on failure.
    </para>
    <para> 
     <function>mysql_data_seek</function> moves the internal row
     pointer of the MySQL result associated with the specified result
     identifier to point to the specified row number.  The next call
     to <function>mysql_fetch_row</function> would return that row.
    </para>
    <para>
     <parameter>Row_number</parameter> starts at 0.
    </para>

    <example>
     <title>MySQL data seek example</title>
     <programlisting role="php">
&lt;?php
    $link = mysql_pconnect ("kron", "jutta", "geheim")
        or die ("Could not connect");

    mysql_select_db ("samp_db")
        or die ("Could not select database");

    $query = "SELECT last_name, first_name FROM friends";
    $result = mysql_query ($query)
        or die ("Query failed");

    # fetch rows in reverse order

    for ($i = mysql_num_rows ($result) - 1; $i >=0; $i--) {
        if (!mysql_data_seek ($result, $i)) {
            printf ("Cannot seek to row %d\n", $i);
            continue;
        }

        if(!($row = mysql_fetch_object ($result)))
            continue;

        printf ("%s %s&lt;BR>\n", $row->last_name, $row->first_name);
    }

    mysql_free_result ($result);
?>
     </programlisting>
    </example>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-db-name">
   <refnamediv>
    <refname>mysql_db_name</refname>
    <refpurpose>Get result data</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_db_name</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int <parameter>row</parameter></paramdef>
      <paramdef>mixed 
       <parameter>
        <optional>field</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>mysql_db_name</function> takes as its first parameter
     the result pointer from a call to
     <function>mysql_list_dbs</function>. The
     <parameter>row</parameter> parameter is an index into the result
     set.
    </para>

    <para>
     If an error occurs, FALSE is returned. Use
     <function>mysql_errno</function> and
     <function>mysql_error</function> to determine the nature of the
     error.
    </para>

    <example>
     <title><function>Mysql_db_name</function> example</title>
     <programlisting role="php">
&lt;?php 
error_reporting(E_ALL);

mysql_connect('dbhost', 'username', 'password');
$db_list = mysql_list_dbs();

$i = 0;
$cnt = mysql_num_rows($db_list);
while ($i < $cnt) {
    echo mysql_db_name($db_list, $i) . "\n";
    $i++;
}
?>
     </programlisting>
    </example>

    <para>
     For backward compatibility, <function>mysql_dbname</function> is
     also accepted. This is deprecated, however.
    </para>

   </refsect1>
  </refentry>

  <refentry id="function.mysql-db-query">
   <refnamediv>
    <refname>mysql_db_query</refname>
    <refpurpose>Send a MySQL query</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_db_query</function></funcdef>
      <paramdef>string <parameter>database</parameter></paramdef>
      <paramdef>string <parameter>query</parameter></paramdef>
      <paramdef>int 
       <parameter>
        <optional>link_identifier</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns: A positive MySQL result identifier to the query result,
     or false on error.
    </para>
    <para> 
     <function>mysql_db_query</function> selects a database and
     executes a query on it.  If the optional link identifier isn't
     specified, the function will try to find an open link to the
     MySQL server and if no such link is found it'll try to create one
     as if <function>mysql_connect</function> was called with no
     arguments
    </para>
    <para> 
     See also <function>mysql_connect</function>.
    </para>
    <para>
     For downwards
     compatibility <function>mysql</function> can also be used.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-drop-db">
   <refnamediv>
    <refname>mysql_drop_db</refname>
    <refpurpose>Drop (delete) a MySQL database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_drop_db</function></funcdef>
      <paramdef>string <parameter>database_name</parameter></paramdef>
      <paramdef>int 
       <parameter>
        <optional>link_identifier</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns: true on success, false on failure.
    </para>  
    <para> 
     <function>mysql_drop_db</function> attempts to drop (remove) an
     entire database from the server associated with the specified
     link identifier.
    </para>
    <para> 
     See also: <function>mysql_create_db</function>. For downward
     compatibility <function>mysql_dropdb</function> can also be used.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-errno">
   <refnamediv>
    <refname>mysql_errno</refname> 
    <refpurpose>Returns the numerical value of the error message from previous
     MySQL operation</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_errno</function></funcdef>
      <paramdef>int 
       <parameter>
        <optional>link_identifier</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the error number from the last mySQL function, or
     <literal>0</literal> (zero) if no error occurred.
    </para>
    <para>
     Errors coming back from the mySQL database backend no longer
     issue warnings. Instead, use <function>mysql_errno</function> to
     retrieve the error code. Note that this function only returns the
     error code from the most recently executed mySQL function (not
     including <function>mysql_error</function> and
     <function>mysql_errno</function>), so if you want to use it,
     make sure you check the value before calling another mySQL
     function.
     <informalexample>
      <programlisting role="php">
&lt;?php
mysql_connect("marliesle");
echo mysql_errno().": ".mysql_error()."&lt;BR>";
mysql_select_db("nonexistentdb");
echo mysql_errno().": ".mysql_error()."&lt;BR>";
$conn = mysql_query("SELECT * FROM nonexistenttable");
echo mysql_errno().": ".mysql_error()."&lt;BR>";
?>
      </programlisting>
     </informalexample>
    </para>
    <para> 
     See also: <function>mysql_error</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-error">
   <refnamediv>
    <refname>mysql_error</refname>
    <refpurpose>Returns the text of the error message from previous
     MySQL operation</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mysql_error</function></funcdef>
      <paramdef>int 
       <parameter>
        <optional>link_identifier</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the error text from the last mySQL function, or
     <literal>''</literal> (the empty string) if no error occurred.
    </para>
    <para>
     Errors coming back from the mySQL database backend no longer
     issue warnings. Instead, use <function>mysql_error</function> to
     retrieve the error text. Note that this function only returns the
     error text from the most recently executed mySQL function (not
     including <function>mysql_error</function> and
     <function>mysql_errno</function>), so if you want to use it, make
     sure you check the value before calling another mySQL function.
     <informalexample>
      <programlisting role="php">
&lt;?php
mysql_connect("marliesle");
echo mysql_errno().": ".mysql_error()."&lt;BR>";
mysql_select_db("nonexistentdb");
echo mysql_errno().": ".mysql_error()."&lt;BR>";
$conn = mysql_query("SELECT * FROM nonexistenttable");
echo mysql_errno().": ".mysql_error()."&lt;BR>";
?>
      </programlisting>
     </informalexample>
    </para>
    <para> 
     See also: <function>mysql_errno</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-fetch-array">
   <refnamediv>
    <refname>mysql_fetch_array</refname> 
    <refpurpose>
     Fetch a result row as an associative array, a numeric array, or both.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>mysql_fetch_array</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int
       <parameter>
        <optional>result_type</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns an array that corresponds to the fetched row, or false
     if there are no more rows.</para>
    <para>
     <function>mysql_fetch_array</function> is an extended version of
     <function>mysql_fetch_row</function>.  In addition to storing the
     data in the numeric indices of the result array, it also stores
     the data in associative indices, using the field names as keys.
    </para>
    <para>
     If two or more columns of the result have the same field names,
     the last column will take precedence. To access the other column(s)
     of the same name, you must the numeric index of the column or
     make an alias for the column.
     <informalexample>
      <programlisting>
select t1.f1 as foo t2.f1 as bar from t1, t2
      </programlisting>
     </informalexample>
    </para>
    <para>
     An important thing to note is that using
     <function>mysql_fetch_array</function> is NOT significantly
     slower than using <function>mysql_fetch_row</function>, while it
     provides a significant added value.
    </para>
    <para>
     The optional second argument <parameter>result_type</parameter>
     in <function>mysql_fetch_array</function> is a constant and can
     take the following values: MYSQL_ASSOC, MYSQL_NUM, and
     MYSQL_BOTH. (This feature was added in PHP 3.0.7)
    </para>
    <para>
     For further details, see also
     <function>mysql_fetch_row</function> and <function>mysql_fetch_assoc</function>.
    </para>
    <example>
     <title><function>Mysql_fetch_array</function></title>
     <programlisting role="php">
&lt;?php 
mysql_connect ($host, $user, $password);
$result = mysql_db_query ("database","select user_id, fullname from table");
while ($row = mysql_fetch_array ($result)) {
    echo "user_id: ".$row["user_id"]."&lt;br>\n";
    echo "user_id: ".$row[0]."&lt;br>\n";
    echo "fullname: ".$row["fullname"]."&lt;br>\n";
    echo "fullname: ".$row[1]."&lt;br>\n";
}
mysql_free_result ($result);
?>
     </programlisting>
    </example>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-fetch-assoc">
   <refnamediv>
    <refname>mysql_fetch_assoc</refname> 
    <refpurpose>
     Fetch a result row as an associative array
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>mysql_fetch_assoc</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns an associative array that corresponds to the fetched row,
     or false if there are no more rows.</para>
    <para>
     <function>mysql_fetch_assoc</function> is equivalent to calling 
     <function>mysql_fetch_array</function> with MYSQL_ASSOC for the
     optional second parameter.  It only returns an associative array.
     This is the way <function>mysql_fetch_array</function> originally
     worked.  If you need the numeric indices as well as the
     associative, use <function>mysql_fetch_array</function>.
    </para>
    <para>
     If two or more columns of the result have the same field names,
     the last column will take precedence. To access the other column(s)
     of the same name, you must use <function>mysql_fetch_array</function> and
     have it return the numeric indices as well.
    </para>
    <para>
     An important thing to note is that using
     <function>mysql_fetch_assoc</function> is NOT significantly
     slower than using <function>mysql_fetch_row</function>, while it
     provides a significant added value.
    </para>
    <para>
     For further details, see also
     <function>mysql_fetch_row</function> and <function>mysql_fetch_array</function>.
    </para>
    <example>
     <title><function>Mysql_fetch_assoc</function></title>
     <programlisting role="php">
&lt;?php 
mysql_connect ($host, $user, $password);
$result = mysql_db_query ("database","select * from table");
while ($row = mysql_fetch_assoc ($result)) {
    echo $row["user_id"];
    echo $row["fullname"];
}
mysql_free_result ($result);
?>
     </programlisting>
    </example>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-fetch-field">
   <refnamediv>
    <refname>mysql_fetch_field</refname>
    <refpurpose>
     Get column information from a result and return as an object
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>object <function>mysql_fetch_field</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int 
       <parameter>
        <optional>field_offset</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an object containing field information.
    </para>  
    <para>
     <function>mysql_fetch_field</function> can be used in order to
     obtain information about fields in a certain query result.  If
     the field offset isn't specified, the next field that wasn't yet
     retrieved by <function>mysql_fetch_field</function> is retrieved.
    </para>
    <para>
     The properties of the object are:
     <itemizedlist>
      <listitem>
       <simpara>
        name - column name
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        table - name of the table the column belongs to
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        max_length - maximum length of the column
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        not_null - 1 if the column cannot be null
       </simpara>
      </listitem> 
      <listitem>
       <simpara>
        primary_key - 1 if the column is a primary key
       </simpara>
      </listitem> 
      <listitem>
       <simpara>
        unique_key - 1 if the column is a unique key
       </simpara>
      </listitem> 
      <listitem>
       <simpara>
        multiple_key - 1 if the column is a non-unique key
       </simpara>
      </listitem> 
      <listitem>
       <simpara>
        numeric - 1 if the column is numeric
       </simpara>
      </listitem> 
      <listitem>
       <simpara>
        blob - 1 if the column is a BLOB
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        type - the type of the column
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        unsigned - 1 if the column is unsigned
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        zerofill - 1 if the column is zero-filled
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <example>
     <title><function>Mysql_fetch_field</function></title>
     <programlisting role="php">
&lt;?php 
mysql_connect ($host, $user, $password)
    or die ("Could not connect");
$result = mysql_db_query ("database", "select * from table")
    or die ("Query failed");
# get column metadata
$i = 0;
while ($i &lt; mysql_num_fields ($result)) {
    echo "Information for column $i:&lt;BR>\n";
    $meta = mysql_fetch_field ($result);
    if (!$meta) {
        echo "No information available&lt;BR>\n";
    }
    echo "&lt;PRE>
blob:         $meta->blob
max_length:   $meta->max_length
multiple_key: $meta->multiple_key
name:         $meta->name
not_null:     $meta->not_null
numeric:      $meta->numeric
primary_key:  $meta->primary_key
table:        $meta->table
type:         $meta->type
unique_key:   $meta->unique_key
unsigned:     $meta->unsigned
zerofill:     $meta->zerofill
&lt;/PRE>";
    $i++;
}
mysql_free_result ($result);
?>
     </programlisting>
    </example>
    <para>
     See also <function>mysql_field_seek</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-fetch-lengths">
   <refnamediv>
    <refname>mysql_fetch_lengths</refname> 
    <refpurpose>
     Get the length of each output in a result
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>mysql_fetch_lengths</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns: An array that corresponds to the lengths of each field
     in the last row fetched by <function>mysql_fetch_row</function>,
     or false on error.
    </para>  
    <para>
     <function>mysql_fetch_lengths</function> stores the lengths of
     each result column in the last row returned by
     <function>mysql_fetch_row</function>,
     <function>mysql_fetch_array</function>, and
     <function>mysql_fetch_object</function> in an array, starting at
     offset 0.
    </para>  
    <para> 
     See also: <function>mysql_fetch_row</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-fetch-object">
   <refnamediv>
    <refname>mysql_fetch_object</refname>
    <refpurpose>Fetch a result row as an object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>object <function>mysql_fetch_object</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int
       <parameter>
        <optional>result_type</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns an object with properties that correspond to the fetched
     row, or false if there are no more rows.
    </para>
    <para> 
     <function>mysql_fetch_object</function> is similar to
     <function>mysql_fetch_array</function>, with one difference - an
     object is returned, instead of an array.  Indirectly, that means
     that you can only access the data by the field names, and not by
     their offsets (numbers are illegal property names).
    </para>
    <para>
     The optional argument <parameter>result_type</parameter> is a
     constant and can take the following values: MYSQL_ASSOC,
     MYSQL_NUM, and MYSQL_BOTH.
    </para>
    <para>
     Speed-wise, the function is identical to
     <function>mysql_fetch_array</function>, and almost as quick as
     <function>mysql_fetch_row</function> (the difference is
     insignificant).
     <example>
      <title><function>mysql_fetch_object</function> example</title>
      <programlisting role="php">
&lt;?php 
mysql_connect ($host, $user, $password);
$result = mysql_db_query ("database", "select * from table");
while ($row = mysql_fetch_object ($result)) {
    echo $row->user_id;
    echo $row->fullname;
}
mysql_free_result ($result);
?>
      </programlisting>
     </example>
    </para>
    <para> 
     See also: <function>mysql_fetch_array</function> and
     <function>mysql_fetch_row</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-fetch-row">
   <refnamediv>
    <refname>mysql_fetch_row</refname>
    <refpurpose>Get a result row as an enumerated array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>mysql_fetch_row</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns: An array that corresponds to the fetched row, or false
     if there are no more rows.
    </para>
    <para>
     <function>mysql_fetch_row</function> fetches one row of data from
     the result associated with the specified result identifier.  The
     row is returned as an array.  Each result column is stored in an
     array offset, starting at offset 0.
    </para>
    <para>
     Subsequent call to <function>mysql_fetch_row</function> would
     return the next row in the result set, or false if there are no
     more rows.
    </para>
    <para>
     See also: <function>mysql_fetch_array</function>,
     <function>mysql_fetch_object</function>,
     <function>mysql_data_seek</function>,
     <function>mysql_fetch_lengths</function>, and
     <function>mysql_result</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-field-flags">
   <refnamediv>
    <refname>mysql_field_flags</refname>
    <refpurpose>
     Get the flags associated with the specified field in a result
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mysql_field_flags</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int <parameter>field_offset</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>mysql_field_flags</function> returns the field flags of
     the specified field. The flags are reported as a single word
     per flag separated by a single space, so that you can split the
     returned value using <function>explode</function>.
    </para>
    <para>The following flags are reported, if your version of MySQL
     is current enough to support them: "not_null", "primary_key",
     "unique_key", "multiple_key", "blob", "unsigned", "zerofill",
     "binary", "enum", "auto_increment", "timestamp".
    </para>
    <para> 
     For downward compatibility <function>mysql_fieldflags</function>
     can also be used.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-field-name">
   <refnamediv>
    <refname>mysql_field_name</refname> 
    <refpurpose>
     Get the name of the specified field in a result
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mysql_field_name</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int <parameter>field_index</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>mysql_field_name</function> returns the name of the
     specified field index. <parameter>result</parameter> must be a
     valid result identifier and <parameter>field_index</parameter> is
     the numerical offset of the field.
    </para>
    <note>
     <para>
      <parameter>field_index</parameter> starts at 0.
     </para>
     <para>
      e.g. The index of the third field would actually be 2, the index
      of the fourth field would be 3 and so on.
     </para>
    </note>
    <para>
     <example>
      <title><function>mysql_field_name</function> example</title>
      <programlisting role="php">
// The users table consists of three fields: 
//   user_id
//   username
//   password.

$res = mysql_db_query("users", "select * from users", $link);

echo mysql_field_name($res, 0) . "\n";
echo mysql_field_name($res, 2);
      </programlisting>
     </example>
    </para>
    <para>
     The above example would produce the following output:
     <informalexample>
      <programlisting>
user_id
password
      </programlisting>
     </informalexample>
    </para>
    <para>
     For downwards compatibility <function>mysql_fieldname</function>
     can also be used.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-field-len">
   <refnamediv>
    <refname>mysql_field_len</refname> 
    <refpurpose>
     Returns the length of the specified field
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_field_len</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int <parameter>field_offset</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>mysql_field_len</function> returns the length of the
     specified field.
    </para>
    <para>
     For downward compatibility <function>mysql_fieldlen</function>
     can also be used.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-field-seek">
   <refnamediv>
    <refname>mysql_field_seek</refname>
    <refpurpose>
     Set result pointer to a specified field offset
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_field_seek</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int <parameter>field_offset</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Seeks to the specified field offset.  If the next call to
     <function>mysql_fetch_field</function> doesn't include a field
     offset, the field offset specified in
     <function>mysql_field_seek</function> will be returned.
    </para>
    <para>
     See also: <function>mysql_fetch_field</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-field-table">
   <refnamediv>
    <refname>mysql_field_table</refname>
    <refpurpose>
     Get name of the table the specified field is in
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mysql_field_table</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int <parameter>field_offset</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns the name of the table that the specifed field is
     in.
    </para>
    <para>
     For downward compatibility <function>mysql_fieldtable</function>
     can also be used.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-field-type">
   <refnamediv>
    <refname>mysql_field_type</refname>
    <refpurpose>
     Get the type of the specified field in a result
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mysql_field_type</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int <parameter>field_offset</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>mysql_field_type</function> is similar to the
     <function>mysql_field_name</function> function. The arguments are
     identical, but the field type is returned instead. The field type
     will be one of "int", "real", "string", "blob", and others as
     detailed in the <ulink url="&url.mysql.docs;">MySQL
     documentation</ulink>.
     <example>
      <title>mysql field types</title>
      <programlisting role="php">
&lt;?php 

mysql_connect ("localhost:3306");
mysql_select_db ("wisconsin");
$result = mysql_query ("SELECT * FROM onek");
$fields = mysql_num_fields ($result);
$rows   = mysql_num_rows ($result);
$i = 0;
$table = mysql_field_table ($result, $i);
echo "Your '".$table."' table has ".$fields." fields and ".$rows." records &lt;BR>";
echo "The table has the following fields &lt;BR>"; 
while ($i &lt; $fields) {
    $type  = mysql_field_type  ($result, $i);
    $name  = mysql_field_name  ($result, $i);
    $len   = mysql_field_len   ($result, $i);
    $flags = mysql_field_flags ($result, $i);
    echo $type." ".$name." ".$len." ".$flags."&lt;BR>";
    $i++;
}
mysql_close();

?>
      </programlisting>
     </example>
    </para>
    <para> 
     For downward compatibility <function>mysql_fieldtype</function>
     can also be used.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-free-result">
   <refnamediv>
    <refname>mysql_free_result</refname>
    <refpurpose>Free result memory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_free_result</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>mysql_free_result</function> will free all memory
     associated with the result identifier <parameter>result</parameter>.
    </para>
    <para>
     <function>mysql_free_result</function> only needs to be called if
     you are concerned about how much memory is being used for queries
     that return large result sets.  All associated result memory is
     automatically freed at the end of the script's execution.
    </para>
    <para>
     For downward compatibility <function>mysql_freeresult</function>
     can also be used.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-insert-id">
   <refnamediv>
    <refname>mysql_insert_id</refname>
    <refpurpose>
     Get the id generated from the previous INSERT operation
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_insert_id</function></funcdef>
      <paramdef>int 
       <parameter>
        <optional>link_identifier</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>mysql_insert_id</function> returns the ID generated for
     an AUTO_INCREMENT column by the previous INSERT query using the
     given <parameter>link_identifier</parameter>.  If
     <parameter>link_identifier</parameter> isn't specified, the last
     opened link is assumed.
    </para>
    <para>
     <function>mysql_insert_id</function> returns 0 if the previous
     query does not generate an AUTO_INCREMENT value. If you need to
     save the value for later, be sure to call mysql_insert_id()
     immediately after the query that generates the value.
    </para>
    <note>
     <para>
      The value of the MySQL SQL function
      <literal>LAST_INSERT_ID()</literal> always contains the most
      recently generated AUTO_INCREMENT value, and is not reset
      between queries.
    </para>
    </note>
    <warning>
     <para>
      <function>mysql_insert_id</function> converts the return type of
      the native MySQL C API function
      <literal>mysql_insert_id()</literal> to a type of
      <literal>long</literal>.  If your AUTO_INCREMENT column has
      a column type of BIGINT, the value returned by
      <function>mysql_insert_id</function> will be incorrect.
      Instead, use the internal MySQL SQL function
      <literal>LAST_INSERT_ID()</literal>.
     </para>
    </warning>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-list-dbs">
   <refnamediv>
    <refname>mysql_list_dbs</refname> 
    <refpurpose>
     List databases available on a MySQL server
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_list_dbs</function></funcdef>
      <paramdef>int 
       <parameter>
        <optional>link_identifier</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>mysql_list_dbs</function> will return a result pointer
     containing the databases available from the current mysql
     daemon. Use the <function>mysql_tablename</function> function to
     traverse this result pointer.
    </para>
    <para>
     <example>
      <title><function>mysql_list_dbs</function> example</title>
      <programlisting role="php">
$link = mysql_connect('localhost', 'myname', 'secret');
$db_list = mysql_list_dbs($link);

while ($row = mysql_fetch_object($db_list)) {
  echo $row->Database . "\n";
}
      </programlisting>
     </example>
    </para>
    <para>
     The above example would produce the following output:
     <informalexample>
      <programlisting>
database1
database2
database3
..
      </programlisting>
     </informalexample>
    </para>
    <note>
     <para>
      The above code would just as easily work with
      <function>mysql_fetch_row</function> or other similar functions.
     </para>
    </note>
    <para>
     For downward compatibility <function>mysql_listdbs</function> can
     also be used.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-list-fields">
   <refnamediv>
    <refname>mysql_list_fields</refname>
    <refpurpose>List MySQL result fields</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_list_fields</function></funcdef>
      <paramdef>string <parameter>database_name</parameter></paramdef>
      <paramdef>string <parameter>table_name</parameter></paramdef>
      <paramdef>int 
       <parameter>
        <optional>link_identifier</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>mysql_list_fields</function> retrieves information
     about the given tablename. Arguments are the database name and
     the table name. A result pointer is returned which can be used
     with <function>mysql_field_flags</function>,
     <function>mysql_field_len</function>,
     <function>mysql_field_name</function>, and
     <function>mysql_field_type</function>.
    </para>
    <para>
     A result identifier is a positive integer. The function returns
     -1 if a error occurs. A string describing the error will be
     placed in <literal>$phperrmsg</literal>, and unless the function
     was called as <literal>@mysql()</literal> then this error string
     will also be printed out.
    </para>
    <para>
     <example>
      <title><function>mysql_list_fields</function> example</title>
      <programlisting role="php">
$link = mysql_connect('localhost', 'myname', 'secret');

$fields = mysql_list_fields("database1", "table1", $link);
$columns = mysql_num_fields($fields);

for ($i = 0; $i < $columns; $i++) {
  echo mysql_field_name($fields, $i) . "\n";;
}
      </programlisting>
     </example>
    </para>
    <para>
     The above example would produce the following output:
     <informalexample>
      <programlisting>
field1
field2
field3
..
      </programlisting>
     </informalexample>
    </para>
    <para>
     For downward compatibility <function>mysql_listfields</function>
     can also be used.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-list-tables">
   <refnamediv>
    <refname>mysql_list_tables</refname>
    <refpurpose>List tables in a MySQL database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_list_tables</function></funcdef>
      <paramdef>string <parameter>database</parameter></paramdef>
      <paramdef>int 
       <parameter>
        <optional>link_identifier</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>mysql_list_tables</function> takes a database name and
     returns a result pointer much like the
     <function>mysql_db_query</function> function.  The
     <function>mysql_tablename</function> function should be used to
     extract the actual table names from the result pointer.
    </para>
    <para>
     For downward compatibility <function>mysql_listtables</function>
     can also be used.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-num-fields">
   <refnamediv>
    <refname>mysql_num_fields</refname>
    <refpurpose>Get number of fields in result</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_num_fields</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>mysql_num_fields</function> returns the number of
     fields in a result set.
    </para>
    <para> 
     See also: 
     <function>mysql_db_query</function>,
     <function>mysql_query</function>,
     <function>mysql_fetch_field</function>,
     <function>mysql_num_rows</function>.</para>
    <para>
     For downward compatibility <function>mysql_numfields</function>
     can also be used.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-num-rows">
   <refnamediv>
    <refname>mysql_num_rows</refname>
    <refpurpose>Get number of rows in result</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_num_rows</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>mysql_num_rows</function> returns the number of rows in
     a result set. This command is only valid for SELECT statements. 
     To retrieve the number of rows returned from a INSERT, UPDATE or 
     DELETE, use <function>mysql_affected_rows</function>.
     <example>
      <title>
       <function>
        mysql_num_rows example by [EMAIL PROTECTED]
       </function>
      </title>
      <programlisting role="php">
&lt;?php
$conn = mysql_connect("hostaddress", "username", "password"); 
mysql_select_db("database",$conn); // needed if you have m,ultiple db's
$Resultfornummembers = mysql_query("SELECT * FROM Accounts",$conn); 
$NumMembers = mysql_num_rows($Resultfornummembers); 
echo "$NumMembers Members";
?>                          
      </programlisting>
     </example>
    </para>
    <para>
     See also:  
     <function>mysql_db_query</function>, 
     <function>mysql_query</function> and, 
     <function>mysql_fetch_row</function>.
    </para>
    <para>
     For downward compatibility <function>mysql_numrows</function> can
     also be used.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-pconnect">
   <refnamediv>
    <refname>mysql_pconnect</refname> 
    <refpurpose>
     Open a persistent connection to a MySQL Server
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_pconnect</function></funcdef>
      <paramdef>string 
       <parameter>
        <optional>hostname
        <optional>:port</optional>  
        <optional>:/path/to/socket</optional>
        </optional>
       </parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>username</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>password</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns: A positive MySQL persistent link identifier on success,
     or false on error.
    </para>
    <para>
     <function>mysql_pconnect</function> establishes a connection
     to a MySQL server.  The following defaults are assumed for
     missing optional parameters: <parameter>host:port</parameter> =
     'localhost:3306', <parameter>username</parameter> = name of the
     user that owns the server process and
     <parameter>password</parameter> = empty password.
    </para>
    <para>
     The hostname string can also include a port
     number. eg. &quot;hostname:port&quot; or a path to a socket
     eg. &quot;:/path/to/socket&quot; for the localhost.
     <note>
      <para>
       Support for &quot;:port&quot; wass added in 3.0B4.
      </para>
      <para>
       Support for the &quot;:/path/to/socket&quot; was added in
       3.0.10.
      </para>
     </note>
    </para>     
    <para>
     <function>mysql_pconnect</function> acts very much like
     <function>mysql_connect</function> with two major differences.
    </para>
    <para> 
     First, when connecting, the function would first try to find a
     (persistent) link that's already open with the same host,
     username and password.  If one is found, an identifier for it
     will be returned instead of opening a new connection.
    </para>
    <para> 
     Second, the connection to the SQL server will not be closed when
     the execution of the script ends.  Instead, the link will remain
     open for future use (<function>mysql_close</function> will not
     close links established by <function>mysql_pconnect</function>).
    </para>
    <para> 
     This type of links is therefore called 'persistent'.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-query">
   <refnamediv>
    <refname>mysql_query</refname>
    <refpurpose>Send a MySQL query</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_query</function></funcdef>
      <paramdef>string <parameter>query</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>link_identifier</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>mysql_query</function> sends a query to the currently
     active database on the server that's associated with the
     specified link identifier.  If
     <parameter>link_identifier</parameter> isn't specified, the last
     opened link is assumed.  If no link is open, the function tries
     to establish a link as if <function>mysql_connect</function> was
     called with no arguments, and use it.
    </para>
    <note>
     <para>
      The query string should not end with a semicolon.
     </para>
    </note>
    <para>
     <function>mysql_query</function> returns TRUE (non-zero) or FALSE
     to indicate whether or not the query succeeded.  A return value
     of TRUE means that the query was legal and could be executed by
     the server.  It does not indicate anything about the number of
     rows affected or returned. It is perfectly possible for a query
     to succeed but affect no rows or return no rows.
    </para>
    <para>
     The following query is syntactically invalid, so
     <function>mysql_query</function> fails and returns FALSE:
     <example>
      <title><function>mysql_query</function></title>
      <programlisting role="php">
&lt;?php
$result = mysql_query ("SELECT * WHERE 1=1")
    or die ("Invalid query");
?>
      </programlisting>
     </example>
    </para>
    <para>
     The following query is semantically invalid if
     <literal>my_col</literal> is not a column in the table
     <literal>my_tbl</literal>, so <function>mysql_query</function>
     fails and returns FALSE:
     <example>
      <title><function>mysql_query</function></title>
      <programlisting role="php">
&lt;?php
$result = mysql_query ("SELECT my_col FROM my_tbl")
    or die ("Invalid query");
?>
      </programlisting>
     </example>
    </para>
    <para>
     <function>mysql_query</function> will also fail and return FALSE
     if you don't have permission to access the table(s) referenced by
     the query.
    </para>
    <para>
     Assuming the query succeeds, you can call
     <function>mysql_num_rows</function> to find out how many rows
     were returned for a SELECT statment or
     <function>mysql_affected_rows</function> to find out how many
     rows were affected by a DELETE, INSERT, REPLACE, or UPDATE
     statement.
    </para>
    <para>
     For SELECT statements, <function>mysql_query</function> returns a
     new result identifier that you can pass to
     <function>mysql_result</function>.  When you are done with the
     result set, you can free the resources associated with it by
     calling <function>mysql_free_result</function>.  Although, the
     memory will automatically be freed at the end of the script's
     execution.
    </para>
    <para>
     See also: <function>mysql_affected_rows</function>,
     <function>mysql_db_query</function>,
     <function>mysql_free_result</function>,
     <function>mysql_result</function>,
     <function>mysql_select_db</function>, and
     <function>mysql_connect</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-result">
   <refnamediv>
    <refname>mysql_result</refname>
    <refpurpose>Get result data</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>mysql_result</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int <parameter>row</parameter></paramdef>
      <paramdef>mixed 
       <parameter>
        <optional>field</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>mysql_result</function> returns the contents of one
     cell from a MySQL result set.  The field argument can be the
     field's offset, or the field's name, or the field's table dot
     field's name (fieldname.tablename).  If the column name has been
     aliased ('select foo as bar from...'), use the alias instead of
     the column name.
    </para>
    <para>
     When working on large result sets, you should consider using one
     of the functions that fetch an entire row (specified below).  As
     these functions return the contents of multiple cells in one
     function call, they're MUCH quicker than
     <function>mysql_result</function>.  Also, note that specifying a
     numeric offset for the field argument is much quicker than
     specifying a fieldname or tablename.fieldname argument.
    </para>
    <para>
     Calls to <function>mysql_result</function> should not be mixed
     with calls to other functions that deal with the result set.
    </para>
    <para>
     Recommended high-performance alternatives:
     <function>mysql_fetch_row</function>, 
     <function>mysql_fetch_array</function>, and
     <function>mysql_fetch_object</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-select-db">
   <refnamediv>
    <refname>mysql_select_db</refname>
    <refpurpose>Select a MySQL database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>mysql_select_db</function></funcdef>
      <paramdef>string <parameter>database_name</parameter></paramdef>
      <paramdef>int 
       <parameter>
        <optional>link_identifier</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns: true on success, false on error.
    </para>
    <para> 
     <function>mysql_select_db</function> sets the current active
     database on the server that's associated with the specified link
     identifier.  If no link identifier is specified, the last opened
     link is assumed.  If no link is open, the function will try to
     establish a link as if <function>mysql_connect</function> was
     called, and use it.
    </para>
    <para>
     Every subsequent call to <function>mysql_query</function> will be
     made on the active database.
    </para>
    <para> See also:
     <function>mysql_connect</function>, 
     <function>mysql_pconnect</function>, and
     <function>mysql_query</function>.
    </para>
    <para>
     For downward compatibility <function>mysql_selectdb</function>
     can also be used.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.mysql-tablename">
   <refnamediv>
    <refname>mysql_tablename</refname>
    <refpurpose>Get table name of field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>mysql_tablename</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int <parameter>i</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>mysql_tablename</function> takes a result pointer
     returned by the <function>mysql_list_tables</function> function
     as well as an integer index and returns the name of a table. The
     <function>mysql_num_rows</function> function may be used to
     determine the number of tables in the result pointer.
     <example>
      <title><function>Mysql_tablename</function> Example</title>
      <programlisting role="php">
&lt;?php 
mysql_connect ("localhost:3306");
$result = mysql_list_tables ("wisconsin");
$i = 0;
while ($i &lt; mysql_num_rows ($result)) {
    $tb_names[$i] = mysql_tablename ($result, $i);
    echo $tb_names[$i] . "&lt;BR>";
    $i++;
}
?>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/network.xml
+++ phpdoc/kr/functions/network.xml
 <reference id="ref.network">
  <title>Network Functions</title>
  <titleabbrev>Network</titleabbrev>

  <refentry id="function.checkdnsrr">
   <refnamediv>
    <refname>checkdnsrr</refname>
    <refpurpose>
     Check DNS records corresponding to a given Internet host name or
     IP address
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>checkdnsrr</function></funcdef>
      <paramdef>string <parameter>host</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>type</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Searches DNS for records of type <parameter>type</parameter>
     corresponding to <parameter>host</parameter>. Returns true if any
     records are found; returns false if no records were found or if
     an error occurred.
    </simpara>
    <simpara>
     <parameter>type</parameter> may be any one of: A, MX, NS, SOA,
     PTR, CNAME, or ANY.  The default is MX.
    </simpara>
    <simpara>
     <parameter>Host</parameter> may either be the IP address in
     dotted-quad notation or the host name.
    </simpara>
    <simpara>
     See also <function>getmxrr</function>,
     <function>gethostbyaddr</function>,
     <function>gethostbyname</function>,
     <function>gethostbynamel</function>, and the named(8) manual
     page.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.closelog">
   <refnamediv>
    <refname>closelog</refname>
    <refpurpose>Close connection to system logger</refpurpose> 
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>closelog</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Closelog</function> closes the descriptor being used to
     write to the system logger.  The use of
     <function>closelog</function> is optional.
    </para>
    <para>
     See also <function>define_syslog_variables</function>,
     <function>syslog</function> and
     <function>openlog</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.debugger-off">
   <refnamediv>
    <refname>debugger_off</refname>
    <refpurpose>Disable internal PHP debugger</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>debugger_off</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     Disables the internal PHP debugger.  The debugger is still under
     development.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.debugger-on">
   <refnamediv>
    <refname>debugger_on</refname>
    <refpurpose>Enable internal PHP debugger</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>debugger_on</function></funcdef>
      <paramdef>string <parameter>address</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Enables the internal PHP debugger, connecting it to
     <parameter>address</parameter>.  The debugger is still under
     development.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.define-syslog-variables">
   <refnamediv>
    <refname>define_syslog_variables</refname>
    <refpurpose>Initializes all syslog related constants</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>define_syslog_varaibles</function></funcdef>
      <paramdef>void</paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Initializes all constants used in the syslog functions.
    </para>
    <para>
     See also <function>openlog</function>,
     <function>syslog</function> and
     <function>closelog</function>.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.fsockopen">
   <refnamediv>
    <refname>fsockopen</refname>
    <refpurpose>
     Open Internet or Unix domain socket connection
    </refpurpose> 
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>fsockopen</function></funcdef>
      <paramdef>
        string <parameter><optional>udp://</optional>hostname</parameter>
      </paramdef>
      <paramdef>int <parameter>port</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>errno</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>errstr</optional></parameter>
      </paramdef>
      <paramdef>double
       <parameter><optional>timeout</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Initiates a stream connection in the Internet (AF_INET, using TCP
     or UDP) or Unix (AF_UNIX) domain. For the Internet domain, it
     will open a TCP socket connection to
     <parameter>hostname</parameter> on port
     <parameter>port</parameter>.  <parameter>hostname</parameter> may
     in this case be either a fully qualified domain name or an IP
     address. For UDP connections, you need to explicitly specify the
     protocol: <parameter>udp://hostname</parameter>.  For the Unix
     domain, <parameter>hostname</parameter> will be used as the path
     to the socket, <parameter>port</parameter> must be set to 0 in
     this case.  The optional <parameter>timeout</parameter> can be
     used to set a timeout in seconds for the connect system call.
    </para>
    <para>
     <function>Fsockopen</function> returns a file pointer which may
     be used together with the other file functions (such as
     <function>fgets</function>, <function>fgetss</function>,
     <function>fputs</function>, <function>fclose</function>, and
     <function>feof</function>).
    </para>
    <para>
     If the call fails, it will return false and if the optional
     <parameter>errno</parameter> and <parameter>errstr</parameter>
     arguments are present they will be set to indicate the actual
     system level error that occurred on the system-level
     <literal>connect()</literal> call. If the returned errno is 0 and
     the function returned false, it is an indication that the error
     occurred before the <literal>connect()</literal> call. This is
     most likely due to a problem initializing the socket. Note that
     the <parameter>errno</parameter> and
     <parameter>errstr</parameter> arguments must be passed by
     reference.
    </para>
    <para>
     Depending on the environment, the Unix domain or the optional
     connect timeout may not be available.
    </para>
    <para>
     The socket will by default be opened in blocking mode.  You can
     switch it to non-blocking mode by using
     <function>socket_set_blocking</function>.
     <example>
      <title><function>Fsockopen</function> Example</title>
      <programlisting role="php">
$fp = fsockopen ("www.php.net", 80, $errno, $errstr, 30);
if (!$fp) {
    echo "$errstr ($errno)&lt;br&gt;\n";
} else {
    fputs ($fp, "GET / HTTP/1.0\r\n\r\n");
    while (!feof($fp)) {
        echo fgets ($fp,128);
    }
    fclose ($fp);
}
      </programlisting>
     </example>
     The example below shows how to retrieve the day and time
     from the UDP service "daytime" (port 13) in your own machine.
     <example>
     <title>Using UDP connection</title>
     <programlisting role="php">
&lt;?php
$fp = fsockopen("udp://127.0.0.1", 13, $errno, $errstr);
if (!$fp) {
    echo "ERROR: $errno - $errstr&lt;br&gt;\n";
} else {
    fwrite($fp,"\n");
    echo fread($fp, 26);
    fclose($fp);
}
?&gt;
     </programlisting>
     </example>
     <note>
      <para>The timeout parameter was introduced in PHP 3.0.9 and
      UDP support was added in PHP 4.
      </para>
     </note>
     See also: <function>pfsockopen</function>, 
     <function>socket_set_blocking</function>,
     <function>socket_set_timeout</function>, <function>fgets</function>,
     <function>fgetss</function>, <function>fputs</function>,
     <function>fclose</function>, and <function>feof</function>).
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.gethostbyaddr">
   <refnamediv>
    <refname>gethostbyaddr</refname>
    <refpurpose>
     Get the Internet host name corresponding to a given IP address
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>gethostbyaddr</function></funcdef>
      <paramdef>string <parameter>ip_address</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the host name of the Internet host specified by
     <parameter>ip_address</parameter>. If an error occurs, returns
     <parameter>ip_address</parameter>.
    </para>
    <para>
     See also <function>gethostbyname</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gethostbyname">
   <refnamediv>
    <refname>gethostbyname</refname>
    <refpurpose>
     Get the IP address corresponding to a given Internet host name
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>gethostbyname</function></funcdef>
      <paramdef>string <parameter>hostname</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the IP address of the Internet host specified by
     <parameter>hostname</parameter>.
    </para> 
    <para>
     See also <function>gethostbyaddr</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gethostbynamel">
   <refnamediv>
    <refname>gethostbynamel</refname>
    <refpurpose>
     Get a list of IP addresses corresponding to a given Internet host
     name
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>gethostbynamel</function></funcdef>
      <paramdef>string <parameter>hostname</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a list of IP addresses to which the Internet host
     specified by <parameter>hostname</parameter> resolves.
    </para>
    <para>
     See also <function>gethostbyname</function>,
     <function>gethostbyaddr</function>,
     <function>checkdnsrr</function>, <function>getmxrr</function>,
     and the <literal>named(8)</literal> manual page.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.getmxrr">
   <refnamediv>
    <refname>getmxrr</refname>
    <refpurpose>
     Get MX records corresponding to a given Internet host name
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>getmxrr</function></funcdef>
      <paramdef>string <parameter>hostname</parameter></paramdef>
      <paramdef>array <parameter>mxhosts</parameter></paramdef>
      <paramdef>array 
       <parameter><optional>weight</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Searches DNS for MX records corresponding to
     <parameter>hostname</parameter>. Returns true if any records are
     found; returns false if no records were found or if an error
     occurred.
    </simpara>
    <simpara>
     A list of the MX records found is placed into the array
     <parameter>mxhosts</parameter>. If the
     <parameter>weight</parameter> array is given, it will be filled
     with the weight information gathered.
    </simpara>
    <simpara>
     See also <function>checkdnsrr</function>,
     <function>gethostbyname</function>,
     <function>gethostbynamel</function>,
     <function>gethostbyaddr</function>, and the
     <literal>named(8)</literal> manual page.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.getprotobyname">
   <refnamediv>
    <refname>getprotobyname</refname>
    <refpurpose>
     Get protocol number associated with protocol name
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>getprotobyname</function></funcdef>
      <paramdef>string <parameter>name</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Getprotobyname</function> returns the protocol number
     associated with the protocol <parameter>name</parameter> as per
     /etc/protocols.
    </para>
    <para>
     See also: <function>getprotobynumber</function>.
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.getprotobynumber">
   <refnamediv>
    <refname>getprotobynumber</refname>
    <refpurpose>
     Get protocol name associated with protocol number
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>getprotobynumber</function></funcdef>
      <paramdef>int <parameter>number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Getprotobynumber</function> returns the protocol name
     associated with protocol <parameter>number</parameter> as per
     /etc/protocols.
    </para>
    <para>
     See also: <function>getprotobyname</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.getservbyname">
   <refnamediv>
    <refname>getservbyname</refname>
    <refpurpose>
     Get port number associated with an Internet service and protocol
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>getservbyname</function></funcdef>
      <paramdef>string <parameter>service</parameter></paramdef>
      <paramdef>string <parameter>protocol</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Getservbyname</function> returns the Internet port
     which corresponds to <parameter>service</parameter> for the
     specified <parameter>protocol</parameter> as per
     <filename>/etc/services</filename>.
     <parameter>protocol</parameter> is either <literal>TCP</literal>
     or <literal>UDP</literal>.
    </para>
    <para>
     See also: <function>getservbyport</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.getservbyport">
   <refnamediv>
    <refname>getservbyport</refname>
    <refpurpose>
     Get Internet service which corresponds to port and protocol
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>getservbyport</function></funcdef>
      <paramdef>int <parameter>port</parameter></paramdef>
      <paramdef>string <parameter>protocol</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Getservbyport</function> returns the Internet service
     associated with <parameter>port</parameter> for the specified
     <parameter>protocol</parameter> as per /etc/services.
     <parameter>protocol</parameter> is either <literal>TCP</literal>
     or <literal>UDP</literal>.
    </para>
    <para>
     See also: <function>getservbyname</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ip2long">
   <refnamediv>
    <refname>ip2long</refname>
    <refpurpose>
      Converts a string containing an (IPv4) Internet Protocol dotted address
      into a proper address.
    </refpurpose> 
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ip2long</function></funcdef>
      <paramdef>string <parameter>ip_address</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The function <function>ip2long</function> generates an IPv4 Internet
     network address from its Internet standard format (dotted string)
     representation.
     <example>
     <title><function>Ip2long</function> Example</title>
     <programlisting role="php">
&lt;?php
$ip = gethostbyname("www.php.net");
$out = "The following URLs are equivalent:&lt;br&gt;\n";
$out .= "http://www.php.net/, http://".$ip."/, and 
http://".ip2long($ip)."/&lt;br&gt;\n";
echo $out;
?&gt;
     </programlisting>
     </example>
    </para>
    <para>
     See also: <function>long2ip</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.long2ip">
   <refnamediv>
    <refname>long2ip</refname>
    <refpurpose>
      Converts an (IPv4) Internet network address into a string in Internet
      standard dotted format 
    </refpurpose> 
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>long2ip</function></funcdef>
      <paramdef>int <parameter>proper_address</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The function <function>long2ip</function> generates an Internet address
     in dotted format (i.e.: aaa.bbb.ccc.ddd) from the proper address
     representation.
    </para>
    <para>
     See also: <function>ip2long</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.openlog">
   <refnamediv>
    <refname>openlog</refname>
    <refpurpose>Open connection to system logger</refpurpose> 
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>openlog</function></funcdef>
      <paramdef>string <parameter>ident</parameter></paramdef>
      <paramdef>int <parameter>option</parameter></paramdef>
      <paramdef>int <parameter>facility</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Openlog</function> opens a connection to the system
     logger for a program.  The string <parameter>ident</parameter> is
     added to each message.  Values for <parameter>option</parameter>
     and <parameter>facility</parameter> are given below.
     The <parameter>option</parameter> argument is used to indicate
     what loggin options will be used when generating a log message.
     The <parameter>facility</parameter> argument is used to specify what
     type of program is logging the message. This allows you to specify 
     (in your machine's syslog configuration) how messages coming from
     different facilities will be handled.
     The use of <function>openlog</function> is optional. It
     will automatically be called by <function>syslog</function> if
     necessary, in which case <parameter>ident</parameter> will default
     to false.
    </para>
    <para>
     <table>
      <title><function>Openlog</function> Options</title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>Constant</entry>
         <entry>Description</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>LOG_CONS</entry>
         <entry>
          if there is an error while sending data to the system logger,
          write directly to the system console
         </entry>
        </row>
        <row>
         <entry>LOG_NDELAY</entry>
         <entry>
          open the connection to the logger immediately 
         </entry>
        </row>
        <row>
         <entry>LOG_ODELAY</entry>
         <entry>
          (default) delay openning the connection until the first
          message is logged
         </entry>
        </row>
        <row>
         <entry>LOG_PERROR</entry>
         <entry>print log message also to standard error</entry>
        </row>
        <row>
         <entry>LOG_PID</entry>
         <entry>include PID with each message</entry>
        </row>
       </tbody>
      </tgroup>
     </table>
     You can use one or more of this options. When using multiple options
     you need to <literal>OR</literal> them, i.e. to open the connection
     immediately, write to the consoloe and include the PID in each message, 
     you will use: <literal>LOG_CONS | LOG_NDELAY | LOG_PID</literal>
    </para>
    <para>
     <table>
      <title><function>Openlog</function> Facilities</title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>Constant</entry>
         <entry>Description</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>LOG_AUTH</entry>
         <entry>
          security/authorization messages (use LOG_AUTHPRIV instead 
          in systems where that constant is defined)
         </entry>
        </row>
        <row>
         <entry>LOG_AUTHPRIV</entry>
         <entry>security/authorization messages (private)</entry>
        </row>
        <row>
         <entry>LOG_CRON</entry>
         <entry>clock daemon (cron and at)</entry>
        </row>
        <row>
         <entry>LOG_DAEMON</entry>
         <entry>other system daemons</entry>
        </row>
        <row>
         <entry>LOG_KERN</entry>
         <entry>kernel messages</entry>
        </row>
        <row>
         <entry>LOG_LOCAL0 ... LOG_LOCAL7</entry>
         <entry>reserved for local use</entry>
        </row>
        <row>
         <entry>LOG_LPR</entry>
         <entry>line printer subsystem</entry>
        </row>
        <row>
         <entry>LOG_MAIL</entry>
         <entry>mail subsystem</entry>
        </row>
        <row>
         <entry>LOG_NEWS</entry>
         <entry>USENET news subsystem</entry>
        </row>
        <row>
         <entry>LOG_SYSLOG</entry>
         <entry>messages generated internally by syslogd</entry>
        </row>
        <row>
         <entry>LOG_USER</entry>
         <entry>generic user-level messages</entry>
        </row>
        <row>
         <entry>LOG_UUCP</entry>
         <entry>UUCP subsystem</entry>
        </row>
       </tbody>
      </tgroup>
     </table>
    </para>
    <para>
     See also <function>define_syslog_variables</function>,
     <function>syslog</function> and
     <function>closelog</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pfsockopen">
   <refnamediv>
    <refname>pfsockopen</refname>
    <refpurpose>
     Open persistent Internet or Unix domain socket connection
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pfsockopen</function></funcdef>
      <paramdef>string <parameter>hostname</parameter></paramdef>
      <paramdef>int <parameter>port</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>errno</optional></parameter>
       </paramdef>
      <paramdef>string 
       <parameter><optional>errstr</optional></parameter>
      </paramdef>
      <paramdef>int
       <parameter><optional>timeout</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function behaves exactly as <function>fsockopen</function>
     with the difference that the connection is not closed after the
     script finishes.  It is the persistent version of
     <function>fsockopen</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.socket-get-status">
   <refnamediv>
    <refname>socket_get_status</refname>
    <refpurpose>
     Returns information about existing socket resource
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>socket_get_status</function></funcdef>
      <paramdef>resource 
       <parameter>socket_get_status</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns information about an existing socket resource. Currently
     returns four entries in the result array:
    </para>
    <itemizedlist>
     <listitem>
      <para>
       <parameter>timed_out</parameter> (bool) - The socket timed out
       waiting for data
      </para>
     </listitem>
     <listitem>
      <para>
       <parameter>blocked</parameter> (bool) - The socket was blocked
      </para>
     </listitem>
     <listitem>
      <para>
       <parameter>eof</parameter> (bool) - Indicates EOF event
      </para>
     </listitem>
     <listitem>
      <para>
       <parameter>unread_bytes</parameter> (int) - Number of bytes
       left in the socket buffer
      </para>
     </listitem>
    </itemizedlist>
    <para>
     See also 
     <function>accept_connect</function>,
     <function>bind</function>,
     <function>connect</function>,
     <function>listen</function>, and
     <function>strerror</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.socket-set-blocking">
   <refnamediv>
    <refname>socket_set_blocking</refname>
    <refpurpose>Set blocking/non-blocking mode on a socket</refpurpose> 
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>socket_set_blocking</function></funcdef>
      <paramdef>int <parameter>socket descriptor</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     If <parameter>mode</parameter> is false, the given socket
     descriptor will be switched to non-blocking mode, and if true, it
     will be switched to blocking mode.  This affects calls like
     <function>fgets</function> that read from the socket.  In
     non-blocking mode an <function>fgets</function> call will always
     return right away while in blocking mode it will wait for data to
     become available on the socket.
    </para>
    <para>
     This function was previously called as
     <function>set_socket_blocking</function> but this usage is deprecated.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.socket-set-timeout">
   <refnamediv>
    <refname>socket_set_timeout</refname>
    <refpurpose>Set timeout period on a socket</refpurpose> 
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>socket_set_timeout</function></funcdef>
      <paramdef>int <parameter>socket descriptor</parameter></paramdef>
      <paramdef>int <parameter>seconds</parameter></paramdef>
      <paramdef>int <parameter>microseconds</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets the timeout value on <parameter>socket descriptor</parameter>,
     expressed in the sum of <parameter>seconds</parameter> and
     <parameter>microseconds</parameter>.
     <example>
     <title><function>socket_set_timeout</function> Example</title>
       <programlisting role="php">
&lt;?php
$fp = fsockopen("www.php.net", 80);
if(!$fp) {
    echo "Unable to open\n";
} else {
    fputs($fp,"GET / HTTP/1.0\n\n");
    $start = time();
    socket_set_timeout($fp, 2);
    $res = fread($fp, 2000);
    var_dump(socket_get_status($fp));
    fclose($fp);
    print $res;
}
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     This function was previously called as
     <function>set_socket_timeout</function> but this usage is deprecated.
    </para>
    <para>
     See also: <function>fsockopen</function> and <function>fopen</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.syslog">
   <refnamediv>
    <refname>syslog</refname>
    <refpurpose>Generate a system log message</refpurpose> 
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>syslog</function></funcdef>
      <paramdef>int <parameter>priority</parameter></paramdef>
      <paramdef>string <parameter>message</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Syslog</function> generates a log message that will be
     distributed by the system logger.
     <parameter>priority</parameter> is a combination of the facility
     and the level, values for which are given in the next section.
     The remaining argument is the message to send, except that the
     two characters <literal>%m</literal> will be replaced by the
     error message string (strerror) corresponding to the present
     value of <errortype>errno</errortype>.
    </para>
    <para>
     <table>
      <title><function>Syslog</function> Priorities (in descending order)</title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>Constant</entry>
         <entry>Description</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>LOG_EMERG</entry>
         <entry>system is unusable</entry>
        </row>
        <row>
         <entry>LOG_ALERT</entry>
         <entry>action must be taken immediately</entry>
        </row>
        <row>
         <entry>LOG_CRIT</entry>
         <entry>critical conditions</entry>
        </row>
        <row>
         <entry>LOG_ERR</entry>
         <entry>error conditions</entry>
        </row>
        <row>
         <entry>LOG_WARNING</entry>
         <entry>warning conditions</entry>
        </row>
        <row>
         <entry>LOG_NOTICE</entry>
         <entry>normal, but significant, condition</entry>
        </row>
        <row>
         <entry>LOG_INFO</entry>
         <entry>informational message</entry>
        </row>
        <row>
         <entry>LOG_DEBUG</entry>
         <entry>debug-level message</entry>
        </row>
       </tbody>
      </tgroup>
     </table>
    </para>
    <para>
     <example>
      <title>Using <function>syslog</function></title>
      <programlisting role="php">
&lt;?php
define_syslog_variables();
// open syslog, include the process ID and also send
// the log to standard error, and use a user defined
// logging mechanism
openlog(&quot;myScripLog&quot;, LOG_PID | LOG_PERROR, LOG_LOCAL0);

// some code

if (authorized_client()) {
    // do something
} else {
    // unauthorized client!
    // log the attempt
    $access = date(&quot;Y/m/d H:i:s&quot;);
    syslog(LOG_WARNING,&quot;Unauthorized client: $access $REMOTE_ADDR 
($HTTP_USER_AGENT)&quot;);
}

closelog();
?&gt;
      </programlisting>
     </example>
     For information on setting up a user defined log handler, see the
     <citerefentry><refentrytitle>syslog.conf</refentrytitle>
     <manvolnum>5</manvolnum></citerefentry> Unix manual page.  More
     information on the syslog facilities and option can be found in the man
     pages for <citerefentry><refentrytitle>syslog</refentrytitle>
     <manvolnum>3</manvolnum></citerefentry> on Unix machines.
    </para>
    <para>
     On Windows NT, the syslog service is emulated using the Event
     Log.
    </para>
    <para>
     See also <function>define_syslog_variables</function>,
     <function>openlog</function> and
     <function>closelog</function>.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/nis.xml
+++ phpdoc/kr/functions/nis.xml
  <reference id="ref.nis">
  <title>YP/NIS Functions</title>
  <titleabbrev>YP/NIS</titleabbrev>

  <partintro>
   <para>
    NIS (formerly called Yellow Pages) allows network management of
    important administrative files (e.g. the password file). For more
    information refer to the NIS manpage and <ulink url="&url.nis;">
    Introduction to YP/NIS</ulink>. There is also a book called <ulink
    url="&url.nis.book;">Managing NFS and NIS</ulink> by Hal Stern.
   </para>
   <para>
    To get these functions to work, you have to configure PHP with
    <option role="configure">--with-yp</option>(PHP 3) or
    <option role="configure">--enable-yp</option>(PHP 4).
   </para>
  </partintro>

  <refentry id="function.yp-get-default-domain">
   <refnamediv>
    <refname>yp_get_default_domain</refname>
    <refpurpose>Fetches the machine's default NIS domain</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>yp_get_default_domain</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Yp_get_default_domain</function> returns the default
     domain of the node or FALSE. Can be used as the domain parameter
     for successive NIS calls.
    </para>
    <para> 
     A NIS domain can be described a group of NIS maps.  Every host
     that needs to look up information binds itself to a certain
     domain. Refer to the documents mentioned at the beginning for
     more detailed information.
    </para>
    <para>
     <example>
      <title>Example for the default domain</title>
      <programlisting role="php">
&lt;?php
$domain = yp_get_default_domain();
echo "Default NIS domain is: " . $domain;
?>
      </programlisting>
     </example>
    </para>
<!--
    <para>
     See also: <link linkend="function.yp-errno">yp_errno</link> and
     <link linkend="function.yp-err-string">yp_err_string</link>
    </para>
-->
   </refsect1>
  </refentry>

  <refentry id="function.yp-order">
   <refnamediv>
    <refname>yp_order</refname>
    <refpurpose>Returns the order number for a map</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>yp_order</function></funcdef>
      <paramdef>string <parameter>domain</parameter></paramdef>
      <paramdef>string <parameter>map</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Yp_order</function> returns the order number for a map
     or FALSE.
    </para>
    <para>
     <example>
      <title>Example for the NIS order</title>
      <programlisting role="php">
&lt;?php
    $number = yp_order($domain,$mapname);
    echo "Order number for this map is: " . $order;
?>
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>yp-get-default-domain</function>.
<!--
     linkend="function.yp-errno">yp_errno</link> and <link
     linkend="function.yp-err-string">yp_err_string</link>
-->
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.yp-master">
   <refnamediv>
    <refname>yp_master</refname> 
    <refpurpose>
     Returns the machine name of the master NIS server for a map
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>yp_master</function></funcdef> 
      <paramdef>string <parameter>domain</parameter></paramdef>
      <paramdef>string <parameter>map</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Yp_master</function> returns the machine name of
     the master NIS server for a map.
    </para>
    <para>
     <example>
      <title>Example for the NIS master</title>
      <programlisting role="php">
&lt;?php
$number = yp_master ($domain, $mapname);
echo "Master for this map is: " . $master;
?>
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>yp-get-default-domain</function>.
<!--
     linkend="function.yp-errno">yp_errno</link> and <link
     linkend="function.yp-err-string">yp_err_string</link>
-->
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.yp-match">
   <refnamediv>
    <refname>yp_match</refname>
    <refpurpose>Returns the matched line</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>yp_match</function></funcdef>
      <paramdef>string <parameter>domain</parameter></paramdef>
      <paramdef>string <parameter>map</parameter></paramdef>
      <paramdef>string <parameter>key</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Yp_match</function> returns the value associated with
     the passed key out of the specified map or FALSE. This key must
     be exact.</para>
    <para>
     <example>
      <title>Example for NIS match</title>
      <programlisting role="php">
&lt;?php
$entry = yp_match ($domain, "passwd.byname", "joe");
echo "Matched entry is: " . $entry;
?>
      </programlisting>
     </example>
    </para>
    <para>
     In this case this could be: joe:##joe:11111:100:Joe
     User:/home/j/joe:/usr/local/bin/bash
    </para>
    <para>
     See also <function>yp-get-default-domain</function>
<!--
     linkend="function.yp-errno">yp_errno</link> and <link
     linkend="function.yp-err-string">yp_err_string</link>
-->
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.yp-first">
   <refnamediv>
    <refname>yp_first</refname> 
    <refpurpose>
     Returns the first key-value pair from the named map
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>yp_first</function></funcdef>
      <paramdef>string <parameter>domain</parameter></paramdef>
      <paramdef>string <parameter>map</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Yp_first</function> returns the first key-value
     pair from the named map in the named domain, otherwise FALSE.
    </para>
    <para>
     <example>
      <title>Example for the NIS first</title>
      <programlisting role="php">
&lt;?php
    $entry = yp_first($domain, "passwd.byname");
    $key = key($entry);
    echo "First entry in this map has key " . $key 
          . " and value " . $entry[$key];
?>
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>yp-get-default-domain</function>
<!--
     <link linkend="function.yp-errno">yp_errno</link> and <link
     linkend="function.yp-err-string">yp_err_string</link>
-->
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.yp-next">
   <refnamediv>
    <refname>yp_next</refname>
    <refpurpose>Returns the next key-value pair in the named
     map.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>yp_next</function></funcdef>
      <paramdef>string <parameter>domain</parameter></paramdef>
      <paramdef>string <parameter>map</parameter></paramdef>
      <paramdef>string <parameter>key</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Yp_next</function> returns the next key-value pair in
     the named map after the specified key or FALSE.
    </para>
    <para>
     <example>
      <title>Example for NIS next</title>
      <programlisting role="php">
&lt;?php
$entry = yp_next ($domain, "passwd.byname", "joe");

if (!$entry) {
    echo yp_errno() . ": " . yp_err_string();
}

$key = key ($entry);

echo "The next entry after joe has key " . $key 
      . " and value " . $entry[$key];
?>
      </programlisting>
     </example>
    </para>
    <para> 
     See also <function>yp-get-default-domain</function>.
<!--
     <link linkend="function.yp-errno">yp_errno</link> and <link
     linkend="function.yp-err-string">yp_err_string</link>
-->
    </para>
   </refsect1>
  </refentry>

<!-- Function doesn't exist 
    
  <refentry id="function.yp-errno">
   <refnamediv>
   <refname>yp_errno</refname> 
    <refpurpose>
     Returns the error code of the previous operation
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>yp_errno</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>Yp_errno</function> returns the error code of the
     previous operation.
    </para>
    <para>
     Possible errors are:
    </para>
    <para>
     <simplelist>
      <member>1 args to function are bad</member> 
      <member>2 RPC failure - domain has been unbound</member>
      <member>3 can't bind to server on this domain</member>
      <member>4 no such map in server's domain</member>
      <member>5 no such key in map</member>
      <member>6 internal yp server or client error</member>
      <member>7 resource allocation failure</member> 
      <member>8 no more records in map database</member>
      <member>9 can't communicate with portmapper</member>
      <member>10 can't communicate with ypbind</member>
      <member>11 can't communicate with ypserv</member>
      <member>12 local domain name not set</member> 
      <member>13 yp database is bad</member> 
      <member>14 yp version mismatch</member> 
      <member>15 access violation</member> 
      <member>16 database busy</member>
     </simplelist>
    </para>
    <para>
     See also <function>yp_err_string</function>.
    </para>
   </refsect1>
  </refentry>

-->

<!-- Function doesn't exist 

  <refentry id="function.yp-err-string">
   <refnamediv>
   <refname>yp_err_string</refname> 
   <refpurpose>
    Returns the error string associated with the previous operation
   </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>yp_err_string</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Yp_err_string</function> returns the error message
     associated with the previous operation.  Useful to indicate what
     exactly went wrong.
    </para>
    <para>
     <example>
      <title>Example for NIS errors</title>
      <programlisting role="php">
&lt;?php
    echo "Error: " . yp_err_string();
?>
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>yp_errno</function>.
    </para>
   </refsect1>
  </refentry>

-->

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/oci8.xml
+++ phpdoc/kr/functions/oci8.xml
 <reference id="ref.oci8">
  <title>Oracle 8 functions</title>
  <titleabbrev>OCI8</titleabbrev>
  <partintro>
   <para>
    These functions allow you to access Oracle8 and Oracle7 databases.
    It uses the Oracle8 Call-Interface (OCI8). You will need the Oracle8
    client libraries to use this extension.
   </para>
   <para>
    This extension is more flexible than the standard Oracle
    extension. It supports binding of global and local PHP variables
    to Oracle placeholders, has full LOB, FILE and ROWID support
    and allows you to use user-supplied define variables.
   </para>
   <para>
    Before using this extension, make sure that you have set up your
    oracle environment variables properly for the Oracle user, as well
    as your web daemon user. The variables you might need to set are as
    follows:
    <itemizedlist>
     <listitem>
      <simpara>
       ORACLE_HOME
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       ORACLE_SID
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       LD_PRELOAD
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       LD_LIBRARY_PATH
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       NLS_LANG
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       ORA_NLS33
      </simpara>
     </listitem>
    </itemizedlist>
   </para>
   <para>
    After setting up the environment variables for your webserver user,
    be sure to also add the webserver user (nobody, www) to the oracle
    group.
   </para>
   <para>
    <example>
     <title>OCI Hints</title>
      <programlisting role="php">
&lt;?php
// by [EMAIL PROTECTED]

// Use option: OCI_DEFAULT for execute command to delay execution
OCIExecute($stmt, OCI_DEFAULT);

// for retrieve data use (after fetch):

$result = OCIResult($stmt, $n);
if (is_object ($result)) $result = $result->load();

// For INSERT or UPDATE statement use:

$sql = "insert into table (field1, field2) values (field1 = 'value',
 field2 = empty_clob()) returning field2 into :field2";
OCIParse($conn, $sql);
$clob = OCINewDescriptor($conn, OCI_D_LOB);
OCIBindByName ($stmt, ":field2", &$clob, -1, OCI_B_CLOB);
OCIExecute($stmt, OCI_DEFAULT);
$clob->save ("some text");

?&gt;
     </programlisting>
    </example>
   </para>
   <para>
    You can easily access stored procedures in the same way as you
    would from the commands line.
    <example>
     <title>Using Stored Procedures</title>
      <programlisting role="php">
&lt;?php
// by [EMAIL PROTECTED]
$sth = OCIParse ( $dbh, "begin sp_newaddress( :address_id, '$firstname',
 '$lastname', '$company', '$address1', '$address2', '$city', '$state',
 '$postalcode', '$country', :error_code );end;" );

// This calls stored procedure sp_newaddress, with :address_id being an
// in/out variable and :error_code being an out variable. 
// Then you do the binding:

   OCIBindByName ( $sth, ":address_id", $addr_id, 10 );
   OCIBindByName ( $sth, ":error_code", $errorcode, 10 );
   OCIExecute ( $sth );

?&gt;
     </programlisting>
    </example>
   </para>
  </partintro>

  <refentry id="function.ocidefinebyname">
   <refnamediv>
    <refname>OCIDefineByName</refname>
    <refpurpose>
     Use a PHP variable for the define-step during a SELECT
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCIDefineByName</function></funcdef>
      <paramdef>int <parameter>stmt</parameter></paramdef>
      <paramdef>string <parameter>Column-Name</parameter></paramdef>
      <paramdef>mixed <parameter>variable</parameter></paramdef>
      <paramdef>int <parameter><optional>type</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCIDefineByName</function> uses fetches SQL-Columns
     into user-defined PHP-Variables. Be careful that Oracle user
     ALL-UPPERCASE column-names, whereby in your select you can also
     write lower-case. <function>OCIDefineByName</function> expects
     the <parameter>Column-Name</parameter> to be in uppercase. If you
     define a variable that doesn't exists in you select statement, no
     error will be given!
    </para>
    <para>
     If you need to define an abstract Datatype (LOB/ROWID/BFILE) you
     need to allocate it first using
     <function>OCINewDescriptor</function> function. See also the
     <function>OCIBindByName</function> function.
    </para>
     <example>
      <title>OCIDefineByName</title>
      <programlisting>
&lt;?php
/* OCIDefineByPos example [EMAIL PROTECTED] (980219) */

$conn = OCILogon("scott","tiger");

$stmt = OCIParse($conn,"select empno, ename from emp");

/* the define MUST be done BEFORE ociexecute! */

OCIDefineByName($stmt,"EMPNO",$empno);
OCIDefineByName($stmt,"ENAME",$ename);

OCIExecute($stmt);

while (OCIFetch($stmt)) {
    echo "empno:".$empno."\n";
    echo "ename:".$ename."\n";
}

OCIFreeStatement($stmt);
OCILogoff($conn);
?>
     </programlisting>
    </example>
   </refsect1>
  </refentry>

  <refentry id="function.ocibindbyname">
   <refnamediv>
    <refname>OCIBindByName</refname>
    <refpurpose>
     Bind a PHP variable to an Oracle Placeholder
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCIBindByName</function></funcdef>
      <paramdef>int <parameter>stmt</parameter></paramdef>
      <paramdef>string <parameter>ph_name</parameter></paramdef>
      <paramdef>mixed &amp;<parameter>variable</parameter></paramdef>
      <paramdef>int <parameter>length</parameter></paramdef>
      <paramdef>int <parameter>
       <optional>type</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCIBindByName</function> binds the PHP variable
     <parameter>variable</parameter> to the Oracle placeholder
     <parameter>ph_name</parameter>.  Whether it will be used for
     input or output will be determined run-time, and the necessary
     storage space will be allocated. The
     <parameter>length</parameter> parameter sets the maximum length
     for the bind. If you set <parameter>length</parameter> to -1
     <function>OCIBindByName</function> will use the current length of
     <parameter>variable</parameter> to set the maximum length.
    </para>
    <para>
     If you need to bind an abstract Datatype (LOB/ROWID/BFILE) you
     need to allocate it first using
     <function>OCINewDescriptor</function> function. The
     <parameter>length</parameter> is not used for abstract Datatypes
     and should be set to -1. The <parameter>type</parameter> variable
     tells oracle, what kind of descriptor we want to use. Possible
     values are: OCI_B_FILE (Binary-File), OCI_B_CFILE
     (Character-File), OCI_B_CLOB (Character-LOB), OCI_B_BLOB
     (Binary-LOB) and OCI_B_ROWID (ROWID).
    </para>
    <example>
     <title>OCIDefineByName</title>
     <programlisting>
&lt;?php
/* OCIBindByPos example [EMAIL PROTECTED] (980221)
  inserts 3 records into emp, and uses the ROWID for updating the 
  records just after the insert.
*/

$conn = OCILogon("scott","tiger");

$stmt = OCIParse($conn,"insert into emp (empno, ename) ".
                                           "values (:empno,:ename) ".
                                           "returning ROWID into :rid");

$data = array(1111 => "Larry", 2222 => "Bill", 3333 => "Jim");

$rowid = OCINewDescriptor($conn,OCI_D_ROWID);

OCIBindByName($stmt,":empno",&amp;$empno,32);
OCIBindByName($stmt,":ename",&amp;$ename,32);
OCIBindByName($stmt,":rid",&amp;$rowid,-1,OCI_B_ROWID);

$update = OCIParse($conn,"update emp set sal = :sal where ROWID = :rid");
OCIBindByName($update,":rid",&amp;$rowid,-1,OCI_B_ROWID);
OCIBindByName($update,":sal",&amp;$sal,32);

$sal = 10000;

while (list($empno,$ename) = each($data)) {
        OCIExecute($stmt);
        OCIExecute($update);
} 

$rowid->free();

OCIFreeStatement($update);
OCIFreeStatement($stmt);

$stmt = OCIParse($conn,"select * from emp where empno in (1111,2222,3333)");
OCIExecute($stmt);
while (OCIFetchInto($stmt,&amp;$arr,OCI_ASSOC)) {
        var_dump($arr);
}
OCIFreeStatement($stmt);

/* delete our "junk" from the emp table.... */
$stmt = OCIParse($conn,"delete from emp where empno in (1111,2222,3333)");
OCIExecute($stmt);
OCIFreeStatement($stmt);

OCILogoff($conn);
?>
     </programlisting>
    </example>
    <warning>
     <para>
      It is a bad idea to use magic quotes and
      <function>OciBindByName</function> simultaneously as no quoting
      is needed on quoted variables and any quotes magically applied
      will be written into your database as
      <function>OciBindByName</function> is not able to distinguish
      magically added quotings from those added by intention.
     </para> 
    </warning>
   </refsect1>
  </refentry>
  
  <refentry id="function.ocilogon">
   <refnamediv>
    <refname>OCILogon</refname>
    <refpurpose>Establishes a connection to Oracle</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCILogon</function></funcdef>
      <paramdef>string <parameter>username</parameter></paramdef>
      <paramdef>string <parameter>password</parameter></paramdef>
      <paramdef>string
       <parameter><optional>db</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCILogon</function> returns an connection identifier
     needed for most other OCI calls.  The optional third parameter
     can either contain the name of the local Oracle instance or the
     name of the entry in tnsnames.ora to which you want to connect.
     If the optional third parameter is not specified, PHP uses the
     environment variables ORACLE_SID (Oracle instance) or TWO_TASK
     (tnsnames.ora) to determine which database to connect to.
    </para>
    <para>Connections are shared at the page level when using
     <function>OCILogon</function>.  This means that commits and
     rollbacks apply to all open transactions in the page, even if you
     have created multiple connections.
    </para>
    <para>
     This example demonstrates how the connections are shared.
     <example>
      <title>OCILogon</title>
      <programlisting>
&lt;?php
print "&lt;HTML>&lt;PRE>";
$db = "";

$c1 = ocilogon("scott","tiger",$db);
$c2 = ocilogon("scott","tiger",$db);

function create_table($conn)
{ $stmt = ociparse($conn,"create table scott.hallo (test varchar2(64))");
  ociexecute($stmt);
  echo $conn." created table\n\n";
}

function drop_table($conn)
{ $stmt = ociparse($conn,"drop table scott.hallo");
  ociexecute($stmt);
  echo $conn." dropped table\n\n";
}

function insert_data($conn)
{ $stmt = ociparse($conn,"insert into scott.hallo 
            values('$conn' || ' ' || to_char(sysdate,'DD-MON-YY HH24:MI:SS'))");
  ociexecute($stmt,OCI_DEFAULT);
  echo $conn." inserted hallo\n\n";
}

function delete_data($conn)
{ $stmt = ociparse($conn,"delete from scott.hallo");
  ociexecute($stmt,OCI_DEFAULT);
  echo $conn." deleted hallo\n\n";
}

function commit($conn)
{ ocicommit($conn);
  echo $conn." committed\n\n";
}

function rollback($conn)
{ ocirollback($conn);
  echo $conn." rollback\n\n";
}

function select_data($conn)
{ $stmt = ociparse($conn,"select * from scott.hallo");
  ociexecute($stmt,OCI_DEFAULT);
  echo $conn."----selecting\n\n";
  while (ocifetch($stmt))
    echo $conn." &lt;".ociresult($stmt,"TEST").">\n\n";
  echo $conn."----done\n\n";
}

create_table($c1);
insert_data($c1);   // Insert a row using c1
insert_data($c2);   // Insert a row using c2

select_data($c1);   // Results of both inserts are returned
select_data($c2);   

rollback($c1);      // Rollback using c1

select_data($c1);   // Both inserts have been rolled back
select_data($c2);   

insert_data($c2);   // Insert a row using c2
commit($c2);        // commit using c2

select_data($c1);   // result of c2 insert is returned

delete_data($c1);   // delete all rows in table using c1
select_data($c1);   // no rows returned
select_data($c2);   // no rows returned
commit($c1);        // commit using c1

select_data($c1);   // no rows returned
select_data($c2);   // no rows returned


drop_table($c1);
print "&lt;/PRE>&lt;/HTML>";
?></programlisting></example></para>
    <simpara>
     See also <function>OCIPLogon</function> and
     <function>OCINLogon</function>.</simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ociplogon">
   <refnamediv>
    <refname>OCIPLogon</refname>
    <refpurpose>Connect to an Oracle database and log on using a
    persistant connection. Returns a new session.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCIPLogon</function></funcdef>
      <paramdef>string <parameter>username</parameter></paramdef>
      <paramdef>string <parameter>password</parameter></paramdef>
      <paramdef>string
       <parameter><optional>db</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCIPLogon</function> creates a persistent connection to
     an Oracle 8 database and logs on.  The optional third parameter
     can either contain the name of the local Oracle instance or the
     name of the entry in tnsnames.ora to which you want to connect.
     If the optional third parameter is not specified, PHP uses the
     environment variables ORACLE_SID (Oracle instance) or TWO_TASK
     (tnsnames.ora) to determine which database to connect to.
    </para>
    <simpara>
     See also <function>OCILogon</function> and
     <function>OCINLogon</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ocinlogon">
   <refnamediv>
    <refname>OCINLogon</refname>
    <refpurpose>Connect to an Oracle database and log on using a new
    connection. Returns a new session.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCINLogon</function></funcdef>
      <paramdef>string <parameter>username</parameter></paramdef>
      <paramdef>string <parameter>password</parameter></paramdef>
      <paramdef>string
       <parameter><optional>db</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCINLogon</function> creates a new connection to an
     Oracle 8 database and logs on.  The optional third parameter can
     either contain the name of the local Oracle instance or the name
     of the entry in tnsnames.ora to which you want to connect.  If
     the optional third parameter is not specified, PHP uses the
     environment variables ORACLE_SID (Oracle instance) or TWO_TASK
     (tnsnames.ora) to determine which database to connect to.
    </para>
    <para>
     <function>OCINLogon</function> forces a new connection.  This
     should be used if you need to isolate a set of transactions.  By
     default, connections are shared at the page level if using
     <function>OCILogon</function> or at the web server process level
     if using <function>OCIPLogon</function>.  If you have multiple
     connections open using <function>OCINLogon</function>, all
     commits and rollbacks apply to the specified connection only.
    </para>
    <para>
     This example demonstrates how the connections are separated.
     <example>
      <title>OCINLogon</title>
      <programlisting>
&lt;?php
print "&lt;HTML>&lt;PRE>";
$db = "";

$c1 = ocilogon("scott","tiger",$db);
$c2 = ocinlogon("scott","tiger",$db);

function create_table($conn)
{ $stmt = ociparse($conn,"create table scott.hallo (test
varchar2(64))");
  ociexecute($stmt);
  echo $conn." created table\n\n";
}

function drop_table($conn)
{ $stmt = ociparse($conn,"drop table scott.hallo");
  ociexecute($stmt);
  echo $conn." dropped table\n\n";
}

function insert_data($conn)
{ $stmt = ociparse($conn,"insert into scott.hallo 
            values('$conn' || ' ' || to_char(sysdate,'DD-MON-YY HH24:MI:SS'))");
  ociexecute($stmt,OCI_DEFAULT);
  echo $conn." inserted hallo\n\n";
}

function delete_data($conn)
{ $stmt = ociparse($conn,"delete from scott.hallo");
  ociexecute($stmt,OCI_DEFAULT);
  echo $conn." deleted hallo\n\n";
}

function commit($conn)
{ ocicommit($conn);
  echo $conn." committed\n\n";
}

function rollback($conn)
{ ocirollback($conn);
  echo $conn." rollback\n\n";
}

function select_data($conn)
{ $stmt = ociparse($conn,"select * from scott.hallo");
  ociexecute($stmt,OCI_DEFAULT);
  echo $conn."----selecting\n\n";
  while (ocifetch($stmt))
    echo $conn." &lt;".ociresult($stmt,"TEST").">\n\n";
  echo $conn."----done\n\n";
}

create_table($c1);
insert_data($c1);

select_data($c1);   
select_data($c2);   

rollback($c1);      

select_data($c1);   
select_data($c2);   

insert_data($c2);   
commit($c2);        

select_data($c1);   

delete_data($c1);   
select_data($c1);   
select_data($c2);   
commit($c1);        

select_data($c1);
select_data($c2);


drop_table($c1);
print "&lt;/PRE>&lt;/HTML>";
?></programlisting></example>
    </para>
    <simpara>
     See also <function>OCILogon</function> and
     <function>OCIPLogon</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ocilogoff">
   <refnamediv>
    <refname>OCILogOff</refname>
    <refpurpose>Disconnects from Oracle</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCILogOff</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCILogOff</function> closes an Oracle connection.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ociexecute">
   <refnamediv>
    <refname>OCIExecute</refname>
    <refpurpose>Execute a statement</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCIExecute</function></funcdef>
      <paramdef>int <parameter>statement</parameter></paramdef>
      <paramdef>int
       <parameter><optional>mode</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCIExecute</function> executes a previously parsed
     statement. (see <function>OCIParse</function>. The optional
     <parameter>mode</parameter> allows you to specify the
     execution-mode (default is OCI_COMMIT_ON_SUCCESS). If you don't
     want statements to be committed automaticly specify OCI_DEFAULT as
     your mode.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ocicommit">
   <refnamediv>
    <refname>OCICommit</refname>
    <refpurpose>Commits outstanding transactions</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCICommit</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCICommit</function> commits all outstanding statements
     for Oracle connection <parameter>connection</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ocirollback">
   <refnamediv>
    <refname>OCIRollback</refname>
    <refpurpose>Rolls back outstanding transactions</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCIRollback</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCIRollback</function> rolls back all outstanding
     statements for Oracle connection <parameter>connection</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ocinewdescriptor">
   <refnamediv>
    <refname>OCINewDescriptor</refname>
    <refpurpose>
     Initialize a new empty descriptor LOB/FILE (LOB is default)
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>OCINewDescriptor</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>int
       <parameter><optional>type</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCINewDescriptor</function> Allocates storage to hold
     descriptors or LOB locators. Valid values for the valid 
     <parameter>type</parameter> are OCI_D_FILE, OCI_D_LOB, OCI_D_ROWID.
     For LOB descriptors, the methods load, save, and savefile are 
     associated with the descriptor, for BFILE only the load method
     exists. See the second example usage hints.
    </para>
    <example>
     <title>OCINewDescriptor</title>
     <programlisting>
&lt;?php   
    /* This script is designed to be called from a HTML form.
     * It expects $user, $password, $table, $where, and $commitsize
     * to be passed in from the form.  The script then deletes
     * the selected rows using the ROWID and commits after each
     * set of $commitsize rows. (Use with care, there is no rollback)
     */
    $conn = OCILogon($user, $password);
    $stmt = OCIParse($conn,"select rowid from $table $where");
    $rowid = OCINewDescriptor($conn,OCI_D_ROWID);
    OCIDefineByName($stmt,"ROWID",&amp;$rowid);   
    OCIExecute($stmt);
    while ( OCIFetch($stmt) ) {      
       $nrows = OCIRowCount($stmt);
       $delete = OCIParse($conn,"delete from $table where ROWID = :rid");
       OCIBindByName($delete,":rid",&amp;$rowid,-1,OCI_B_ROWID);
       OCIExecute($delete);      
       print "$nrows\n";
       if ( ($nrows % $commitsize) == 0 ) {
           OCICommit($conn);      
       }   
    }
    $nrows = OCIRowCount($stmt);   
    print "$nrows deleted...\n";
    OCIFreeStatement($stmt);  
    OCILogoff($conn);
?>  
     </programlisting>
     <programlisting>
&lt;?php
    /* This script demonstrates file upload to LOB columns
     * The formfield used for this example looks like this
     * &lt;form action="upload.php3" method="post" enctype="multipart/form-data">
     * &lt;input type="file" name="lob_upload">
     * ...
     */
  if(!isset($lob_upload) || $lob_upload == 'none'){
?>
&lt;form action="upload.php3" method="post" enctype="multipart/form-data">
Upload file: &lt;input type="file" name="lob_upload">&lt;br>
&lt;input type="submit" value="Upload"> - &lt;input type="reset">
&lt;/form>
&lt;?php
  } else {
     // $lob_upload contains the temporary filename of the uploaded file
     $conn = OCILogon($user, $password);
     $lob = OCINewDescriptor($conn, OCI_D_LOB);
     $stmt = OCIParse($conn,"insert into $table (id, the_blob) 
               values(my_seq.NEXTVAL, EMPTY_BLOB()) returning the_blob into 
:the_blob");
     OCIBindByName($stmt, ':the_blob', &amp;$lob, -1, OCI_B_BLOB);
     OCIExecute($stmt);
     if($lob->savefile($lob_upload)){
        OCICommit($conn);
        echo "Blob successfully uploaded\n";
     }else{
        echo "Couldn't upload Blob\n";
     }
     OCIFreeDesc($lob);
     OCIFreeStatement($stmt);
     OCILogoff($conn);
  }
?>
     </programlisting>
    </example>
   </refsect1>
  </refentry>
  
  <refentry id="function.ocirowcount">
   <refnamediv>
    <refname>OCIRowCount</refname>
    <refpurpose>Gets the number of affected rows</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCIRowCount</function></funcdef>
      <paramdef>int <parameter>statement</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCIRowCount</function> returns the number of rows affected
         for eg update-statements. This function will not tell you the number
         of rows that a select will return!</para>
    <para>
     <example>
      <title>OCIRowCount</title>
      <programlisting>
&lt;?php
    print "&lt;HTML>&lt;PRE>";
    $conn = OCILogon("scott","tiger");
    $stmt = OCIParse($conn,"create table emp2 as select * from emp");
    OCIExecute($stmt);
    print OCIRowCount($stmt) . " rows inserted.&lt;BR>";
    OCIFreeStatement($stmt);
    $stmt = OCIParse($conn,"delete from emp2");
    OCIExecute($stmt);
    print OCIRowCount($stmt) . " rows deleted.&lt;BR>";
    OCICommit($conn);
    OCIFreeStatement($stmt);
    $stmt = OCIParse($conn,"drop table emp2");
    OCIExecute($stmt);
    OCIFreeStatement($stmt);
    OCILogOff($conn);
    print "&lt;/PRE>&lt;/HTML>";
?> </programlisting></example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ocinumcols">
   <refnamediv>
    <refname>OCINumCols</refname>
    <refpurpose>
     Return the number of result columns in a statement
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCINumCols</function></funcdef>
      <paramdef>int <parameter>stmt</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCINumCols</function> returns the number of columns in a 
     statement
    </para>
    <example>
     <title>OCINumCols</title>
     <programlisting>
&lt;?php   
    print "&lt;HTML>&lt;PRE>\n";   
    $conn = OCILogon("scott", "tiger");
    $stmt = OCIParse($conn,"select * from emp");
    OCIExecute($stmt);
    while ( OCIFetch($stmt) ) {
        print "\n";   
        $ncols = OCINumCols($stmt);
        for ( $i = 1; $i &lt;= $ncols; $i++ ) {
            $column_name  = OCIColumnName($stmt,$i);
            $column_value = OCIResult($stmt,$i);
            print $column_name . ': ' . $column_value . "\n";
        }
        print "\n";
    }
    OCIFreeStatement($stmt);  
    OCILogoff($conn);   
    print "&lt;/PRE>";
    print "&lt;/HTML>\n"; 
?>   
     </programlisting>
    </example>
   </refsect1>
  </refentry>
 
  <refentry id="function.ociresult">
   <refnamediv>
    <refname>OCIResult</refname>
    <refpurpose>Returns column value for fetched row</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>OCIResult</function></funcdef>
      <paramdef>int <parameter>statement</parameter></paramdef>
      <paramdef>mixed <parameter>column</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCIResult</function> returns the data for column 
         <parameter>column</parameter> in the current row (see 
         <function>OCIFetch</function>).<function>OCIResult</function> will
         return everything as strings except for abstract types (ROWIDs,
         LOBs and FILEs).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ocifetch">
   <refnamediv>
    <refname>OCIFetch</refname>
    <refpurpose>Fetches the next row into result-buffer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCIFetch</function></funcdef>
      <paramdef>int <parameter>statement</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCIFetch</function> fetches the next row (for SELECT
     statements) into the internal result-buffer.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ocifetchinto">
   <refnamediv>
    <refname>OCIFetchInto</refname>
    <refpurpose>Fetches the next row into result-array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCIFetchInto</function></funcdef>
      <paramdef>int <parameter>stmt</parameter></paramdef>
      <paramdef>array &amp;<parameter>result</parameter></paramdef>
      <paramdef>int
       <parameter><optional>mode</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCIFetchInto</function> fetches the next row (for SELECT
     statements) into the <parameter>result</parameter> array.
     <function>OCIFetchInto</function> will overwrite the previous
     content of <parameter>result</parameter>. By default 
     <parameter>result</parameter> will contain a one-based array of all
     columns that are not NULL.
    </para>
        <para>
         The <parameter>mode</parameter> parameter allows you to change the
         default behaviour. You can specify more than one flag by simply
         adding them up (eg OCI_ASSOC+OCI_RETURN_NULLS). The known flags
         are:
     <simplelist>
      <member>
       <literal>OCI_ASSOC</literal> Return an associative array.
      </member>
      <member>
       <literal>OCI_NUM</literal> Return an numbered array starting with
       one. (DEFAULT)
      </member>
      <member>
       <literal>OCI_RETURN_NULLS</literal> Return empty columns.
      </member>
      <member>
       <literal>OCI_RETURN_LOBS</literal> Return the value of a LOB
       instead of the descriptor.
      </member>
     </simplelist>
        </para>
   </refsect1>
  </refentry>

  <refentry id="function.ocifetchstatement">
   <refnamediv>
    <refname>OCIFetchStatement</refname>
    <refpurpose>Fetch all rows of result data into an array.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCIFetchStatement</function></funcdef>
      <paramdef>int <parameter>stmt</parameter></paramdef>
      <paramdef>array &amp;<parameter>variable</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCIFetchStatement</function> fetches all the rows from a 
     result into a user-defined array.
     <function>OCIFetchStatement</function> returns the number of rows
     fetched. 
    </para>
     <example>
      <title>OCIFetchStatement</title>
      <programlisting>
&lt;?php
/* OCIFetchStatement example [EMAIL PROTECTED] (990624) */

$conn = OCILogon("scott","tiger");

$stmt = OCIParse($conn,"select * from emp");

OCIExecute($stmt);

$nrows = OCIFetchStatement($stmt,$results);
if ( $nrows > 0 ) {
   print "&lt;TABLE BORDER=\"1\">\n";
   print "&lt;TR>\n";
   while ( list( $key, $val ) = each( $results ) ) {
      print "&lt;TH>$key&lt;/TH>\n";
   }
   print "&lt;/TR>\n";
   
   for ( $i = 0; $i &lt; $nrows; $i++ ) {
      reset($results);
      print "&lt;TR>\n";
      while ( $column = each($results) ) {   
         $data = $column['value'];
         print "&lt;TD>$data[$i]&lt;/TD>\n";
      }
      print "&lt;/TR>\n";
   }
   print "&lt;/TABLE>\n";
} else {
   echo "No data found&lt;BR>\n";
}      
print "$nrows Records Selected&lt;BR>\n";
 
OCIFreeStatement($stmt);
OCILogoff($conn);
?>
     </programlisting>
    </example>
   </refsect1>
  </refentry>
  
  <refentry id="function.ocicolumnisnull">
   <refnamediv>
    <refname>OCIColumnIsNULL</refname>
    <refpurpose>test whether a result column is NULL</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCIColumnIsNULL</function></funcdef>
      <paramdef>int <parameter>stmt</parameter></paramdef>
      <paramdef>mixed <parameter>column</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCIColumnIsNULL</function> returns true if the returned
     column <parameter>column</parameter> in the result from the
     statement <parameter>stmt</parameter> is NULL. You can either use
         the column-number (1-Based) or the column-name for the
         <parameter>col</parameter> parameter.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ocicolumnname">
   <refnamediv>
    <refname>OCIColumnName</refname>
    <refpurpose>Returns the name of a column.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>OCIColumnName</function></funcdef>
      <paramdef>int <parameter>stmt</parameter></paramdef>
      <paramdef>int <parameter>col</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>OCIColumnName</function> returns the name of the column 
      corresponding to the column number (1-based) that is passed in.
    </simpara>
    <para>
     <example>
      <title>OCIColumnName</title>
      <programlisting>
&lt;?php   
    print "&lt;HTML>&lt;PRE>\n";   
    $conn = OCILogon("scott", "tiger");
    $stmt = OCIParse($conn,"select * from emp");
    OCIExecute($stmt);
    print "&lt;TABLE BORDER=\"1\">";
    print "&lt;TR>";
    print "&lt;TH>Name&lt;/TH>";
    print "&lt;TH>Type&lt;/TH>";
    print "&lt;TH>Length&lt;/TH>";
    print "&lt;/TR>";
    $ncols = OCINumCols($stmt);
    for ( $i = 1; $i &lt;= $ncols; $i++ ) {
        $column_name  = OCIColumnName($stmt,$i);
        $column_type  = OCIColumnType($stmt,$i);
        $column_size  = OCIColumnSize($stmt,$i);
        print "&lt;TR>";
        print "&lt;TD>$column_name&lt;/TD>";
        print "&lt;TD>$column_type&lt;/TD>";
        print "&lt;TD>$column_size&lt;/TD>";
        print "&lt;/TR>";
    }
    OCIFreeStatement($stmt);  
    OCILogoff($conn);   
    print "&lt;/PRE>";
    print "&lt;/HTML>\n"; 
?>   
      </programlisting>
     </example>
    </para>
    <simpara>
     See also <function>OCINumCols</function>,
     <function>OCIColumnType</function>, 
     and <function>OCIColumnSize</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ocicolumnsize">
   <refnamediv>
    <refname>OCIColumnSize</refname>
    <refpurpose>return result column size</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCIColumnSize</function></funcdef>
      <paramdef>int <parameter>stmt</parameter></paramdef>
      <paramdef>mixed <parameter>column</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCIColumnSize</function> returns the size of the column
     as given by Oracle. You can either use
         the column-number (1-Based) or the column-name for the
         <parameter>col</parameter> parameter.
    </para>
    <para>
     <example>
      <title>OCIColumnSize</title>
      <programlisting>
&lt;?php   
    print "&lt;HTML>&lt;PRE>\n";   
    $conn = OCILogon("scott", "tiger");
    $stmt = OCIParse($conn,"select * from emp");
    OCIExecute($stmt);
    print "&lt;TABLE BORDER=\"1\">";
    print "&lt;TR>";
    print "&lt;TH>Name&lt;/TH>";
    print "&lt;TH>Type&lt;/TH>";
    print "&lt;TH>Length&lt;/TH>";
    print "&lt;/TR>";
    $ncols = OCINumCols($stmt);
    for ( $i = 1; $i &lt;= $ncols; $i++ ) {
        $column_name  = OCIColumnName($stmt,$i);
        $column_type  = OCIColumnType($stmt,$i);
        $column_size  = OCIColumnSize($stmt,$i);
        print "&lt;TR>";
        print "&lt;TD>$column_name&lt;/TD>";
        print "&lt;TD>$column_type&lt;/TD>";
        print "&lt;TD>$column_size&lt;/TD>";
        print "&lt;/TR>";
    }
    print "&lt;/TABLE>";
    OCIFreeStatement($stmt);  
    OCILogoff($conn);   
    print "&lt;/PRE>";
    print "&lt;/HTML>\n"; 
?>   
      </programlisting>
     </example>
    </para>
    <simpara>
     See also <function>OCINumCols</function>,
     <function>OCIColumnName</function>, and
     <function>OCIColumnSize</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ocicolumntype">
   <refnamediv>
    <refname>OCIColumnType</refname>
    <refpurpose>Returns the data type of a column.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>OCIColumnType</function></funcdef>
      <paramdef>int <parameter>stmt</parameter></paramdef>
      <paramdef>int <parameter>col</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>OCIColumnType</function> returns the data type of the
     column corresponding to the column number (1-based) that is passed
     in.
    </simpara>
    <para>
     <example>
      <title>OCIColumnType</title>
      <programlisting>
&lt;?php   
    print "&lt;HTML>&lt;PRE>\n";   
    $conn = OCILogon("scott", "tiger");
    $stmt = OCIParse($conn,"select * from emp");
    OCIExecute($stmt);
    print "&lt;TABLE BORDER=\"1\">";
    print "&lt;TR>";
    print "&lt;TH>Name&lt;/TH>";
    print "&lt;TH>Type&lt;/TH>";
    print "&lt;TH>Length&lt;/TH>";
    print "&lt;/TR>";
    $ncols = OCINumCols($stmt);
    for ( $i = 1; $i &lt;= $ncols; $i++ ) {
        $column_name  = OCIColumnName($stmt,$i);
        $column_type  = OCIColumnType($stmt,$i);
        $column_size  = OCIColumnSize($stmt,$i);
        print "&lt;TR>";
        print "&lt;TD>$column_name&lt;/TD>";
        print "&lt;TD>$column_type&lt;/TD>";
        print "&lt;TD>$column_size&lt;/TD>";
        print "&lt;/TR>";
    }
    OCIFreeStatement($stmt);  
    OCILogoff($conn);   
    print "&lt;/PRE>";
    print "&lt;/HTML>\n"; 
?>   
      </programlisting>
     </example>
    </para>
    <simpara>
     See also <function>OCINumCols</function>,
     <function>OCIColumnName</function>, 
     and <function>OCIColumnSize</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ociserverversion">
   <refnamediv>
    <refname>OCIServerVersion</refname>
    <refpurpose>Return a string containing server version
    information.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>OCIServerVersion</function></funcdef>
      <paramdef>int <parameter>conn</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <example>
      <title>OCIServerVersion</title>
      <programlisting>
&lt;?php
   $conn = OCILogon("scott","tiger");
   print "Server Version: " . OCIServerVersion($conn);
   OCILogOff($conn);
?>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ocistatementtype">
   <refnamediv>
    <refname>OCIStatementType</refname>
    <refpurpose>Return the type of an OCI statement.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>OCIStatementType</function></funcdef>
      <paramdef>int <parameter>stmt</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCIStatementType</function> returns one of the following
     values:
     <orderedlist>
      <listitem><simpara>                       "SELECT"</simpara></listitem>
      <listitem><simpara>                       "UPDATE"</simpara></listitem>
      <listitem><simpara>                       "DELETE"</simpara></listitem>
      <listitem><simpara>                       "INSERT"</simpara></listitem>
      <listitem><simpara>                       "CREATE"</simpara></listitem>
      <listitem><simpara>                       "DROP"</simpara></listitem>
      <listitem><simpara>                       "ALTER"</simpara></listitem>
      <listitem><simpara>                       "BEGIN"</simpara></listitem>
      <listitem><simpara>                       "DECLARE"</simpara></listitem>
      <listitem><simpara>                       "UNKNOWN"</simpara></listitem>
     </orderedlist></para>
    <para>
     <example>
      <title>Code examples</title>
      <programlisting>
&lt;?php
    print "&lt;HTML>&lt;PRE>";
    $conn = OCILogon("scott","tiger");
    $sql  = "delete from emp where deptno = 10";
   
    $stmt = OCIParse($conn,$sql);
    if ( OCIStatementType($stmt) == "DELETE" ) {
        die "You are not allowed to delete from this table&lt;BR>";
    }
   
    OCILogoff($conn);
    print "&lt;/PRE>&lt;/HTML>";
?>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ocinewcursor">
   <refnamediv>
    <refname>OCINewCursor</refname>
    <refpurpose>
     Return a new cursor (Statement-Handle) - use to bind ref-cursors.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCINewCursor</function></funcdef>
      <paramdef>int <parameter>conn</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCINewCursor</function> allocates a new statement handle
     on the specified connection.
    </para>
    <para>
     <example>
      <title>Using a REF CURSOR from a stored procedure</title>
      <programlisting>
&lt;?php   
// suppose your stored procedure info.output returns a ref cursor in :data

$conn = OCILogon("scott","tiger");
$curs = OCINewCursor($conn);
$stmt = OCIParse($conn,"begin info.output(:data); end;");

ocibindbyname($stmt,"data",&amp;$curs,-1,OCI_B_CURSOR);
ociexecute($stmt);
ociexecute($curs);

while (OCIFetchInto($curs,&amp;$data)) {
    var_dump($data);
}
 
OCIFreeCursor($stmt);
OCIFreeStatement($curs);
OCILogoff($conn);
?>
      </programlisting>
     </example>
    </para>
    <para>
     <example>
      <title>Using a REF CURSOR in a select statement</title>
      <programlisting>
&lt;?php   
print "&lt;HTML>&lt;BODY>";
$conn = OCILogon("scott","tiger");
$count_cursor = "CURSOR(select count(empno) num_emps from emp " .
                "where emp.deptno = dept.deptno) as EMPCNT from dept";
$stmt = OCIParse($conn,"select deptno,dname,$count_cursor");

ociexecute($stmt);
print "&lt;TABLE BORDER=\"1\">";
print "&lt;TR>";
print "&lt;TH>DEPT NAME&lt;/TH>";
print "&lt;TH>DEPT #&lt;/TH>";
print "&lt;TH># EMPLOYEES&lt;/TH>";
print "&lt;/TR>";

while (OCIFetchInto($stmt,&amp;$data,OCI_ASSOC)) {
    print "&lt;TR>";
    $dname  = $data["DNAME"];
    $deptno = $data["DEPTNO"];
    print "&lt;TD>$dname&lt;/TD>";
    print "&lt;TD>$deptno&lt;/TD>";
    ociexecute($data[ "EMPCNT" ]);
    while (OCIFetchInto($data[ "EMPCNT" ],&amp;$subdata,OCI_ASSOC)) {
        $num_emps = $subdata["NUM_EMPS"];
        print  "&lt;TD>$num_emps&lt;/TD>";
    }
    print "&lt;/TR>";
}
print "&lt;/TABLE>";
print "&lt;/BODY>&lt;/HTML>";
OCIFreeStatement($stmt);
OCILogoff($conn);
?>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ocifreestatement">
   <refnamediv>
    <refname>OCIFreeStatement</refname>
    <refpurpose>
     Free all resources associated with a statement.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCIFreeStatement</function></funcdef>
      <paramdef>int <parameter>stmt</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCIFreeStatement</function> returns true if successful,
     or false if unsuccessful.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ocifreecursor">
   <refnamediv>
    <refname>OCIFreeCursor</refname>
    <refpurpose>
     Free all resources associated with a cursor.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCIFreeCursor</function></funcdef>
      <paramdef>int <parameter>stmt</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCIFreeCursor</function> returns true if successful, or
     false if unsuccessful.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ocifreedesc">
   <refnamediv>
    <refname>OCIFreeDesc</refname>
    <refpurpose>Deletes a large object descriptor.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCIFreeDesc</function></funcdef>
      <paramdef>object <parameter>lob</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>OCIFreeDesc</function> returns true if successful, or
     false if unsuccessful.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.ociparse">
   <refnamediv>
    <refname>OCIParse</refname>
    <refpurpose>Parse a query and return a statement</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>OCIParse</function></funcdef>
      <paramdef>int <parameter>conn</parameter></paramdef>
      <paramdef>strint <parameter>query</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>OCIParse</function> parses the
     <parameter>query</parameter> using  <parameter>conn</parameter>. 
     It returns the statement identity if the query is valid, false if
     not. The <parameter>query</parameter> can be any valid SQL
     statement.
    </simpara>
   </refsect1>
  </refentry>
  <refentry id="function.ocierror">
   <refnamediv>
    <refname>OCIError</refname>
    <refpurpose>Return the last error of stmt|conn|global. 
     If no error happened returns false.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>OCIError</function></funcdef>
      <paramdef>int 
       <parameter><optional>stmt|conn|global</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>OCIError</function> returns the last error found.  If
     the optional <parameter>stmt|conn|global</parameter> is not
     provided, the last error encountered is returned.  If no error is
     found, <function>OCIError</function> returns
     false. <function>OCIError</function> returns the error as an
     associative array. In this array, <parameter>code</parameter>
     consists the oracle error code and <parameter>message</parameter>
     the oracle errorstring.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ociinternaldebug">
   <refnamediv>
    <refname>OCIInternalDebug</refname>
    <refpurpose>
     Enables or disables internal debug output.  By default it is
     disabled
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>OCIInternalDebug</function></funcdef>
      <paramdef>int <parameter>onoff</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>OCIInternalDebug</function> enables internal debug
     output.  Set <parameter>onoff</parameter> to 0 to turn debug
     output off, 1 to turn it on.
    </simpara>
   </refsect1>
  </refentry>
 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/openssl.xml
+++ phpdoc/kr/functions/openssl.xml
 <reference id="ref.openssl">
  <title>OpenSSL functions</title>
  <titleabbrev>OpenSSL</titleabbrev>
  <partintro>
  <para>
   This module uses the functions of <ulink
   url="&url.openssl;">OpenSSL</ulink> for generation and verification
   of signatures and for sealing (encrypting) and opening (decrypting)
   data. You need to use OpenSSL >= 0.9.6 with this module.
  </para>
  <para>
   OpenSSL offers many features that this module currently doesn't support.
   Some of these may be added in the future.
  </para>
  </partintro>

  <refentry id="function.openssl-free-key">
   <refnamediv>
    <refname>openssl_free_key</refname>
    <refpurpose>Free key resource</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>openssl_free_key</function></funcdef>
      <paramdef>int <parameter>key_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>openssl_free_key</function> frees the key associated with
     the specified <parameter>key_identifier</parameter> from memory.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.openssl-get-privatekey">
   <refnamediv>
    <refname>openssl_get_privatekey</refname>
    <refpurpose>Prepare a PEM formatted private key for use</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>openssl_get_privatekey</function></funcdef>
      <paramdef>string <parameter>key</parameter></paramdef>
      <paramdef>string 
<parameter><optional>passphrase</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a positive key identifier on success, or false on error.
    </para>
    <para>
     <function>openssl_get_privatekey</function> parses the PEM
     formatted private key specified by <parameter>key</parameter>
     and prepares it for use by other functions.
     The optional parameter <parameter>passphrase</parameter> must be used if
     the specified key is encrypted (protected by a passphrase).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.openssl-get-publickey">
   <refnamediv>
    <refname>openssl_get_publickey</refname> 
    <refpurpose>Extract public key from certificate and prepare it for use</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>openssl_get_publickey</function></funcdef>
      <paramdef>string <parameter>certificate</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a positive key identifier on success, or false on error.
    </para>
    <para>
     <function>openssl_get_publickey</function> extracts the
     public key from an X.509 certificate specified by
     <parameter>certificate</parameter> and prepares it for use by other
     functions.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.openssl-open">
   <refnamediv>
    <refname>openssl_open</refname>
    <refpurpose>Open sealed data</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>openssl_open</function></funcdef>
      <paramdef>string <parameter>sealed_data</parameter></paramdef>
      <paramdef>string <parameter>open_data</parameter></paramdef>
      <paramdef>string <parameter>env_key</parameter></paramdef>
      <paramdef>int <parameter>priv_key_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, or false on error. If successful the opened
     data is returned in <parameter>open_data</parameter>.
    </para>
    <para>
     <function>openssl_open</function> opens (decrypts)
     <parameter>sealed_data</parameter> using the private key associtated with
     the key identifier <parameter>priv_key_id</parameter> and the envelope key
     <parameter>env_key</parameter>. The envelope key is generated when the
     data are sealed and can only be used by one specific private key. See
     <function>openssl_seal</function> for more information.
    </para>
    <para>
     <example>
      <title><function>openssl_open</function> example</title>
      <programlisting role="php">
// $sealed and $env_key are assumed to contain the sealed data
// and our envelope key, both given to us by the sealer.

// fetch private key from file and ready it
$fp = fopen("/src/openssl-0.9.6/demos/sign/key.pem", "r");
$priv_key = fread($fp, 8192);
fclose($fp);
$pkeyid = openssl_get_privatekey($priv_key);

// decrypt the data and store it in $open
if (openssl_open($sealed, $open, $env_key, $pkeyid))
    echo "here is the opened data: ", $open;
else
    echo "failed to open data";

// free the private key from memory
openssl_free_key($pkeyid);
      </programlisting>
     </example>
    </para>
    <simpara>
     See also <function>openssl_seal</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.openssl-seal">
   <refnamediv>
    <refname>openssl_seal</refname>
    <refpurpose>Seal (encrypt) data</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>openssl_seal</function></funcdef>
      <paramdef>string <parameter>data</parameter></paramdef>
      <paramdef>string <parameter>sealed_data</parameter></paramdef>
      <paramdef>array <parameter>env_keys</parameter></paramdef>
      <paramdef>array <parameter>pub_key_ids</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the length of the sealed data on success, or false on error.
     If successful the sealed data is returned in
     <parameter>sealed_data</parameter>, and the envelope keys in
     <parameter>env_keys</parameter>.

    </para>
    <para>
     <function>openssl_seal</function> seals (encrypts)
     <parameter>data</parameter> by using RC4 with a randomly generated
     secret key. The key is encrypted with each of the public keys
     associated with the identifiers in <parameter>pub_key_ids</parameter>
     and each encrypted key is returned
     in <parameter>env_keys</parameter>. This means that one can send
     sealed data to multiple recipients (provided one has obtained their
     public keys). Each recipient must receive both the sealed data and
     the envelope key that was encrypted with the recipient's public key.
    </para>
    <para>
     <example>
      <title><function>openssl_seal</function> example</title>
      <programlisting role="php">
// $data is assumed to contain the data to be sealed

// fetch public keys for our recipients, and ready them
$fp = fopen("/src/openssl-0.9.6/demos/maurice/cert.pem", "r");
$cert = fread($fp, 8192);
fclose($fp);
$pk1 = openssl_get_publickey($cert);
// Repeat for second recipient
$fp = fopen("/src/openssl-0.9.6/demos/sign/cert.pem", "r");
$cert = fread($fp, 8192);
fclose($fp);
$pk2 = openssl_get_publickey($cert);

// seal message, only owners of $pk1 and $pk2 can decrypt $sealed with keys
// $ekeys[0] and $ekeys[1] respectively.
openssl_seal($data, $sealed, $ekeys, array($pk1,$pk2));

// free the keys from memory
openssl_free_key($pk1);
openssl_free_key($pk2);
      </programlisting>
     </example>
    </para>
    <simpara>
     See also <function>openssl_open</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.openssl-sign">
   <refnamediv>
    <refname>openssl_sign</refname>
    <refpurpose>Generate signature</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>openssl_sign</function></funcdef>
      <paramdef>string <parameter>data</parameter></paramdef>
      <paramdef>string <parameter>signature</parameter></paramdef>
      <paramdef>int <parameter>priv_key_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, or false on failure.
     If successful the signature is returned in
     <parameter>signature</parameter>. 
    </para>
    <para>
     <function>openssl_sign</function> computes a signature for the
     specified <parameter>data</parameter> by using SHA1 for hashing
     followed by encryption using the private key associated with
     <parameter>priv_key_id</parameter>. Note that the data itself is
     not encrypted.
    </para>
    <para>
     <example>
      <title><function>openssl_sign</function> example</title>
      <programlisting role="php">
// $data is assumed to contain the data to be signed

// fetch private key from file and ready it
$fp = fopen("/src/openssl-0.9.6/demos/sign/key.pem", "r");
$priv_key = fread($fp, 8192);
fclose($fp);
$pkeyid = openssl_get_privatekey($priv_key);

// compute signature
openssl_sign($data, $signature, $pkeyid);

// free the key from memory
openssl_free_key($pkeyid);
      </programlisting>
     </example>
    </para>
    <simpara>
     See also <function>openssl_verify</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.openssl-verify">
   <refnamediv>
    <refname>openssl_verify</refname>
    <refpurpose>Verify signature</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>openssl_verify</function></funcdef>
      <paramdef>string <parameter>data</parameter></paramdef>
      <paramdef>string <parameter>signature</parameter></paramdef>
      <paramdef>int <parameter>pub_key_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns 1 if the signature is correct, 0 if it is incorrect, and
     -1 on error.
    </para>
    <para>
     <function>openssl_verify</function> verifies that the
     <parameter>signature</parameter> is correct for the specified
     <parameter>data</parameter> using the public key associated with
     <parameter>pub_key_id</parameter>. This must be the public key
     corresponding to the private key used for signing.
    </para>
    <para>
     <example>
      <title><function>openssl_verify</function> example</title>
      <programlisting role="php">
// $data and $signature are assumed to contain the data and the signature

// fetch public key from certificate and ready it
$fp = fopen("/src/openssl-0.9.6/demos/sign/cert.pem", "r");
$cert = fread($fp, 8192);
fclose($fp);
$pubkeyid = openssl_get_publickey($cert);

// state whether signature is okay or not
$ok = openssl_verify($data, $signature, $pubkeyid);
if ($ok == 1)
    echo "good";
elseif ($ok == 0)
    echo "bad";
else
    echo "ugly, error checking signature";

// free the key from memory
openssl_free_key($pubkeyid);
      </programlisting>
     </example>
    </para>
    <simpara>
     See also <function>openssl_sign</function>.
    </simpara>
   </refsect1>
  </refentry>
 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/oracle.xml
+++ phpdoc/kr/functions/oracle.xml
 <reference id="ref.oracle">
  <title>Oracle functions</title>
  <titleabbrev>Oracle</titleabbrev>

  <refentry id="function.ora-bind">
   <refnamediv>
    <refname>Ora_Bind</refname>
    <refpurpose>bind a PHP variable to an Oracle parameter</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ora_bind</function></funcdef>
      <paramdef>int <parameter>cursor</parameter></paramdef>
      <paramdef>string <parameter>PHP variable name</parameter></paramdef>
      <paramdef>string <parameter>SQL parameter name</parameter></paramdef>
      <paramdef>int <parameter>length</parameter></paramdef>
      <paramdef>int <parameter><optional>type</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true if the bind succeeds, otherwise false. Details
     about the error can be retrieved using the
     <function>ora_error</function> and
     <function>ora_errorcode</function> functions.
    </para>
    <para>
     This function binds the named PHP variable with a SQL parameter.
     The SQL parameter must be in the form ":name". With the optional
     type parameter, you can define whether the SQL parameter is an
     in/out (0, default), in (1) or out (2) parameter. As of PHP
     3.0.1, you can use the constants ORA_BIND_INOUT, ORA_BIND_IN and
     ORA_BIND_OUT instead of the numbers.
    </para>
    <para>
     ora_bind must be called after <function>ora_parse</function> and
     before <function>ora_exec</function>. Input values can be given  
     by assignment to the bound PHP variables, after calling 
     <function>ora_exec</function> the bound PHP variables contain the output
     values if available. 
     <informalexample>
      <programlisting role="php">
&lt;?php
ora_parse($curs, "declare tmp INTEGER; begin tmp := :in; :out := tmp; :x := 7.77; 
end;");
ora_bind($curs, "result", ":x", $len, 2);
ora_bind($curs, "input", ":in", 5, 1);
ora_bind($curs, "output", ":out", 5, 2);
$input = 765;
ora_exec($curs);
echo "Result: $result&lt;BR>Out: $output&lt;BR>In: $input";
?>
      </programlisting>
     </informalexample>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ora-close">
   <refnamediv>
    <refname>Ora_Close</refname>
    <refpurpose>close an Oracle cursor</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ora_close</function></funcdef>
      <paramdef>int <parameter>cursor</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true if the close succeeds, otherwise false. Details
     about the error can be retrieved using the
     <function>ora_error</function> and
     <function>ora_errorcode</function> functions.
    </para>
    <para>
     This function closes a data cursor opened with
     <function>ora_open</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ora-columnname">
   <refnamediv>
    <refname>Ora_ColumnName</refname>
    <refpurpose>get name of Oracle result column</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>Ora_ColumnName</function></funcdef>
      <paramdef>int <parameter>cursor</parameter></paramdef>
      <paramdef>int <parameter>column</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the name of the field/column
     <parameter>column</parameter> on the cursor
     <parameter>cursor</parameter>. The returned name is in all
     uppercase letters.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ora-columnsize">
   <refnamediv>
    <refname>Ora_ColumnSize</refname>
    <refpurpose>get size of Oracle result column</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>Ora_ColumnSize</function></funcdef>
      <paramdef>int <parameter>cursor</parameter></paramdef>
      <paramdef>int <parameter>column</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the size of the Oracle column
     <parameter>column</parameter> on the cursor
     <parameter>cursor</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ora-columntype">
   <refnamediv>
    <refname>Ora_ColumnType</refname>
    <refpurpose>get type of Oracle result column</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>Ora_ColumnType</function></funcdef>
      <paramdef>int <parameter>cursor</parameter></paramdef>
      <paramdef>int <parameter>column</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the Oracle data type name of the field/column
     <parameter>column</parameter> on the cursor
     <parameter>cursor</parameter>. The returned type will be one of
     the following:
     <simplelist>
      <member><literal>"VARCHAR2"</literal></member>
      <member><literal>"VARCHAR"</literal></member>
      <member><literal>"CHAR"</literal></member>
      <member><literal>"NUMBER"</literal></member>
      <member><literal>"LONG"</literal></member>
      <member><literal>"LONG RAW"</literal></member>
      <member><literal>"ROWID"</literal></member>
      <member><literal>"DATE"</literal></member>
      <member><literal>"CURSOR"</literal></member>
     </simplelist>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ora-commit">
   <refnamediv>
    <refname>Ora_Commit</refname>
    <refpurpose>commit an Oracle transaction</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ora_commit</function></funcdef>
      <paramdef>int <parameter>conn</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on error. Details about the
     error can be retrieved using the <function>ora_error</function>
     and <function>ora_errorcode</function> functions.
    </para>
    <para>
     This function commits an Oracle transaction. A transaction is defined as
     all the changes on a given connection since the last commit/rollback,
     autocommit was turned off or when the connection was established.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ora-commitoff">
   <refnamediv>
    <refname>Ora_CommitOff</refname>
    <refpurpose>disable automatic commit</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ora_commitoff</function></funcdef>
      <paramdef>int <parameter>conn</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on error. Details about the error
     can be retrieved using the <function>ora_error</function> and
     <function>ora_errorcode</function> functions.
    </para>
    <para>
     This function turns off automatic commit after each
     <function>ora_exec</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ora-commiton">
   <refnamediv>
    <refname>Ora_CommitOn</refname>
    <refpurpose>enable automatic commit</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ora_commiton</function></funcdef>
      <paramdef>int <parameter>conn</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function turns on automatic commit after each
     <function>ora_exec</function> on the given connection.
    </para>
    <para>
     Returns true on success, false on error. Details about the error
     can be retrieved using the <function>ora_error</function> and
     <function>ora_errorcode</function> functions.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ora-do">
   <refnamediv>
    <refname>Ora_Do</refname>
    <refpurpose>Parse, Exec, Fetch</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ora_do</function></funcdef>
      <paramdef>int <parameter>conn</parameter></paramdef>
      <paramdef>string <parameter>query</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function is quick combination of <function>ora_parse</function>,
     <function>ora_exec</function> and <function>ora_fetch</function>.
     It will parse and execute a statement, then fetch the first result row.
    </para>
    <para>
     Returns true on success, false on error. Details about the error
     can be retrieved using the <function>ora_error</function> and
     <function>ora_errorcode</function> functions.
    </para>
    <para>
     See also <function>ora_parse</function>,<function>ora_exec</function>,
     and <function>ora_fetch</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ora-error">
   <refnamediv>
    <refname>Ora_Error</refname>
    <refpurpose>get Oracle error message</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>Ora_Error</function></funcdef>
      <paramdef>int <parameter>cursor_or_connection</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an error message of the form
     <replaceable>XXX</replaceable>-<replaceable>NNNNN</replaceable>
     where <replaceable>XXX</replaceable> is where the error comes
     from and <replaceable>NNNNN</replaceable> identifies the error
     message.
    </para>
    <para>
     <note>
      <para>Support for connection ids was added in 3.0.4.</para>
     </note>
    </para>
    <para>
     On UNIX versions of Oracle, you can find details about an error
     message like this:
     <computeroutput>
<prompt>$</prompt> <userinput>oerr ora
<replaceable>00001</replaceable></userinput> 00001, 00000,
"unique constraint (%s.%s) violated" // *Cause: An update or insert
statement attempted to insert a duplicate key //         For Trusted
ORACLE configured in DBMS MAC mode, you may see //         this message
if a duplicate entry exists at a different level.  // *Action: Either
remove the unique restriction or do not insert the key
     </computeroutput>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ora-errorcode">
   <refnamediv>
    <refname>Ora_ErrorCode</refname>
    <refpurpose>get Oracle error code</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>Ora_ErrorCode</function></funcdef>
      <paramdef>int <parameter>cursor_or_connection</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the numeric error code of the last executed statement on
     the specified cursor or connection.
     <comment>FIXME: should possible values be listed?</comment>
     <note>
      <para>Support for connection ids was added in 3.0.4.</para>
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ora-exec">
   <refnamediv>
    <refname>Ora_Exec</refname>
    <refpurpose>execute parsed statement on an Oracle cursor</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ora_exec</function></funcdef>
      <paramdef>int <parameter>cursor</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on error. Details about the error
     can be retrieved using the <function>ora_error</function> and
     <function>ora_errorcode</function> functions.
    </para>
    <simpara>
     See also <function>ora_parse</function>,
     <function>ora_fetch</function>, and <function>ora_do</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ora-fetch">
   <refnamediv>
    <refname>Ora_Fetch</refname>
    <refpurpose>fetch a row of data from a cursor</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ora_fetch</function></funcdef>
      <paramdef>int <parameter>cursor</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true (a row was fetched) or false (no more rows, or an
     error occured). If an error occured, details can be retrieved
     using the <function>ora_error</function> and
     <function>ora_errorcode</function> functions. If there was no
     error, <function>ora_errorcode</function> will return 0.
    </para>
    <para>
     Retrieves a row of data from the specified cursor.
    </para>
    <simpara>
     See also <function>ora_parse</function>,<function>ora_exec</function>,
     and <function>ora_do</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ora-fetch-into">
   <refnamediv>
    <refname>Ora_Fetch_Into</refname>
    <refpurpose>Fetch a row into the specified result array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ora_fetch_into</function></funcdef>
      <paramdef>int <parameter>cursor</parameter></paramdef>
      <paramdef>array <parameter>result</parameter></paramdef>
      <paramdef>int
       <parameter>
        <optional>flags</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     You can fetch a row into an array with this function.
     <example>
      <title>Oracle fetch into array</title>
      <programlisting role="php">
&lt;?php
array($results);
ora_fetch_into($cursor, &amp;$results);
echo $results[0];
echo $results[1];
?>
      </programlisting>
     </example>
     Note that you need to fetch the array by reference.
    </para>
    <simpara>
     See also <function>ora_parse</function>,<function>ora_exec</function>,
     <function>ora_fetch</function>, and <function>ora_do</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ora-getcolumn">
   <refnamediv>
    <refname>Ora_GetColumn</refname>
    <refpurpose>get data from a fetched column</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>ora_getcolumn</function></funcdef>
      <paramdef>int <parameter>cursor</parameter></paramdef>
      <paramdef>mixed <parameter>column</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the column data. If an error occurs, False is returned
     and <function>ora_errorcode</function>
     will return a non-zero value. Note, however, that a test for False
     on the results from this function may be true in cases where there is
     not error as well (NULL result, empty string, the number 0, the
     string "0").
    </para>
    <para>
     Fetches the data for a column or function result.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ora-logoff">
   <refnamediv>
    <refname>Ora_Logoff</refname>
    <refpurpose>close an Oracle connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ora_logoff</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true on success, false on error. Details about the error
     can be retrieved using the <function>ora_error</function> and
     <function>ora_errorcode</function> functions.
    </para>
    <para>
     Logs out the user and disconnects from the server.
    </para>
    <simpara>
     See also <function>ora_logon</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ora-logon">
   <refnamediv>
    <refname>Ora_Logon</refname>
    <refpurpose>open an Oracle connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ora_logon</function></funcdef>
      <paramdef>string <parameter>user</parameter></paramdef>
      <paramdef>string <parameter>password</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Establishes a connection between PHP and an Oracle database with the
     given username and password.
    </para>
    <para>
     Connections can be made using <productname>SQL*Net</productname>
     by supplying the <acronym>TNS</acronym> name to
     <parameter>user</parameter> like this:
     <informalexample>
      <programlisting role="php">
$conn = Ora_Logon("user<emphasis>@TNSNAME</emphasis>", "pass");
</programlisting>
     </informalexample>
    </para>
    <para>
     If you have character data with non-ASCII characters, you should
     make sure that <envar>NLS_LANG</envar> is set in your
     environment. For server modules, you should set it in the
     server's environment before starting the server.
    </para>
    <para>
     Returns a connection index on success, or false on failure.
     Details about the error can be retrieved using the
     <function>ora_error</function> and <function>ora_errorcode</function>
     functions.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ora-plogon">
   <refnamediv>
    <refname>Ora_pLogon</refname>
    <refpurpose>
     Open a persistent Oracle connection
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ora_plogon</function></funcdef>
      <paramdef>string <parameter>user</parameter></paramdef>
      <paramdef>string <parameter>password</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Establishes a persistant connection between PHP and an Oracle database with
     the given username and password.
    </para>
    <simpara>
     See also <function>ora_logon</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ora-numcols">
   <refnamediv>
    <refname>Ora_Numcols</refname>
    <refpurpose>Returns the number of columns</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ora_numcols</function></funcdef>
      <paramdef>int <parameter>cursor_ind</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ora_numcols</function> returns the number of columns in a result.
     Only returns meaningful values after an parse/exec/fetch sequence.
    </para>
    <simpara>
     See also <function>ora_parse</function>,<function>ora_exec</function>,
     <function>ora_fetch</function>, and <function>ora_do</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ora-numrows">
   <refnamediv>
    <refname>Ora_Numrows</refname>
    <refpurpose>Returns the number of rows</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ora_numrows</function></funcdef>
      <paramdef>int <parameter>cursor_ind</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ora_numrows</function> returns the number of rows in a result.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ora-open">
   <refnamediv>
    <refname>Ora_Open</refname>
    <refpurpose>open an Oracle cursor</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ora_open</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Opens an Oracle cursor associated with connection.
    </para>
    <para>
     Returns a cursor index or False on failure. Details about the
     error can be retrieved using the <function>ora_error</function>
     and <function>ora_errorcode</function> functions.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ora-parse">
   <refnamediv>
    <refname>Ora_Parse</refname>
    <refpurpose>parse an SQL statement</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ora_parse</function></funcdef>
      <paramdef>int <parameter>cursor_ind</parameter></paramdef>
      <paramdef>string <parameter>sql_statement</parameter></paramdef>
      <paramdef>int <parameter>defer</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function parses an SQL statement or a PL/SQL block and
     associates it with the given cursor.
    </para>
    <para>
     Returns 0 on success or -1 on
     error.
    </para>
    <simpara>
     See also <function>ora_exec</function>,
     <function>ora_fetch</function>, and <function>ora_do</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ora-rollback">
   <refnamediv>
    <refname>Ora_Rollback</refname>
    <refpurpose>roll back transaction</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ora_rollback</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function undoes an Oracle transaction. (See
     <function>ora_commit</function> for the definition of a
     transaction.)
    </para>
    <para>
     Returns true on success, false on error. Details about the error
     can be retrieved using the <function>ora_error</function> and
     <function>ora_errorcode</function> functions.
    </para>
   </refsect1>
  </refentry>
 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/outcontrol.xml
+++ phpdoc/kr/functions/outcontrol.xml
 <reference id="ref.outcontrol">
  <title>Output Control Functions</title>
  <titleabbrev>Output Control</titleabbrev>

  <partintro>
   <para>
    The Output Control functions allow you to control when output is
    sent from the script.  This can be useful in several different
    situations, especially if you need to send headers to the browser
    after your script has began outputing data.  The Output Control
    functions do not affect headers sent using
    <function>header</function> or <function>setcookie</function>,
    only functions such as <function>echo</function> and data between
    blocks of PHP code.
   </para>
   <para>
    <example>
     <title>Output Control example</title>
     <programlisting role="php">
&lt;?php

ob_start();
echo "Hello\n";

setcookie ("cookiename", "cookiedata");

ob_end_flush();

?&gt;
     </programlisting>
    </example>
   </para>
   <para>
    In the above example, the output from <function>echo</function>
    would be stored in the output buffer until
    <function>ob_end_flush</function> was called.  In the mean time,
    the call to <function>setcookie</function> successfully stored a
    cookie without causing an error. (You can not normally send
    headers to the browser after data has already been sent.)
   </para>
   <para>
    See also <function>header</function> and
    <function>setcookie</function>.
   </para>
  </partintro>

  <refentry id="function.flush">
   <refnamediv>
    <refname>flush</refname> 
    <refpurpose>Flush the output buffer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>flush</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Flushes the output buffers of PHP and whatever backend PHP is
     using (CGI, a web server, etc.)  This effectively tries to push
     all the output so far to the user's browser.
    </simpara>
                <note>
                 <para>
                        <function>flush</function> has no effect on the buffering
                         scheme of your webserver or the browser on the client
                         side. 
                 </para>
                 <para>
                        Several servers, especially on Win32, will still buffer
                        the output from your script until it terminates before
                        transmitting the results to the browser. 
                 </para>
                 <para>
                        Even the browser may buffer its input before displaying it. 
                        Netscape, for example, buffers text until it receives an
                        end-of-line or the beginning of a tag, and it won't render
                        tables until the &lt;/table&gt; tag of the outermost table is
                        seen.
                 </para>
                </note>
   </refsect1>
  </refentry>

  <refentry id="function.ob-start">
   <refnamediv>
    <refname>ob_start</refname> 
    <refpurpose>Turn on output buffering</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>ob_start</function></funcdef>
      <paramdef>string
       <parameter>
        <optional>output_callback</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function will turn output buffering on. While output buffering
     is active no output is sent from the script, instead the output
     is stored in an internal buffer.
    </para>
    <para>
     The contents of this internal buffer may be copied into a string
     variable using <function>ob_get_contents</function>.  To output
     what is stored in the internal buffer, use
     <function>ob_end_flush</function>.  Alternatively,
     <function>ob_end_clean</function> will silently discard the
     buffer contents.
    </para>
    <para>
     An optional output_callback function may be specified. This 
     function takes a string as a parameter and returns a string.
     The function will be called at <function>ob_end_flush</function>
     time and will receive the contents of the output buffer as its
     parameter. It must return a new output buffer as a result, 
     which is what will be printed.
    </para>
    <para>
     Output buffers are stackable, that is, you may call
     <function>ob_start</function> while another
     <function>ob_start</function> is active. Just make
     sure that you call <function>ob_end_flush()</function>
     the appropriate number of times. If multiple output callback
     functions are active, output is being filtered sequentially
     through each of them in nesting order.
    </para>
    <example>
     <title>Callback function example</title>
     <programlisting role="php">
&lt;?php
function c($str) {
  // Druu Chunusun mut dum Kuntrubu?..
  return nl2br(ereg_replace("[aeiou]", "u", $str));
}

function d($str) {
  return strip_tags($str);
}
?>

&lt;?php ob_start("c"); ?&gt;
Drei Chinesen mit dem Kontraba?..
&lt;?php ob_start("d"); ?&gt;
&lt;h1&gt;..sa?n auf der Stra? und erz?lten sich was...&lt;/h1&gt;
&lt;?php ob_end_flush(); ?&gt;
.. da kam die Polizei, ja was ist denn das?
&lt;?php ob_end_flush(); ?&gt;

?&gt;
     </programlisting>
    </example>
    <para>
     See also <function>ob_get_contents</function>,
     <function>ob_end_flush</function>,
     <function>ob_end_clean</function>, and
     <function>ob_implicit_flush</function>
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.ob-get-contents">
   <refnamediv>
    <refname>ob_get_contents</refname> 
    <refpurpose>
     Return the contents of the output buffer
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ob_get_contents</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     This will return the contents of the output buffer or FALSE, if
     output buffering isn't active.
    </para>
    <para>
     See also <function>ob_start</function> and
     <function>ob_get_length</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ob-get-length">
   <refnamediv>
    <refname>ob_get_length</refname>
    <refpurpose>
     Return the length of the output buffer
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ob_get_length</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     This will return the length of the contents in the output buffer
     or FALSE, if output buffering isnt't active.
    </para>
    <para>
     See also <function>ob_start</function> and
     <function>ob_get_contents</function>.
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.ob-end-flush">
   <refnamediv>
    <refname>ob_end_flush</refname> 
    <refpurpose>
     Flush (send) the output buffer and turn off output buffering    
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>ob_end_flush</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function will send the contents of the output buffer (if
     any) and turn output buffering off.  If you want to further
     process the buffer's contents you have to call
     <function>ob_get_contents</function> before
     <function>ob_end_flush</function> as the buffer contents are
     discarded after <function>ob_end_flush</function> is called.
    </para>
    <para>
     See also <function>ob_start</function>,
     <function>ob_get_contents</function>, and
     <function>ob_end_clean</function>.
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.ob-end-clean">
   <refnamediv>
    <refname>ob_end_clean</refname> 
    <refpurpose>
     Clean (erase) the output buffer and turn off output buffering
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>ob_end_clean</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function discards the contents of the output buffer and
     turns off output buffering.
    </para>
    <para>
     See also <function>ob_start</function> and
     <function>ob_end_flush</function>.
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.ob-implicit-flush">
   <refnamediv>
    <refname>ob_implicit_flush</refname> 
    <refpurpose>
     Turn implicit flush on/off 
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>ob_implicit_flush</function></funcdef>
      <paramdef>int 
       <parameter><optional>flag</optional></parameter>
      </paramdef>                 
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ob_implicit_flush</function> will turn implicit
     flushing on or off (if no <parameter>flag</parameter> is given,
     it defaults to on).  Implicit flushing will result in a flush
     operation after every output call, so that explicit calls to
     <function>flush</function> will no longer be needed.
    </para>
    <para>
     Turning implicit flushing on will disable output buffering, the
     output buffers current output will be sent as if
     <function>ob_end_flush</function> had been called.
    </para>
    <para>
     See also <function>flush</function>,
     <function>ob_start</function>, and
     <function>ob_end_flush</function>.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/ovrimos.xml
+++ phpdoc/kr/functions/ovrimos.xml
 <reference id="ref.ovrimos">
  <title>Ovrimos SQL functions</title>
  <titleabbrev>OvrimosSQL</titleabbrev>

  <partintro>
   <para>
    Ovrimos SQL Server, is a client/server, transactional RDBMS
    combined with Web capabilities and fast transactions.
   </para>
   <para>
    Ovrimos SQL Server is available at <ulink
    url="&url.ovrimos;">www.ovrimos.com</ulink>.  To enable ovrimos
    support in PHP just compile php with the '--with-ovrimos'
    parameter to configure script. You'll need to install the sqlcli
    library available in the Ovrimos SQL Server distribution.
   </para>
   <para>
    <example>
     <title>
      Connect to Ovrimos SQL Server and select from a system table
     </title>
     <programlisting role="php">
&lt;?php
$conn = ovrimos_connect ("server.domain.com", "8001", "admin", "password");
if ($conn != 0) {
    echo ("Connection ok!");
    $res = ovrimos_exec ($conn, "select table_id, table_name from sys.tables");
    if ($res != 0) {
        echo "Statement ok!";
        ovrimos_result_all ($res);
        ovrimos_free_result ($res);
    }
    ovrimos_close($conn);
}
?&gt;
     </programlisting>
    </example>
    This will just connect to SQL Server.
   </para>
  </partintro>
  
  <refentry id="function.ovrimos-connect">
   <refnamediv>
    <refname>ovrimos_connect</refname>
    <refpurpose>Connect to the specified database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ovrimos_connect</function></funcdef>
      <paramdef>string <parameter>host</parameter></paramdef>
      <paramdef>string <parameter>db</parameter></paramdef>
      <paramdef>string <parameter>user</parameter></paramdef>
      <paramdef>string <parameter>password</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_connect</function> is used to connect to the
     specified database.
    </para>
    <para>
     <function>ovrimos_connect</function> returns a connection id
     (greater than 0) or 0 for failure. The meaning of 'host' and
     'port' are those used everywhere in Ovrimos APIs. 'Host' is a
     host name or IP address and 'db' is either a database name, or a
     string containing the port number.
    </para>
    <para>
     <example>
      <title><function>ovrimos_connect</function> Example</title>
      <programlisting role="php">
&lt;?php
$conn = ovrimos_connect ("server.domain.com", "8001", "admin", "password");
if ($conn != 0) {
    echo "Connection ok!";
    $res=ovrimos_exec ($conn, "select table_id, table_name from sys.tables");
    if ($res != 0) {
        echo "Statement ok!";
        ovrimos_result_all ($res);
        ovrimos_free_result ($res);
    }
    ovrimos_close ($conn);
}
?&gt;
      </programlisting>
     </example>
     The above example will connect to the database and print out the
     specified table.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ovrimos-close">
   <refnamediv>
    <refname>ovrimos_close</refname>
    <refpurpose>Closes the connection to ovrimos</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>ovrimos_close</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_close</function> is used to close the specified
     connection.
    </para>
    <para>
     <function>ovrimos_close</function> closes a connection to
     Ovrimos. This has the effect of rolling back uncommitted
     transactions.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ovrimos-close-all">
   <refnamediv>
    <refname>ovrimos_close_all</refname>
    <refpurpose>Closes all the connections to ovrimos</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>ovrimos_close_all</function></funcdef>
      <paramdef>void</paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_close_all</function> is used to close all the
     connections.
    </para>
    <para>
     <function>ovrimos_close_all</function> closes all connections to
     Ovrimos. This has the effect of rolling back uncommitted
     transactions.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ovrimos-longreadlen">
   <refnamediv>
    <refname>ovrimos_longreadlen</refname>
    <refpurpose>
     Specifies how many bytes are to be retrieved from long datatypes
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ovrimos_longreadlen</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter>length</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_longreadlen</function> is used to specify how
     many bytes are to be retrieved from long datatypes.
    </para>
    <para>
     <function>ovrimos_longreadlen</function> specifies how many bytes
     are to be retrieved from long datatypes (long varchar and long
     varbinary). Default is zero. Regardless of its taking a result_id
     as an argument, it currently sets this parameter for all result
     sets. Returns true.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ovrimos-prepare">
   <refnamediv>
    <refname>ovrimos_prepare</refname>
    <refpurpose>Prepares an SQL statement</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ovrimos_prepare</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
      <paramdef>string <parameter>query</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_prepare</function> is used to prepare an SQL statement.
    </para>
    <para>
     <function>ovrimos_prepare</function> prepares an SQL statement
     and returns a result_id (or false on failure).
    </para>
   <para>
    <example>
     <title>Connect to Ovrimos SQL Server and prepare a statement</title>
     <programlisting role="php">
&lt;?php
$conn=ovrimos_connect ("db_host", "8001", "admin", "password");
if ($conn!=0) {
    echo "Connection ok!";
    $res=ovrimos_prepare ($conn, "select table_id, table_name 
                                  from sys.tables where table_id=1");
    if ($res != 0) {
        echo "Prepare ok!";
        if (ovrimos_execute ($res)) {
            echo "Execute ok!\n";
            ovrimos_result_all ($res);
        } else {
            echo "Execute not ok!";
        }
        ovrimos_free_result ($res);
    } else {
        echo "Prepare not ok!\n";
    }
    ovrimos_close ($conn);
}
?&gt;
      </programlisting>
     </example>
     This will connect to Ovrimos SQL Server, prepare a statement and
     the execute it.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ovrimos-execute">
   <refnamediv>
    <refname>ovrimos_execute</refname>
    <refpurpose>Executes a prepared SQL statement</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ovrimos_execute</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>array 
       <parameter><optional>parameters_array</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_execute</function> is used to execute an SQL
     statement.
    </para>
    <para>
     <function>ovrimos_execute</function> executes a prepared
     statement. Returns true or false. If the prepared statement
     contained parameters (question marks in the statement), the
     correct number of parameters should be passed in an array. Notice
     that I don't follow the PHP convention of placing just the name
     of the optional parameter inside square brackets. I couldn't
     bring myself on liking it.
    </para>
    </refsect1>
  </refentry>

  <refentry id="function.ovrimos-cursor">
   <refnamediv>
    <refname>ovrimos_cursor</refname>
    <refpurpose>Returns the name of the cursor</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ovrimos_cursor</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_cursor</function> is used to get the name of
     the cursor.
    </para>
    <para>
     <function>ovrimos_cursor</function> returns the name of the
     cursor. Useful when wishing to perform positioned updates or
     deletes.
    </para>
    </refsect1>
  </refentry>

  <refentry id="function.ovrimos-exec">
   <refnamediv>
    <refname>ovrimos_exec</refname>
    <refpurpose>Executes an SQL statement</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ovrimos_exec</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
      <paramdef>string <parameter>query</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_exec</function> is used to execute an SQL
     statement.
    </para>
    <para>
     <function>ovrimos_exec</function> executes an SQL statement
     (query or update) and returns a result_id or false.  Evidently,
     the SQL statement should not contain parameters.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ovrimos-fetch-into">
   <refnamediv>
    <refname>ovrimos_fetch_into</refname>
    <refpurpose>Fetches a row from the result set</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ovrimos_fetch_into</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>array <parameter>result_array</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>how</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>rownumber</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_fetch_into</function> is used to fetch a row
     from the result set.
    </para>
    <para>
     <function>ovrimos_fetch_into</function> fetches a row from the
     result set into 'result_array', which should be passed by
     reference. Which row is fetched is determined by the two last
     parameters.  'how' is one of 'Next' (default), 'Prev', 'First',
     'Last', 'Absolute', corresponding to forward direction from
     current position, backward direction from current position,
     forward direction from the start, backward direction from the end
     and absolute position from the start (essentially equivalent to
     'first' but needs 'rownumber'). Case is not
     significant. 'Rownumber' is optional except for absolute
     positioning. Returns true or false.
    </para>
    <para>
     <example>
      <title>A fetch into example</title>
      <programlisting role="php">
&lt;?php
$conn=ovrimos_connect ("neptune", "8001", "admin", "password");
if ($conn!=0) {
    echo "Connection ok!";
    $res=ovrimos_exec ($conn,"select table_id, table_name from sys.tables");
    if ($res != 0) {
        echo "Statement ok!";
        if (ovrimos_fetch_into ($res, &$row)) {
            list ($table_id, $table_name) = $row;
            echo "table_id=".$table_id.", table_name=".$table_name."\n";
            if (ovrimos_fetch_into ($res, &$row)) {
                list ($table_id, $table_name) = $row;
                echo "table_id=".$table_id.", table_name=".$table_name."\n";
            } else {
                echo "Next: error\n";
            }
        } else {
            echo "First: error\n";
        }
        ovrimos_free_result ($res);
    }
    ovrimos_close ($conn);
}
?&gt;
      </programlisting>
     </example>
     This example will fetch a row.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ovrimos-fetch-row">
   <refnamediv>
    <refname>ovrimos_fetch_row</refname>
    <refpurpose>Fetches a row from the result set</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ovrimos_fetch_row</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>how</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>row_number</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_fetch_row</function> is used to fetch a row
     from the result set.
    </para>
    <para>
     <function>ovrimos_fetch_row</function> fetches a row from the
     result set. Column values should be retrieved with other
     calls. Returns true or false.
    </para>
    <para>
     <example>
      <title>A fetch row example</title>
      <programlisting role="php">
&lt;?php
$conn = ovrimos_connect ("remote.host", "8001", "admin", "password");
if ($conn != 0) {
    echo "Connection ok!";
    $res=ovrimos_exec ($conn, "select table_id, table_name from sys.tables");
    if ($res != 0) {
        echo "Statement ok!";
        if (ovrimos_fetch_row ($res, "First")) {
            $table_id = ovrimos_result ($res, 1);
            $table_name = ovrimos_result ($res, 2);
            echo "table_id=".$table_id.", table_name=".$table_name."\n";
            if (ovrimos_fetch_row ($res, "Next")) {
                $table_id = ovrimos_result ($res, "table_id");
                $table_name = ovrimos_result ($res, "table_name");
                echo "table_id=".$table_id.", table_name=".$table_name."\n";
            } else {
                echo "Next: error\n";
            }
        } else {
            echo "First: error\n";
        }
        ovrimos_free_result ($res);
    }
    ovrimos_close ($conn);
}
?&gt;
      </programlisting>
     </example>
     This will fetch a row and print the result.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ovrimos-result">
   <refnamediv>
    <refname>ovrimos_result</refname>
    <refpurpose>Retrieves the output column</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ovrimos_result</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>mixed <parameter>field</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_result</function> is used to retrieve the
     output column.
    </para>
    <para>
     <function>ovrimos_result</function> retrieves the output column
     specified by 'field', either as a string or as an 1-based index.
    </para>
    </refsect1>
  </refentry>

  <refentry id="function.ovrimos-result-all">
   <refnamediv>
    <refname>ovrimos_result_all</refname>
    <refpurpose>
     Prints the whole result set as an HTML table
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ovrimos_result_all</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>format</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_result_all</function> is used to print an HTML
     table containing the whole result set.
    </para>
    <para>
     <function>ovrimos_result_all</function> prints the whole result
     set as an HTML table. Returns true or false.
    </para>
    <para>
     <example>
      <title>Prepare a statement, execute, and view the result</title>
      <programlisting role="php">
&lt;?php
$conn = ovrimos_connect ("db_host", "8001", "admin", "password");
if ($conn != 0) {
    echo "Connection ok!";
    $res = ovrimos_prepare ($conn, "select table_id, table_name 
                                    from sys.tables where table_id = 7");
    if ($res != 0) {
        echo "Prepare ok!";
        if (ovrimos_execute ($res, array(3))) {
            echo "Execute ok!\n";
            ovrimos_result_all ($res);
        } else {
            echo "Execute not ok!";
        }
        ovrimos_free_result ($res);
    } else {
        echo "Prepare not ok!\n";
    }
    ovrimos_close ($conn);
}
?&gt;
      </programlisting>
     </example>
     This will execute an SQL statement and print the result in an
     HTML table.
    </para>
    <para>
     <example>
      <title>Ovrimos_result_all with meta-information</title>
      <programlisting role="php">
&lt;?php
$conn = ovrimos_connect ("db_host", "8001", "admin", "password");
if ($conn != 0) {
    echo "Connection ok!";
    $res = ovrimos_exec ($conn, "select table_id, table_name 
                                 from sys.tables where table_id = 1")
    if ($res != 0) {
        echo "Statement ok! cursor=".ovrimos_cursor ($res)."\n";
        $colnb = ovrimos_num_fields ($res);
        echo "Output columns=".$colnb."\n";
        for ($i=1; $i<=$colnb; $i++) {
            $name = ovrimos_field_name ($res, $i);
            $type = ovrimos_field_type ($res, $i);
            $len = ovrimos_field_len ($res, $i);  
            echo "Column ".$i." name=".$name." type=".$type." len=".$len."\n";
        }
        ovrimos_result_all ($res);
        ovrimos_free_result ($res);
    }
    ovrimos_close ($conn);
}
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     <example>
      <title>ovrimos_result_all example</title>
      <programlisting role="php">
&lt;?php
$conn = ovrimos_connect ("db_host", "8001", "admin", "password");
if ($conn != 0) {
    echo "Connection ok!";
    $res = ovrimos_exec ($conn, "update test set i=5");
    if ($res != 0) {
        echo "Statement ok!";
        echo ovrimos_num_rows ($res)." rows affected\n";
        ovrimos_free_result ($res);
    }
    ovrimos_close ($conn);
}
?&gt;
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ovrimos-num-rows">
   <refnamediv>
    <refname>ovrimos_num_rows</refname>
    <refpurpose>
     Returns the number of rows affected by update operations
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ovrimos_num_rows</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_num_rows</function> is used to get the number
     of rows affected by update operations.
    </para>
    <para>
     <function>ovrimos_num_rows</function> returns the number of rows
     affected by update operations.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ovrimos-num-fields">
   <refnamediv>
    <refname>ovrimos_num_fields</refname>
    <refpurpose>Returns the number of columns</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ovrimos_num_fields</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_num_fields</function> is used to get the number
     of columns.
    </para>
    <para>
     <function>ovrimos_num_fields</function> returns the number of
     columns in a result_id resulting from a query.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ovrimos-field-name">
   <refnamediv>
    <refname>ovrimos_field_name</refname>
    <refpurpose>Returns the output column name</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ovrimos_field_name</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter>field_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_field_name</function> is used to get the output
     column name.
    </para>
    <para>
     <function>ovrimos_field_name</function> returns the output column
     name at the (1-based) index specified.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ovrimos-field-type">
   <refnamediv>
    <refname>ovrimos_field_type</refname>
    <refpurpose>
     Returns the (numeric) type of the output column
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ovrimos_field_type</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter>field_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_field_type</function> is used to get the
     (numeric) type of the output column.
    </para>
    <para>
     <function>ovrimos_field_type</function> returns the (numeric)
     type of the output column at the (1-based) index specified.
    </para>
    </refsect1>
  </refentry>

  <refentry id="function.ovrimos-field-len">
   <refnamediv>
    <refname>ovrimos_field_len</refname>
    <refpurpose>Returns the length of the output column</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ovrimos_field_len</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter>field_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_field_len</function> is used to get the length
     of the output column.
    </para>
    <para>
     <function>ovrimos_field_len</function> returns the length of the
     output column at the (1-based) index specified.
    </para>
    </refsect1>
  </refentry>

  <refentry id="function.ovrimos-field-num">
   <refnamediv>
    <refname>ovrimos_field_num</refname>
    <refpurpose>
     Returns the (1-based) index of the output column
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ovrimos_field_num</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>string <parameter>field_name</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_field_num</function> is used to get the
     (1-based) index of the output column.
    </para>
    <para>
     <function>ovrimos_field_num</function> returns the (1-based)
     index of the output column specified by name, or false.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ovrimos-free-result">
   <refnamediv>
    <refname>ovrimos_free_result</refname>
    <refpurpose>Frees the specified result_id</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ovrimos_free_result</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_free_result</function> is used to free the
     result_id.
    </para>
    <para>
     <function>ovrimos_free_result</function> frees the specified
     result_id. Returns true.
    </para>
    </refsect1>
  </refentry>

  <refentry id="function.ovrimos-commit">
   <refnamediv>
    <refname>ovrimos_commit</refname>
    <refpurpose>Commits the transaction</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ovrimos_commit</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_commit</function> is used to commit the
     transaction.
    </para>
    <para>
     <function>ovrimos_commit</function> commits the transaction.
    </para>
    </refsect1>
  </refentry>

  <refentry id="function.ovrimos-rollback">
   <refnamediv>
    <refname>ovrimos_rollback</refname>
    <refpurpose>Rolls back the transaction</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ovrimos_rollback</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>ovrimos_rollback</function> is used to roll back the
     transaction.
    </para>
    <para>
     <function>ovrimos_rollback</function> rolls back the transaction.
    </para>
    </refsect1>
  </refentry>
          
 </reference> 

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/pcre.xml
+++ phpdoc/kr/functions/pcre.xml
<reference id="ref.pcre">
  <title>Regular Expression Functions (Perl-Compatible)</title>
  <titleabbrev>PCRE</titleabbrev>   

  <partintro>
   <para>
    The syntax for patterns used in these functions closely resembles
    Perl. The expression should be enclosed in the delimiters, a
    forward slash (/),  for example.  Any character can be used for
    delimiter as long as it's not alphanumeric or backslash (\). If
    the delimiter character has to be used in the expression itself,
    it needs to be escaped by backslash.
   </para>
   <para>
    The ending delimiter may be followed by various modifiers that
    affect the matching. 
    See <link linkend="pcre.pattern.modifiers">Pattern Modifiers</link>.
   </para>
   <para>
    <example>
     <title>Examples of valid patterns</title>
     <itemizedlist>
      <listitem><simpara>/&lt;\/\w+>/</simpara></listitem>
      <listitem><simpara>|(\d{3})-\d+|Sm</simpara></listitem>
      <listitem><simpara>/^(?i)php[34]/</simpara></listitem>
     </itemizedlist>
    </example>
   </para>
   <para>
    <example>
     <title>Examples of invalid patterns</title>
     <itemizedlist>
      <listitem>
       <simpara>
        /href='(.*)' - missing ending delimiter
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        /\w+\s*\w+/J - unknown modifier 'J'
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        1-\d3-\d3-\d4| - missing starting delimiter
       </simpara>
      </listitem>
     </itemizedlist>
    </example>
   </para>
   <note>
    <simpara>
     The Perl-compatible regular expression functions are available in
     PHP 4 and in PHP 3.0.9 and up.
    </simpara>
   </note>
  </partintro>
  
  <refentry id="function.preg-match">
   <refnamediv>
    <refname>preg_match</refname>
    <refpurpose>Perform a regular expression match</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>preg_match</function></funcdef>
      <paramdef>string <parameter>pattern</parameter></paramdef>
      <paramdef>string <parameter>subject</parameter></paramdef>
      <paramdef>array 
       <parameter><optional>matches</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Searches <parameter>subject</parameter> for a match to the regular
     expression given in <parameter>pattern</parameter>.
    </para>
    <para>
     If <parameter>matches</parameter> is provided, then it is filled
     with the results of search.  $matches[0] will contain the text that
     match the full pattern, $matches[1] will have the text that matched
     the first captured parenthesized subpattern, and so on.
    </para>
    <para>
     Returns true if a match for <parameter>pattern</parameter> was
     found in the subject string, or false if not match was found
     or an error occurred.</para>

    <para>
     <example>
      <title>find the string of text "php"</title>
      <programlisting role="php">
// the "i" after the pattern delimiter indicates a case-insensitive search
if (preg_match ("/php/i", "PHP is the web scripting language of choice.")) {
    print "A match was found.";
} else {
    print "A match was not found.";
}
      </programlisting>
     </example>
     <example>
      <title>find the word "web"</title>
      <programlisting role="php">
// the \b in the pattern indicates a word boundary, so only the distinct
// word "web" is matched, and not a word partial like "webbing" or "cobweb"
if (preg_match ("/\bweb\b/i", "PHP is the web scripting language of choice.")) {
    print "A match was found.";
} else {
    print "A match was not found.";
}
if (preg_match ("/\bweb\b/i", "PHP is the website scripting language of choice.")) {
    print "A match was found.";
} else {
    print "A match was not found.";
}
      </programlisting>
     </example>
     <example>
      <title>Getting the domain name out of a URL</title>
      <programlisting role="php">
// get host name from URL
preg_match("/^(http:\/\/)?([^\/]+)/i",
"http://www.php.net/index.html", $matches);
$host = $matches[2];
// get last two segments of host name
preg_match("/[^\.\/]+\.[^\.\/]+$/",$host,$matches);
echo "domain name is: ".$matches[0]."\n";
      </programlisting>
     </example>
     This example will produce:
     <programlisting>
domain name is: php.net
     </programlisting>
     See also <function>preg_match_all</function>, 
     <function>preg_replace</function>, and
     <function>preg_split</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.preg-match-all">
   <refnamediv>
    <refname>preg_match_all</refname>
    <refpurpose>Perform a global regular expression match</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>preg_match_all</function></funcdef>
      <paramdef>string <parameter>pattern</parameter></paramdef>
      <paramdef>string <parameter>subject</parameter></paramdef>
      <paramdef>array <parameter>matches</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>order</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Searches <parameter>subject</parameter> for all matches to the regular
     expression given in <parameter>pattern</parameter> and puts them in
     <parameter>matches</parameter> in the order specified by
     <parameter>order</parameter>.
    </para>
    <para>
     After the first match is found, the subsequent searches  are continued
     on from end of the last match.
    </para>
    <para>
     <parameter>order</parameter> can be one of two things:
     <variablelist>
      <varlistentry>
       <term>PREG_PATTERN_ORDER</term>
       <listitem>
        <para>
         Orders results so that $matches[0] is an array of full
         pattern matches, $matches[1] is an array of strings matched by
         the first parenthesized subpattern, and so on.
         <informalexample>
          <programlisting role="php">
preg_match_all ("|&lt;[^>]+>(.*)&lt;/[^>]+>|U", 
    "&lt;b>example: &lt;/b>&lt;div align=left>this is a test&lt;/div>", 
    $out, PREG_PATTERN_ORDER);
print $out[0][0].", ".$out[0][1]."\n";
print $out[1][0].", ".$out[1][1]."\n"
          </programlisting>
         </informalexample>
         This example will produce:
         <informalexample>
          <programlisting>
&lt;b>example: &lt;/b>, &lt;div align=left>this is a test&lt;/div>
example: , this is a test
          </programlisting>
         </informalexample>
         So, $out[0] contains array of strings that matched full pattern,
         and $out[1] contains array of strings enclosed by tags.
        </para>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term>PREG_SET_ORDER</term>
       <listitem>
        <para>
         Orders results so that $matches[0] is an array of first set
         of matches, $matches[1] is an array of second set of matches,
         and so on.
         <informalexample>
          <programlisting role="php">
preg_match_all ("|&lt;[^>]+>(.*)&lt;/[^>]+>|U", 
    "&lt;b>example: &lt;/b>&lt;div align=left>this is a test&lt;/div>", 
    $out, PREG_SET_ORDER);
print $out[0][0].", ".$out[0][1]."\n";
print $out[1][0].", ".$out[1][1]."\n"
          </programlisting>
         </informalexample>
         This example will produce:
         <informalexample>
          <programlisting role="php">
&lt;b>example: &lt;/b>, example: 
&lt;div align=left>this is a test&lt;/div>, this is a test
          </programlisting>
         </informalexample>
         In this case, $matches[0] is the first set of matches, and
         $matches[0][0] has text matched by full pattern, $matches[0][1]
         has text matched by first subpattern and so on.  Similarly,
         $matches[1] is the second set of matches, etc.
        </para>
       </listitem>
      </varlistentry>
     </variablelist></para>
    <para>
     If <parameter>order</parameter> is not specified, it is assumed
     to be PREG_PATTERN_ORDER.
    </para>
    <para>
     Returns the number of full pattern matches, or false if
     no match is found or an error occurred.
    </para>
    <para>
     <example>
      <title>Getting all phone numbers out of some text.</title>
      <programlisting role="php">
preg_match_all ("/\(?  (\d{3})?  \)?  (?(1)  [\-\s] ) \d{3}-\d{4}/x",
                "Call 555-1212 or 1-800-555-1212", $phones);
      </programlisting>
     </example>
    </para>
    <para>
     <example>
      <title>Find matching HTML tags (greedy)</title>
      <programlisting role="php">
// the \\2 is an example of backreferencing. This tells pcre that
// it must match the 2nd set of parenthesis in the regular expression
// itself, which would be the ([\w]+) in this case.
$html = "&lt;b&gt;bold text&lt;/b&gt;&lt;a href=howdy.html&gt;click me&lt;/a&gt;

preg_match_all ("/(&lt;([\w]+)[^&gt;]*&gt;)(.*)(&lt;\/\\2&gt;)/", $html, $matches);

for ($i=0; $i&lt; count($matches[0]); $i++) {
echo "matched: ".$matches[0][$i]."\n";
echo "part 1: ".$matches[1][$i]."\n";
echo "part 2: ".$matches[3][$i]."\n";
echo "part 3: ".$matches[4][$i]."\n\n";
}
      </programlisting>
     </example>
     This example will produce:
     <programlisting>
matched: &lt;b&gt;bold text&lt;/b&gt;
part 1: &lt;b&gt;
part 2: bold text
part 3: &lt;/b&gt;

matched: &lt;a href=howdy.html&gt;click me&lt;/a&gt;
part 1: &lt;a href=howdy.html&gt;
part 2: click me
part 3: &lt;/a&gt;
     </programlisting>
    </para>
    <simpara>
     See also <function>preg_match</function>,
     <function>preg_replace</function>,
     and <function>preg_split</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.preg-replace">
   <refnamediv>
    <refname>preg_replace</refname>
    <refpurpose>Perform a regular expression search and replace</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>preg_replace</function></funcdef>
      <paramdef>mixed <parameter>pattern</parameter></paramdef>
      <paramdef>mixed <parameter>replacement</parameter></paramdef>
      <paramdef>mixed <parameter>subject</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>limit</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Searches <parameter>subject</parameter> for matches to
     <parameter> pattern</parameter> and replaces them with
     <parameter>replacement </parameter>. If
     <parameter>limit</parameter> is specified, then only
     <parameter>limit</parameter> matches will be replaced; if
     <parameter>limit</parameter> is omitted or is -1, then all
     matches are replaced.
    </para>
    <para>
     <parameter>Replacement</parameter> may contain references of the form
     <literal>\\<replaceable>n</replaceable></literal> or (since PHP 4.0.4)
     <literal><replaceable>$n</replaceable></literal>, with the latter form
     being the preferred one. Every such reference will be replaced by the text
     captured by the <replaceable>n</replaceable>'th parenthesized pattern.
     <replaceable>n </replaceable>can be from 0 to 99, and
     <literal>\\0</literal> or <literal>$0</literal> refers to the text matched
     by the whole pattern. Opening parentheses are counted from left to right
     (starting from 1) to obtain the number of the capturing subpattern.
    </para>
    <para>
     If no matches are found in <parameter>subject</parameter>, then
     it will be returned unchanged.
    </para>
    <para>
     Every parameter to <function>preg_replace</function> can be an
     array.
    </para>
    <para>
     If <parameter>subject</parameter> is an array, then the search
     and replace is performed on every entry of
     <parameter>subject</parameter>, and the return value is an array
     as well.
    </para>
    <para>
     If <parameter>pattern</parameter> and
     <parameter>replacement</parameter> are arrays, then
     <function>preg_replace</function> takes a value from each array
     and uses them to do search and replace on
     <parameter>subject</parameter>.  If
     <parameter>replacement</parameter> has fewer values than
     <parameter>pattern</parameter>, then empty string is used for the
     rest of replacement values.  If <parameter>pattern </parameter>
     is an array and <parameter>replacement</parameter> is a string;
     then this replacement string is used for every value of
     <parameter>pattern</parameter>.  The converse would not make
     sense, though.
    </para>
    <para>
     <literal>/e</literal> modifier makes
     <function>preg_replace</function> treat the
     <parameter>replacement</parameter> parameter as PHP code after
     the appropriate references substitution is done. Tip: make sure
     that <parameter>replacement</parameter> constitutes a valid PHP
     code string, otherwise PHP will complain about a parse error at
     the line containing <function>preg_replace</function>.
    </para>
    <para>
     <example>
      <title>Replacing several values</title>
      <programlisting>
$patterns = array ("/(19|20)(\d{2})-(\d{1,2})-(\d{1,2})/",
                   "/^\s*{(\w+)}\s*=/");
$replace = array ("\\3/\\4/\\1\\2", "$\\1 =");
print preg_replace ($patterns, $replace, "{startDate} = 1999-5-27");
      </programlisting>
     </example>
     This example will produce:
     <programlisting>
$startDate = 5/27/1999
     </programlisting>
     <example>
      <title>Using /e modifier</title>
      <programlisting role="php">
preg_replace ("/(&lt;\/?)(\w+)([^>]*>)/e", 
              "'\\1'.strtoupper('\\2').'\\3'", 
              $html_body);
      </programlisting>
      <para>
This would capitalize all HTML tags in the input text.
      </para>
     </example>
     <example>
      <title>Convert HTML to text</title>
      <programlisting role="php">
// $document should contain an HTML document.
// This will remove HTML tags, javascript sections
// and white space. It will also convert some
// common HTML entities to their text equivalent.

$search = array ("'&lt;script[^&gt;]*?&gt;.*?&lt;/script&gt;'si",  // Strip out 
javascript
                 "'&lt;[\/\!]*?[^&lt;&gt;]*?&gt;'si",  // Strip out html tags
                 "'([\r\n])[\s]+'",  // Strip out white space
                 "'&amp;(quot|#34);'i",  // Replace html entities
                 "'&amp;(amp|#38);'i",
                 "'&amp;(lt|#60);'i",
                 "'&amp;(gt|#62);'i",
                 "'&amp;(nbsp|#160);'i",
                 "'&amp;(iexcl|#161);'i",
                 "'&amp;(cent|#162);'i",
                 "'&amp;(pound|#163);'i",
                 "'&amp;(copy|#169);'i",
                 "'&amp;#(\d+);'e");  // evaluate as php

$replace = array ("",
                  "",
                  "\\1",
                  "\"",
                  "&amp;",
                  "&lt;",
                  "&gt;",
                  " ",
                  chr(161),
                  chr(162),
                  chr(163),
                  chr(169),
                  "chr(\\1)");

$text = preg_replace ($search, $replace, $document);
      </programlisting>
     </example>
    </para>
    <note>
     <para>
      Parameter <parameter>limit</parameter> was added after PHP 4.0.1pl2.
     </para>
    </note>      
    <para>
     See also <function>preg_match</function>,
     <function>preg_match_all</function>, and
     <function>preg_split</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.preg-split">
   <refnamediv>
    <refname>preg_split</refname>
    <refpurpose>Split string by a regular expression</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array preg_split</funcdef>
      <paramdef>string <parameter>pattern</parameter></paramdef>
      <paramdef>string <parameter>subject</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>limit</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>flags</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>

    <note>
     <para>
      Parameter <parameter>flags</parameter> was added in PHP 4 Beta 3.
     </para>
    </note>

    <para>
     Returns an array containing substrings of
     <parameter>subject</parameter> split along boundaries matched by
     <parameter>pattern</parameter>.
    </para>

    <para>
     If <parameter>limit</parameter> is specified, then only substrings
     up to <parameter>limit</parameter> are returned.
    </para>

    <para>
     If flags is <constant>PREG_SPLIT_NO_EMPTY</constant> then only
     non-empty pieces will be returned by <function>preg_split</function>.
    </para>

    <example>
     <title><function>preg_split</function> example</title>
     <para>
      Get the parts of a search string.
     </para>
     <programlisting role="php">
// split the phrase by any number of commas or space characters,
// which include " ", \r, \t, \n and \f
$keywords = preg_split ("/[\s,]+/", "hypertext language, programming");
     </programlisting>

     <para>
      Splitting a string into component characters.
     </para>
     <programlisting role="php">
$str = 'string';
$chars = preg_split('//', $str, 0, PREG_SPLIT_NO_EMPTY);
print_r($chars);
     </programlisting>
    </example>

    <para>
     See also <function>preg_match</function>,
     <function>preg_match_all</function>, and
     <function>preg_replace</function>.
    </para>

   </refsect1>
  </refentry>

  <refentry id="function.preg-quote">
   <refnamediv>
    <refname>preg_quote</refname>
    <refpurpose>Quote regular expression characters</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>preg_quote</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     <paramdef>string 
       <parameter><optional>delimiter</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>preg_quote</function> takes <parameter>str</parameter>
     and puts a backslash in front of every character that is part of
     the regular expression syntax.  This is useful if you have a
     run-time string that you need to match in some text and the
     string may contain special regex characters.
    </para>
    <para>
     If the optional <parameter>delimiter</parameter> is specified, it
     will also be escaped.  This is useful for escaping the delimeter
     that is required by the PCRE functions. The / is the most commonly
     used delimiter.</para>
    <para>
     The special regular expression characters are:
     <screen>. \\ + * ? [ ^ ] $ ( ) { } = ! &lt; > | :</screen>
    </para>
    <para>
     <example>
      <title></title>
      <programlisting role="php">
$keywords = "$40 for a g3/400";
$keywords = preg_quote ($keywords, "/");
echo $keywords; // returns \$40 for a g3\/400
      </programlisting>
     </example>
     <example>
      <title>Italicizing a word within some text</title>
      <programlisting role="php">

// In this example, preg_quote($word) is used to keep the
// asterisks from having special meaning to the regular
// expression.

$textbody = "This book is *very* difficult to find.";
$word = "*very*";
$textbody = preg_replace ("/".preg_quote($word)."/",
                          "&lt;i&gt;".$word."&lt;/i&gt;",
                          $textbody);
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.preg-grep">
   <refnamediv>
    <refname>preg_grep</refname>
    <refpurpose>
     Return array entries that match the pattern
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>preg_grep</function></funcdef>
      <paramdef>string <parameter>pattern</parameter></paramdef>
      <paramdef>array <parameter>input</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>

    <para>
     <function>preg_grep</function> returns the array consisting of
     the elements of the <parameter>input</parameter> array that match
     the given <parameter>pattern</parameter>.</para>

    <para>
     <example>
      <title><function>preg_grep</function> example</title>
      <programlisting role="php">
// return all array elements
// containing floating point numbers
$fl_array = preg_grep ("/^(\d+)?\.\d+$/", $array);
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="pcre.pattern.modifiers">
   <refnamediv>
    <refname>Pattern Modifiers</refname>
    <refpurpose>Describes possible modifiers in regex
     patterns</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <para>
     The current possible PCRE modifiers are listed below.  The names
     in parentheses refer to internal PCRE names for these modifiers.
    </para>
    <para>
     <blockquote>
      <variablelist>
       <varlistentry>
        <term><emphasis>i</emphasis> (PCRE_CASELESS)</term>
        <listitem>
         <simpara>
          If this modifier is set, letters in the pattern match both
          upper and lower case letters.
         </simpara>
        </listitem>
       </varlistentry>
       <varlistentry>
        <term><emphasis>m</emphasis> (PCRE_MULTILINE)</term>
        <listitem>
         <simpara>
          By default, PCRE treats the subject string as consisting of a
          single "line" of characters (even if it actually contains
          several newlines). The "start of line" metacharacter (^)
          matches only at the start of the string, while the "end of
          line" metacharacter ($) matches only at the end of the
          string, or before a terminating newline (unless
          <emphasis>E</emphasis> modifier is set). This is the same as
          Perl.
         </simpara>
         <simpara>
          When this modifier is set, the "start of line" and "end of
          line" constructs match immediately following or immediately
          before any newline in the subject string, respectively, as
          well as at the very start and end. This is equivalent to
          Perl's /m modifier. If there are no "\n" characters in a
          subject string, or no occurrences of ^ or $ in a pattern,
          setting this modifier has no effect.
         </simpara>
        </listitem>
       </varlistentry>
       <varlistentry>
        <term><emphasis>s</emphasis> (PCRE_DOTALL)</term>
        <listitem>
         <simpara>
          If this modifier is set, a dot metacharater in the pattern
          matches all characters, including newlines. Without it,
          newlines are excluded. This modifier is equivalent to Perl's
          /s modifier.  A negative class such as [^a] always matches a
          newline character, independent of the setting of this
          modifier.
         </simpara>
        </listitem>
       </varlistentry>
       <varlistentry>
        <term><emphasis>x</emphasis> (PCRE_EXTENDED)</term>
        <listitem>
         <simpara>
          If this modifier is set, whitespace data characters in the
          pattern are totally ignored except when escaped or inside a
          character class, and characters between an unescaped #
          outside a character class and the next newline character,
          inclusive, are also ignored. This is equivalent to Perl's /x
          modifier, and makes it possible to include comments inside
          complicated patterns. Note, however, that this applies only
          to data characters. Whitespace characters may never appear
          within special character sequences in a pattern, for example
          within the sequence (?( which introduces a conditional
          subpattern.
         </simpara>
        </listitem>
       </varlistentry>
       <varlistentry>
        <term><emphasis>e</emphasis></term>
        <listitem>
         <simpara>
          If this modifier is set, <function>preg_replace</function>
          does normal substitution of backreferences in the
          replacement string, evaluates it as PHP code, and uses the
          result for replacing the search string.
         </simpara>
         <simpara>
          Only <function>preg_replace</function> uses this modifier;
          it is ignored by other PCRE functions.
         </simpara>
        </listitem>
       </varlistentry>
       <varlistentry>
        <term><emphasis>A</emphasis> (PCRE_ANCHORED)</term>
        <listitem>
         <simpara>
          If this modifier is set, the pattern is forced to be
          "anchored", that is, it is constrained to match only at the
          start of the string which is being searched (the "subject
          string").  This effect can also be achieved by appropriate
          constructs in the pattern itself, which is the only way to
          do it in Perl.
         </simpara>
        </listitem>
       </varlistentry>
       <varlistentry>
        <term><emphasis>D</emphasis> (PCRE_DOLLAR_ENDONLY)</term>
        <listitem>
         <simpara>
          If this modifier is set, a dollar metacharacter in the pattern
          matches only at the end of the subject string. Without this
          modifier, a dollar also matches immediately before the final
          character if it is a newline (but not before any other
          newlines).  This modifier is ignored if <emphasis>m</emphasis>
          modifier is set. There is no equivalent to this modifier in
          Perl.
         </simpara>
        </listitem>
       </varlistentry>
       <varlistentry>
        <term><emphasis>S</emphasis></term>
        <listitem>
         <simpara>
          When a pattern is going to be used several times, it is
          worth spending more time analyzing it in order to speed up
          the time taken for matching. If this modifier is set, then
          this extra analysis is performed. At present, studying a
          pattern is useful only for non-anchored patterns that do not
          have a single fixed starting character.
         </simpara>
        </listitem>
       </varlistentry>
       <varlistentry>
        <term><emphasis>U</emphasis> (PCRE_UNGREEDY)</term>
        <listitem>
         <simpara>
          This modifier inverts the "greediness" of the quantifiers so
          that they are not greedy by default, but become greedy if
          followed by "?". It is not compatible with Perl. It can also
          be set by a (?U) modifier setting within the pattern.
         </simpara>
        </listitem>
       </varlistentry>
       <varlistentry>
        <term><emphasis>X</emphasis> (PCRE_EXTRA)</term>
        <listitem>
         <simpara>
          This modifier turns on additional functionality of PCRE that
          is incompatible with Perl. Any backslash in a pattern that
          is followed by a letter that has no special meaning causes
          an error, thus reserving these combinations for future
          expansion. By default, as in Perl, a backslash followed by a
          letter with no special meaning is treated as a literal.
          There are at present no other features controlled by this
          modifier.
         </simpara>
        </listitem>
       </varlistentry>
      </variablelist>
     </blockquote>
    </para>
   </refsect1>
  </refentry>

  <refentry id="pcre.pattern.syntax">

   <refnamediv>
    <refname>Pattern Syntax</refname>
    <refpurpose>Describes PCRE regex syntax</refpurpose>
   </refnamediv>

   <refsect1>
    <title>Description</title>
    <literallayout>
     The PCRE library is a set of functions that implement regular
     expression pattern matching using the same syntax and semantics
     as Perl 5, with just a few differences (see below).  The current
     implementation corresponds to Perl 5.005.
    </literallayout>
   </refsect1>

   <refsect1>
    <title>Differences From Perl</title>
    <literallayout>
     The differences described here  are  with  respect  to  Perl
     5.005.

     1. By default, a whitespace character is any character  that
     the  C  library  function isspace() recognizes, though it is
     possible to compile PCRE  with  alternative  character  type
     tables. Normally isspace() matches space, formfeed, newline,
     carriage return, horizontal tab, and vertical tab. Perl 5 no
     longer  includes vertical tab in its set of whitespace char-
     acters. The \v escape that was in the Perl documentation for
     a long time was never in fact recognized. However, the char-
     acter itself was treated as whitespace at least up to 5.002.
     In 5.004 and 5.005 it does not match \s.

     2. PCRE does  not  allow  repeat  quantifiers  on  lookahead
     assertions. Perl permits them, but they do not mean what you
     might think. For example, (?!a){3} does not assert that  the
     next  three characters are not "a". It just asserts that the
     next character is not "a" three times.

     3. Capturing subpatterns that occur inside  negative  looka-
     head  assertions  are  counted,  but  their  entries  in the
     offsets vector are never set. Perl sets its numerical  vari-
     ables  from  any  such  patterns that are matched before the
     assertion fails to match something (thereby succeeding), but
     only  if  the negative lookahead assertion contains just one
     branch.

     4. Though binary zero characters are supported in  the  sub-
     ject  string,  they  are  not  allowed  in  a pattern string
     because it is passed as a normal  C  string,  terminated  by
     zero. The escape sequence "\0" can be used in the pattern to
     represent a binary zero.

     5. The following Perl escape sequences  are  not  supported:
     \l,  \u,  \L,  \U,  \E, \Q. In fact these are implemented by
     Perl's general string-handling and are not part of its  pat-
     tern matching engine.

     6. The Perl \G assertion is  not  supported  as  it  is  not
     relevant to single pattern matches.

     7. Fairly obviously, PCRE does  not  support  the  (?{code})
     construction.

     8. There are at the time of writing some  oddities  in  Perl
     5.005_02  concerned  with  the  settings of captured strings
     when part of a pattern is repeated.  For  example,  matching
     "aba"  against the pattern /^(a(b)?)+$/ sets $2 to the value
     "b", but matching "aabbaa" against /^(aa(bb)?)+$/ leaves  $2
     unset.    However,    if   the   pattern   is   changed   to
     /^(aa(b(b))?)+$/ then $2 (and $3) get set.

     In Perl 5.004 $2 is set in both cases, and that is also true
     of PCRE. If in the future Perl changes to a consistent state
     that is different, PCRE may change to follow.

     9. Another as yet unresolved discrepancy  is  that  in  Perl
     5.005_02  the  pattern /^(a)?(?(1)a|b)+$/ matches the string
     "a", whereas in PCRE it does not.  However, in both Perl and
     PCRE /^(a)?a/ matched against "a" leaves $1 unset.

     10. PCRE  provides  some  extensions  to  the  Perl  regular
     expression facilities:

     (a) Although lookbehind assertions must match  fixed  length
     strings,  each  alternative branch of a lookbehind assertion
     can match a different length of string. Perl 5.005  requires
     them all to have the same length.

     (b) If PCRE_DOLLAR_ENDONLY is set and PCRE_MULTILINE is  not
     set,  the  $ meta- character matches only at the very end of
     the string.

     (c) If PCRE_EXTRA is set, a backslash followed by  a  letter
     with no special meaning is faulted.

     (d) If PCRE_UNGREEDY is set, the greediness of  the  repeti-
     tion  quantifiers  is inverted, that is, by default they are
     not greedy, but if followed by a question mark they are.
    </literallayout>
   </refsect1>

   <refsect1>
    <title>Regular Expression Details</title>
    <literallayout>
     The syntax and semantics of  the  regular  expressions  sup-
     ported  by PCRE are described below. Regular expressions are
     also described in the Perl documentation and in a number  of
     other  books,  some  of which have copious examples. Jeffrey
     Friedl's  "Mastering  Regular  Expressions",  published   by
     O'Reilly  (ISBN 1-56592-257-3), covers them in great detail.
     The description here is intended as reference documentation.

     A regular expression is a pattern that is matched against  a
     subject string from left to right. Most characters stand for
     themselves in a pattern, and match the corresponding charac-
     ters in the subject. As a trivial example, the pattern

       The quick brown fox

     matches a portion of a subject string that is  identical  to
     itself.  The  power  of  regular  expressions comes from the
     ability to include alternatives and repetitions in the  pat-
     tern.  These  are encoded in the pattern by the use of <emphasis>meta</emphasis>-
     <emphasis>characters</emphasis>, which do not stand for  themselves  but  instead
     are interpreted in some special way.

     There are two different sets of meta-characters: those  that
     are  recognized anywhere in the pattern except within square
     brackets, and those that are recognized in square  brackets.
     Outside square brackets, the meta-characters are as follows:

       \      general escape character with several uses
       ^      assert start of  subject  (or  line,  in  multiline
     mode)
       $      assert end of subject (or line, in multiline mode)
       .      match any character except newline (by default)
       [      start character class definition
       |      start of alternative branch
       (      start subpattern
       )      end subpattern
       ?      extends the meaning of (
              also 0 or 1 quantifier
              also quantifier minimizer
       *      0 or more quantifier
       +      1 or more quantifier
       {      start min/max quantifier

     Part of a pattern that is in square  brackets  is  called  a
     "character  class".  In  a  character  class  the only meta-
     characters are:

       \      general escape character
       ^      negate the class, but only if the first character
       -      indicates character range
       ]      terminates the character class

     The following sections describe  the  use  of  each  of  the
     meta-characters.

BACKSLASH
     The backslash character has several uses. Firstly, if it  is
     followed  by  a  non-alphameric character, it takes away any
     special  meaning  that  character  may  have.  This  use  of
     backslash  as  an  escape  character applies both inside and
     outside character classes.

     For example, if you want to match a "*" character, you write
     "\*" in the pattern. This applies whether or not the follow-
     ing character would otherwise  be  interpreted  as  a  meta-
     character,  so it is always safe to precede a non-alphameric
     with "\" to specify that it stands for itself.  In  particu-
     lar, if you want to match a backslash, you write "\\".

     If a pattern is compiled with the PCRE_EXTENDED option, whi-
     tespace in the pattern (other than in a character class) and
     characters between a "#" outside a character class  and  the
     next  newline  character  are ignored. An escaping backslash
     can be used to include a whitespace or "#" character as part
     of the pattern.

     A second use of backslash provides a way  of  encoding  non-
     printing  characters  in patterns in a visible manner. There
     is no restriction on the appearance of non-printing  charac-
     ters,  apart from the binary zero that terminates a pattern,
     but when a pattern is being prepared by text editing, it  is
     usually  easier to use one of the following escape sequences
     than the binary character it represents:

       \a     alarm, that is, the BEL character (hex 07)
       \cx    "control-x", where x is any character
       \e     escape (hex 1B)
       \f     formfeed (hex 0C)
       \n     newline (hex 0A)
       \r     carriage return (hex 0D)
       \t     tab (hex 09)
       \xhh   character with hex code hh
       \ddd   character with octal code ddd, or backreference

     The precise effect of "\cx" is as follows: if "x" is a lower
     case  letter,  it  is converted to upper case. Then bit 6 of
     the character (hex 40) is inverted.  Thus "\cz" becomes  hex
     1A, but "\c{" becomes hex 3B, while "\c;" becomes hex 7B.

     After "\x", up to two hexadecimal digits are  read  (letters
     can be in upper or lower case).

     After "\0" up to two further octal digits are read. In  both
     cases,  if  there are fewer than two digits, just those that
     are present are used. Thus the sequence "\0\x\07"  specifies
     two binary zeros followed by a BEL character.  Make sure you
     supply two digits after the initial zero  if  the  character
     that follows is itself an octal digit.

     The handling of a backslash followed by a digit other than 0
     is  complicated.   Outside  a character class, PCRE reads it
     and any following digits as a decimal number. If the  number
     is  less  than  10, or if there have been at least that many
     previous capturing left parentheses in the  expression,  the
     entire  sequence is taken as a <emphasis>back</emphasis> 
<emphasis>reference</emphasis>. A description
     of how this works is given later, following  the  discussion
     of parenthesized subpatterns.

     Inside a character  class,  or  if  the  decimal  number  is
     greater  than  9 and there have not been that many capturing
     subpatterns, PCRE re-reads up to three octal digits  follow-
     ing  the  backslash,  and  generates  a single byte from the
     least significant 8 bits of the value. Any subsequent digits
     stand for themselves.  For example:

       \040   is another way of writing a space
       \40    is the same, provided there are fewer than 40
                 previous capturing subpatterns
       \7     is always a back reference
       \11    might be a back reference, or another way of
                 writing a tab
       \011   is always a tab
       \0113  is a tab followed by the character "3"
       \113   is the character with octal code 113 (since there
                 can be no more than 99 back references)
       \377   is a byte consisting entirely of 1 bits
       \81    is either a back reference, or a binary zero
                 followed by the two characters "8" and "1"

     Note that octal values of 100 or greater must not be  intro-
     duced  by  a  leading zero, because no more than three octal
     digits are ever read.

     All the sequences that define a single  byte  value  can  be
     used both inside and outside character classes. In addition,
     inside a character class, the sequence "\b"  is  interpreted
     as  the  backspace  character  (hex 08). Outside a character
     class it has a different meaning (see below).

     The third use of backslash is for specifying generic charac-
     ter types:

       \d     any decimal digit
       \D     any character that is not a decimal digit
       \s     any whitespace character
       \S     any character that is not a whitespace character
       \w     any "word" character
       \W     any "non-word" character

     Each pair of escape sequences partitions the complete set of
     characters  into  two  disjoint  sets.  Any  given character
     matches one, and only one, of each pair.

     A "word" character is any letter or digit or the  underscore
     character,  that  is,  any  character which can be part of a
     Perl "word". The definition of letters and  digits  is  con-
     trolled  by PCRE's character tables, and may vary if locale-
     specific matching is  taking  place  (see  "Locale  support"
     above). For example, in the "fr" (French) locale, some char-
     acter codes greater than 128 are used for accented  letters,
     and these are matched by \w.

     These character type sequences can appear  both  inside  and
     outside  character classes. They each match one character of
     the appropriate type. If the current matching  point  is  at
     the end of the subject string, all of them fail, since there
     is no character to match.

     The fourth use of backslash is  for  certain  simple  asser-
     tions. An assertion specifies a condition that has to be met
     at a particular point in  a  match,  without  consuming  any
     characters  from  the subject string. The use of subpatterns
     for more complicated  assertions  is  described  below.  The
     backslashed assertions are

       \b     word boundary
       \B     not a word boundary
       \A     start of subject (independent of multiline mode)
       \Z     end of subject or newline at  end  (independent  of
     multiline mode)
       \z     end of subject (independent of multiline mode)

     These assertions may not appear in  character  classes  (but
     note that "\b" has a different meaning, namely the backspace
     character, inside a character class).

     A word boundary is a position in the  subject  string  where
     the current character and the previous character do not both
     match \w or \W (i.e. one matches \w and  the  other  matches
     \W),  or the start or end of the string if the first or last
     character matches \w, respectively.

     The \A, \Z, and \z assertions differ  from  the  traditional
     circumflex  and  dollar  (described below) in that they only
     ever match at the very start and end of the subject  string,
     whatever  options  are  set.  They  are  not affected by the
     PCRE_NOTBOL or PCRE_NOTEOL options. The  difference  between
     \Z  and  \z  is that \Z matches before a newline that is the
     last character of the string as well as at the  end  of  the
     string, whereas \z matches only at the end.

CIRCUMFLEX AND DOLLAR
     Outside a character class, in the default matching mode, the
     circumflex  character  is an assertion which is true only if
     the current matching point is at the start  of  the  subject
     string. Inside a character class, circumflex has an entirely
     different meaning (see below).

     Circumflex need not be the first character of the pattern if
     a  number of alternatives are involved, but it should be the
     first thing in each alternative in which it appears  if  the
     pattern is ever to match that branch. If all possible alter-
     natives start with a circumflex, that is, if the pattern  is
     constrained to match only at the start of the subject, it is
     said to be an "anchored" pattern. (There are also other con-
     structs that can cause a pattern to be anchored.)

     A dollar character is an assertion which is true only if the
     current  matching point is at the end of the subject string,
     or immediately before a newline character that is  the  last
     character in the string (by default). Dollar need not be the
     last character of the pattern if a  number  of  alternatives
     are  involved,  but it should be the last item in any branch
     in which it appears.  Dollar has no  special  meaning  in  a
     character class.

     The meaning of dollar can be changed so that it matches only
     at   the   very   end   of   the   string,  by  setting  the
     PCRE_DOLLAR_ENDONLY option at compile or matching time. This
     does not affect the \Z assertion.

     The meanings of the circumflex  and  dollar  characters  are
     changed  if  the  PCRE_MULTILINE option is set. When this is
     the case,  they  match  immediately  after  and  immediately
     before an internal "\n" character, respectively, in addition
     to matching at the start and end of the subject string.  For
     example,  the  pattern  /^abc$/  matches  the subject string
     "def\nabc" in multiline  mode,  but  not  otherwise.  Conse-
     quently,  patterns  that  are  anchored  in single line mode
     because all branches start with "^" are not anchored in mul-
     tiline  mode.  The  PCRE_DOLLAR_ENDONLY option is ignored if
     PCRE_MULTILINE is set.

     Note that the sequences \A, \Z, and \z can be used to  match
     the  start  and end of the subject in both modes, and if all
     branches of a pattern start with \A is it  always  anchored,
     whether PCRE_MULTILINE is set or not.



FULL STOP (PERIOD, DOT)
     Outside a character class, a dot in the pattern matches  any
     one  character  in  the  subject,  including  a non-printing
     character, but not (by default) newline.  If the PCRE_DOTALL
     option  is  set,  then dots match newlines as well. The han-
     dling of dot is entirely independent of the handling of cir-
     cumflex  and  dollar,  the only relationship being that they
     both involve newline characters.  Dot has no special meaning
     in a character class.



SQUARE BRACKETS
     An opening square bracket introduces a character class, ter-
     minated  by  a  closing  square  bracket.  A  closing square
     bracket on its own is  not  special.  If  a  closing  square
     bracket  is  required as a member of the class, it should be
     the first data character in the class (after an initial cir-
     cumflex, if present) or escaped with a backslash.

     A character class matches a single character in the subject;
     the  character  must  be in the set of characters defined by
     the class, unless the first character in the class is a cir-
     cumflex,  in which case the subject character must not be in
     the set defined by the class. If a  circumflex  is  actually
     required  as  a  member  of  the class, ensure it is not the
     first character, or escape it with a backslash.

     For example, the character class [aeiou] matches  any  lower
     case vowel, while [^aeiou] matches any character that is not
     a lower case vowel. Note that a circumflex is  just  a  con-
     venient  notation for specifying the characters which are in
     the class by enumerating those that are not. It  is  not  an
     assertion:  it  still  consumes a character from the subject
     string, and fails if the current pointer is at  the  end  of
     the string.

     When caseless matching  is  set,  any  letters  in  a  class
     represent  both their upper case and lower case versions, so
     for example, a caseless [aeiou] matches "A" as well as  "a",
     and  a caseless [^aeiou] does not match "A", whereas a case-
     ful version would.

     The newline character is never treated in any special way in
     character  classes,  whatever the setting of the PCRE_DOTALL
     or PCRE_MULTILINE options is. A  class  such  as  [^a]  will
     always match a newline.

     The minus (hyphen) character can be used to specify a  range
     of  characters  in  a  character  class.  For example, [d-m]
     matches any letter between d and m, inclusive.  If  a  minus
     character  is required in a class, it must be escaped with a
     backslash or appear in a position where it cannot be  inter-
     preted as indicating a range, typically as the first or last
     character in the class.
     It is not possible to have the literal character "]" as  the
     end  character  of  a  range.  A  pattern such as [W-]46] is
     interpreted as a class of two characters ("W" and "-")  fol-
     lowed by a literal string "46]", so it would match "W46]" or
     "-46]". However, if the "]" is escaped with a  backslash  it
     is  interpreted  as  the end of range, so [W-\]46] is inter-
     preted as a single class containing a range followed by  two
     separate characters. The octal or hexadecimal representation
     of "]" can also be used to end a range.

     Ranges operate in ASCII collating sequence. They can also be
     used  for  characters  specified  numerically,  for  example
     [\000-\037]. If a range that includes letters is  used  when
     caseless  matching  is set, it matches the letters in either
     case. For example, [W-c] is equivalent  to  [][\^_`wxyzabc],
     matched  caselessly,  and  if  character tables for the "fr"
     locale are in use, [\xc8-\xcb] matches accented E characters
     in both cases.

     The character types \d, \D, \s, \S,  \w,  and  \W  may  also
     appear  in  a  character  class, and add the characters that
     they match to the class. For example, [\dABCDEF] matches any
     hexadecimal  digit.  A  circumflex  can conveniently be used
     with the upper case character types to specify a  more  res-
     tricted set of characters than the matching lower case type.
     For example, the class [^\W_] matches any letter  or  digit,
     but not underscore.

     All non-alphameric characters other than \,  -,  ^  (at  the
     start)  and  the  terminating ] are non-special in character
     classes, but it does no harm if they are escaped.



VERTICAL BAR
     Vertical bar characters are  used  to  separate  alternative
     patterns. For example, the pattern

       gilbert|sullivan

     matches either "gilbert" or "sullivan". Any number of alter-
     natives  may  appear,  and an empty alternative is permitted
     (matching the empty string).   The  matching  process  tries
     each  alternative in turn, from left to right, and the first
     one that succeeds is used. If the alternatives are within  a
     subpattern  (defined  below),  "succeeds" means matching the
     rest of the main pattern as well as the alternative  in  the
     subpattern.




INTERNAL OPTION SETTING
     The settings of PCRE_CASELESS, PCRE_MULTILINE,  PCRE_DOTALL,
     and  PCRE_EXTENDED can be changed from within the pattern by
     a sequence of Perl option letters enclosed between "(?"  and
     ")". The option letters are

       i  for PCRE_CASELESS
       m  for PCRE_MULTILINE
       s  for PCRE_DOTALL
       x  for PCRE_EXTENDED

     For example, (?im) sets caseless, multiline matching. It  is
     also possible to unset these options by preceding the letter
     with a hyphen, and a combined setting and unsetting such  as
     (?im-sx),  which sets PCRE_CASELESS and PCRE_MULTILINE while
     unsetting PCRE_DOTALL and PCRE_EXTENDED, is also  permitted.
     If  a  letter  appears both before and after the hyphen, the
     option is unset.

     The scope of these option changes depends on  where  in  the
     pattern  the  setting  occurs. For settings that are outside
     any subpattern (defined below), the effect is the same as if
     the  options were set or unset at the start of matching. The
     following patterns all behave in exactly the same way:

       (?i)abc
       a(?i)bc
       ab(?i)c
       abc(?i)

     which in turn is the same as compiling the pattern abc  with
     PCRE_CASELESS  set.   In  other words, such "top level" set-
     tings apply to the whole pattern  (unless  there  are  other
     changes  inside subpatterns). If there is more than one set-
     ting of the same option at top level, the rightmost  setting
     is used.

     If an option change occurs inside a subpattern,  the  effect
     is  different.  This is a change of behaviour in Perl 5.005.
     An option change inside a subpattern affects only that  part
     of the subpattern that follows it, so

       (a(?i)b)c

     matches  abc  and  aBc  and  no  other   strings   (assuming
     PCRE_CASELESS  is  not used).  By this means, options can be
     made to have different settings in different  parts  of  the
     pattern.  Any  changes  made  in one alternative do carry on
     into subsequent branches within  the  same  subpattern.  For
     example,

       (a(?i)b|c)

     matches "ab", "aB", "c", and "C", even though when  matching
     "C" the first branch is abandoned before the option setting.
     This is because the effects of  option  settings  happen  at
     compile  time. There would be some very weird behaviour oth-
     erwise.

     The PCRE-specific options PCRE_UNGREEDY and  PCRE_EXTRA  can
     be changed in the same way as the Perl-compatible options by
     using the characters U and X  respectively.  The  (?X)  flag
     setting  is  special in that it must always occur earlier in
     the pattern than any of the additional features it turns on,
     even when it is at top level. It is best put at the start.



SUBPATTERNS
     Subpatterns are delimited by parentheses  (round  brackets),
     which can be nested.  Marking part of a pattern as a subpat-
     tern does two things:

     1. It localizes a set of alternatives. For example, the pat-
     tern

       cat(aract|erpillar|)

     matches one of the words "cat",  "cataract",  or  "caterpil-
     lar".  Without  the  parentheses, it would match "cataract",
     "erpillar" or the empty string.

     2. It sets up the subpattern as a capturing  subpattern  (as
     defined  above).   When the whole pattern matches, that por-
     tion of the subject string that matched  the  subpattern  is
     passed  back  to  the  caller  via  the  <emphasis>ovector</emphasis> argument of
     <function>pcre_exec</function>. Opening parentheses are counted  from  left  to
     right (starting from 1) to obtain the numbers of the captur-
     ing subpatterns.

     For example, if the string "the red king" is matched against
     the pattern

       the ((red|white) (king|queen))

     the captured substrings are "red king", "red",  and  "king",
     and are numbered 1, 2, and 3.

     The fact that plain parentheses fulfil two functions is  not
     always  helpful.  There are often times when a grouping sub-
     pattern is required without a capturing requirement.  If  an
     opening parenthesis is followed by "?:", the subpattern does
     not do any capturing, and is not counted when computing  the
     number of any subsequent capturing subpatterns. For example,
     if the string "the  white  queen"  is  matched  against  the
     pattern

       the ((?:red|white) (king|queen))

     the captured substrings are "white queen" and  "queen",  and
     are  numbered  1  and 2. The maximum number of captured sub-
     strings is 99, and the maximum number  of  all  subpatterns,
     both capturing and non-capturing, is 200.

     As a  convenient  shorthand,  if  any  option  settings  are
     required  at  the  start  of a non-capturing subpattern, the
     option letters may appear between the "?" and the ":".  Thus
     the two patterns

       (?i:saturday|sunday)
       (?:(?i)saturday|sunday)

     match exactly the same set of strings.  Because  alternative
     branches  are  tried from left to right, and options are not
     reset until the end of the subpattern is reached, an  option
     setting  in  one  branch does affect subsequent branches, so
     the above patterns match "SUNDAY" as well as "Saturday".



REPETITION
     Repetition is specified by quantifiers, which can follow any
     of the following items:

       a single character, possibly escaped
       the . metacharacter
       a character class
       a back reference (see next section)
       a parenthesized subpattern (unless it is  an  assertion  -
     see below)

     The general repetition quantifier specifies  a  minimum  and
     maximum  number  of  permitted  matches,  by  giving the two
     numbers in curly brackets (braces), separated  by  a  comma.
     The  numbers  must be less than 65536, and the first must be
     less than or equal to the second. For example:

       z{2,4}

     matches "zz", "zzz", or "zzzz". A closing brace on  its  own
     is not a special character. If the second number is omitted,
     but the comma is present, there is no upper  limit;  if  the
     second number and the comma are both omitted, the quantifier
     specifies an exact number of required matches. Thus

       [aeiou]{3,}

     matches at least 3 successive vowels,  but  may  match  many
     more, while

       \d{8}

     matches exactly 8 digits.  An  opening  curly  bracket  that
     appears  in a position where a quantifier is not allowed, or
     one that does not match the syntax of a quantifier, is taken
     as  a literal character. For example, {,6} is not a quantif-
     ier, but a literal string of four characters.

     The quantifier {0} is permitted, causing the  expression  to
     behave  as  if the previous item and the quantifier were not
     present.

     For convenience (and  historical  compatibility)  the  three
     most common quantifiers have single-character abbreviations:

       *    is equivalent to {0,}
       +    is equivalent to {1,}
       ?    is equivalent to {0,1}

     It is possible to construct infinite loops  by  following  a
     subpattern  that  can  match no characters with a quantifier
     that has no upper limit, for example:

       (a?)*

     Earlier versions of Perl and PCRE used to give an  error  at
     compile  time  for such patterns. However, because there are
     cases where this  can  be  useful,  such  patterns  are  now
     accepted,  but  if  any repetition of the subpattern does in
     fact match no characters, the loop is forcibly broken.

     By default, the quantifiers  are  "greedy",  that  is,  they
     match  as much as possible (up to the maximum number of per-
     mitted times), without causing the rest of  the  pattern  to
     fail. The classic example of where this gives problems is in
     trying to match comments in C programs. These appear between
     the  sequences /* and */ and within the sequence, individual
     * and / characters may appear. An attempt to  match  C  com-
     ments by applying the pattern

       /\*.*\*/

     to the string

       /* first command */  not comment  /* second comment */

     fails, because it matches  the  entire  string  due  to  the
     greediness of the .*  item.

     However, if a quantifier is followed  by  a  question  mark,
     then it ceases to be greedy, and instead matches the minimum
     number of times possible, so the pattern

       /\*.*?\*/

     does the right thing with the C comments. The meaning of the
     various  quantifiers is not otherwise changed, just the pre-
     ferred number of matches.  Do not confuse this use of  ques-
     tion  mark  with  its  use as a quantifier in its own right.
     Because it has two uses, it can sometimes appear doubled, as
     in

       \d??\d

     which matches one digit by preference, but can match two  if
     that is the only way the rest of the pattern matches.

     If the PCRE_UNGREEDY option is set (an option which  is  not
     available  in  Perl)  then the quantifiers are not greedy by
     default, but individual ones can be made greedy by following
     them  with  a  question mark. In other words, it inverts the
     default behaviour.

     When a parenthesized subpattern is quantified with a minimum
     repeat  count  that is greater than 1 or with a limited max-
     imum, more store is required for the  compiled  pattern,  in
     proportion to the size of the minimum or maximum.

     If a pattern starts with .* or  .{0,}  and  the  PCRE_DOTALL
     option (equivalent to Perl's /s) is set, thus allowing the .
     to match newlines, then the pattern is implicitly  anchored,
     because whatever follows will be tried against every charac-
     ter position in the subject string, so there is no point  in
     retrying  the overall match at any position after the first.
     PCRE treats such a pattern as though it were preceded by \A.
     In  cases where it is known that the subject string contains
     no newlines, it is worth setting PCRE_DOTALL when  the  pat-
     tern begins with .* in order to obtain this optimization, or
     alternatively using ^ to indicate anchoring explicitly.

     When a capturing subpattern is repeated, the value  captured
     is the substring that matched the final iteration. For exam-
     ple, after

       (tweedle[dume]{3}\s*)+

     has matched "tweedledum tweedledee" the value  of  the  cap-
     tured  substring  is  "tweedledee".  However,  if  there are
     nested capturing  subpatterns,  the  corresponding  captured
     values  may  have been set in previous iterations. For exam-
     ple, after
       /(a|(b))+/

     matches "aba" the value of the second captured substring  is
     "b".



BACK REFERENCES
     Outside a character class, a backslash followed by  a  digit
     greater  than  0  (and  possibly  further  digits) is a back
     reference to a capturing subpattern  earlier  (i.e.  to  its
     left)  in  the  pattern,  provided there have been that many
     previous capturing left parentheses.

     However, if the decimal number following  the  backslash  is
     less  than  10,  it is always taken as a back reference, and
     causes an error only if there are not  that  many  capturing
     left  parentheses in the entire pattern. In other words, the
     parentheses that are referenced need not be to the  left  of
     the  reference  for  numbers  less  than 10. See the section
     entitled "Backslash" above for further details of  the  han-
     dling of digits following a backslash.

     A back reference matches whatever actually matched the  cap-
     turing subpattern in the current subject string, rather than
     anything matching the subpattern itself. So the pattern

       (sens|respons)e and \1ibility

     matches "sense and sensibility" and "response and  responsi-
     bility",  but  not  "sense  and  responsibility". If caseful
     matching is in force at the time of the back reference, then
     the case of letters is relevant. For example,

       ((?i)rah)\s+\1

     matches "rah rah" and "RAH RAH", but  not  "RAH  rah",  even
     though  the  original  capturing subpattern is matched case-
     lessly.

     There may be more than one back reference to the  same  sub-
     pattern.  If  a  subpattern  has not actually been used in a
     particular match, then any  back  references  to  it  always
     fail. For example, the pattern

       (a|(bc))\2

     always fails if it starts to match  "a"  rather  than  "bc".
     Because  there  may  be up to 99 back references, all digits
     following the backslash are taken as  part  of  a  potential
     back reference number. If the pattern continues with a digit
     character, then some delimiter must be used to terminate the
     back reference. If the PCRE_EXTENDED option is set, this can
     be whitespace.  Otherwise an empty comment can be used.

     A back reference that occurs inside the parentheses to which
     it  refers  fails when the subpattern is first used, so, for
     example, (a\1) never matches.  However, such references  can
     be useful inside repeated subpatterns. For example, the pat-
     tern

       (a|b\1)+

     matches any number of "a"s and also "aba", "ababaa" etc.  At
     each iteration of the subpattern, the back reference matches
     the character string corresponding to  the  previous  itera-
     tion.  In  order  for this to work, the pattern must be such
     that the first iteration does not need  to  match  the  back
     reference.  This  can  be  done using alternation, as in the
     example above, or by a quantifier with a minimum of zero.



ASSERTIONS
     An assertion is  a  test  on  the  characters  following  or
     preceding  the current matching point that does not actually
     consume any characters. The simple assertions coded  as  \b,
     \B,  \A,  \Z,  \z, ^ and $ are described above. More compli-
     cated assertions are coded as  subpatterns.  There  are  two
     kinds:  those that look ahead of the current position in the
     subject string, and those that look behind it.

     An assertion subpattern is matched in the normal way, except
     that  it  does not cause the current matching position to be
     changed. Lookahead assertions start with  (?=  for  positive
     assertions and (?! for negative assertions. For example,

       \w+(?=;)

     matches a word followed by a semicolon, but does not include
     the semicolon in the match, and

       foo(?!bar)

     matches any occurrence of "foo"  that  is  not  followed  by
     "bar". Note that the apparently similar pattern

       (?!foo)bar

     does not find an occurrence of "bar"  that  is  preceded  by
     something other than "foo"; it finds any occurrence of "bar"
     whatsoever, because the assertion  (?!foo)  is  always  true
     when  the  next  three  characters  are  "bar". A lookbehind
     assertion is needed to achieve this effect.
     Lookbehind assertions start with (?&lt;=  for  positive  asser-
     tions and (?&lt;! for negative assertions. For example,

       (?&lt;!foo)bar

     does find an occurrence of "bar" that  is  not  preceded  by
     "foo". The contents of a lookbehind assertion are restricted
     such that all the strings  it  matches  must  have  a  fixed
     length.  However, if there are several alternatives, they do
     not all have to have the same fixed length. Thus

       (?&lt;=bullock|donkey)

     is permitted, but

       (?&lt;!dogs?|cats?)

     causes an error at compile time. Branches  that  match  dif-
     ferent length strings are permitted only at the top level of
     a lookbehind assertion. This is an extension  compared  with
     Perl  5.005,  which  requires all branches to match the same
     length of string. An assertion such as

       (?&lt;=ab(c|de))

     is not permitted, because its single  top-level  branch  can
     match two different lengths, but it is acceptable if rewrit-
     ten to use two top-level branches:

       (?&lt;=abc|abde)

     The implementation of lookbehind  assertions  is,  for  each
     alternative,  to  temporarily move the current position back
     by the fixed width and then  try  to  match.  If  there  are
     insufficient  characters  before  the  current position, the
     match is deemed to fail.  Lookbehinds  in  conjunction  with
     once-only  subpatterns can be particularly useful for match-
     ing at the ends of strings; an example is given at  the  end
     of the section on once-only subpatterns.

     Several assertions (of any sort) may  occur  in  succession.
     For example,

       (?&lt;=\d{3})(?&lt;!999)foo

     matches "foo" preceded by three digits that are  not  "999".
     Furthermore,  assertions  can  be nested in any combination.
     For example,

       (?&lt;=(?&lt;!foo)bar)baz

     matches an occurrence of "baz" that  is  preceded  by  "bar"
     which in turn is not preceded by "foo".

     Assertion subpatterns are not capturing subpatterns, and may
     not  be  repeated,  because  it makes no sense to assert the
     same thing several times. If an assertion contains capturing
     subpatterns within it, these are always counted for the pur-
     poses of numbering the capturing subpatterns  in  the  whole
     pattern.   Substring  capturing  is carried out for positive
     assertions, but it does not make sense for  negative  asser-
     tions.

     Assertions count towards the maximum  of  200  parenthesized
     subpatterns.



ONCE-ONLY SUBPATTERNS
     With both maximizing and minimizing repetition,  failure  of
     what  follows  normally  causes  the repeated item to be re-
     evaluated to see if a different number of repeats allows the
     rest  of  the  pattern  to  match. Sometimes it is useful to
     prevent this, either to change the nature of the  match,  or
     to  cause  it fail earlier than it otherwise might, when the
     author of the pattern knows there is no  point  in  carrying
     on.

     Consider, for example, the pattern \d+foo  when  applied  to
     the subject line

       123456bar

     After matching all 6 digits and then failing to match "foo",
     the normal action of the matcher is to try again with only 5
     digits matching the \d+ item, and then with 4,  and  so  on,
     before ultimately failing. Once-only subpatterns provide the
     means for specifying that once a portion of the pattern  has
     matched,  it  is  not to be re-evaluated in this way, so the
     matcher would give up immediately on failing to match  "foo"
     the  first  time.  The  notation  is another kind of special
     parenthesis, starting with (?&gt; as in this example:

       (?&gt;\d+)bar

     This kind of parenthesis "locks up" the  part of the pattern
     it  contains once it has matched, and a failure further into
     the pattern is prevented from backtracking  into  it.  Back-
     tracking  past  it to previous items, however, works as nor-
     mal.

     An alternative description is that a subpattern of this type
     matches  the  string  of  characters that an identical stan-
     dalone pattern would match, if anchored at the current point
     in the subject string.

     Once-only subpatterns are not capturing subpatterns.  Simple
     cases  such as the above example can be thought of as a max-
     imizing repeat that must  swallow  everything  it  can.  So,
     while both \d+ and \d+? are prepared to adjust the number of
     digits they match in order to make the rest of  the  pattern
     match, (?&gt;\d+) can only match an entire sequence of digits.

     This construction can of course contain arbitrarily  compli-
     cated subpatterns, and it can be nested.

     Once-only subpatterns can be used in conjunction with  look-
     behind  assertions  to specify efficient matching at the end
     of the subject string. Consider a simple pattern such as

       abcd$

     when applied to a long  string  which  does  not  match  it.
     Because matching proceeds from left to right, PCRE will look
     for each "a" in the subject and then  see  if  what  follows
     matches the rest of the pattern. If the pattern is specified
     as

       ^.*abcd$

     then the initial .* matches the entire string at first,  but
     when  this  fails,  it  backtracks to match all but the last
     character, then all but the last two characters, and so  on.
     Once again the search for "a" covers the entire string, from
     right to left, so we are no better off. However, if the pat-
     tern is written as

       ^(?&gt;.*)(?&lt;=abcd)

     then there can be no backtracking for the .*  item;  it  can
     match  only  the  entire  string.  The subsequent lookbehind
     assertion does a single test on the last four characters. If
     it  fails,  the  match  fails immediately. For long strings,
     this approach makes a significant difference to the process-
     ing time.



CONDITIONAL SUBPATTERNS
     It is possible to cause the matching process to obey a  sub-
     pattern  conditionally  or to choose between two alternative
     subpatterns, depending on the result  of  an  assertion,  or
     whether  a previous capturing subpattern matched or not. The
     two possible forms of conditional subpattern are

       (?(condition)yes-pattern)
       (?(condition)yes-pattern|no-pattern)

     If the condition is satisfied, the yes-pattern is used; oth-
     erwise  the  no-pattern  (if  present) is used. If there are
     more than two alternatives in the subpattern, a compile-time
     error occurs.

     There are two kinds of condition. If the  text  between  the
     parentheses  consists of a sequence of digits, then the con-
     dition is satisfied if  the  capturing  subpattern  of  that
     number  has  previously matched. Consider the following pat-
     tern, which contains non-significant white space to make  it
     more  readable  (assume  the  PCRE_EXTENDED  option)  and to
     divide it into three parts for ease of discussion:

       ( \( )?    [^()]+    (?(1) \) )

     The first part matches an optional opening parenthesis,  and
     if  that character is present, sets it as the first captured
     substring. The second part matches one  or  more  characters
     that  are  not  parentheses. The third part is a conditional
     subpattern that tests whether the first set  of  parentheses
     matched  or  not.  If  they did, that is, if subject started
     with an opening parenthesis, the condition is true,  and  so
     the  yes-pattern  is  executed  and a closing parenthesis is
     required. Otherwise, since no-pattern is  not  present,  the
     subpattern  matches  nothing.  In  other words, this pattern
     matches a sequence of non-parentheses,  optionally  enclosed
     in parentheses.

     If the condition is not a sequence of digits, it must be  an
     assertion.  This  may be a positive or negative lookahead or
     lookbehind assertion. Consider this pattern, again  contain-
     ing  non-significant  white space, and with the two alterna-
     tives on the second line:

       (?(?=[^a-z]*[a-z])
       \d{2}[a-z]{3}-\d{2}  |  \d{2}-\d{2}-\d{2} )

     The condition is a positive lookahead assertion that matches
     an optional sequence of non-letters followed by a letter. In
     other words, it tests for  the  presence  of  at  least  one
     letter  in the subject. If a letter is found, the subject is
     matched against  the  first  alternative;  otherwise  it  is
     matched  against the second. This pattern matches strings in
     one of the two forms dd-aaa-dd or dd-dd-dd,  where  aaa  are
     letters and dd are digits.



COMMENTS
     The  sequence  (?#  marks  the  start  of  a  comment  which
     continues   up  to  the  next  closing  parenthesis.  Nested
     parentheses are not permitted. The characters that make up a
     comment play no part in the pattern matching at all.

     If the PCRE_EXTENDED option is set, an unescaped # character
     outside  a character class introduces a comment that contin-
     ues up to the next newline character in the pattern.



PERFORMANCE
     Certain items that may appear in patterns are more efficient
     than  others.  It is more efficient to use a character class
     like [aeiou] than a set of alternatives such as (a|e|i|o|u).
     In  general,  the  simplest  construction  that provides the
     required behaviour is usually the  most  efficient.  Jeffrey
     Friedl's  book contains a lot of discussion about optimizing
     regular expressions for efficient performance.

     When a pattern begins with .* and the PCRE_DOTALL option  is
     set,  the  pattern  is implicitly anchored by PCRE, since it
     can match only at the start of a subject string. However, if
     PCRE_DOTALL  is not set, PCRE cannot make this optimization,
     because the . metacharacter does not then match  a  newline,
     and if the subject string contains newlines, the pattern may
     match from the character immediately following one  of  them
     instead of from the very start. For example, the pattern

        (.*) second

     matches the subject "first\nand second" (where \n stands for
     a newline character) with the first captured substring being
     "and". In order to do this, PCRE  has  to  retry  the  match
     starting after every newline in the subject.

     If you are using such a pattern with subject strings that do
     not  contain  newlines,  the best performance is obtained by
     setting PCRE_DOTALL, or starting the  pattern  with  ^.*  to
     indicate  explicit anchoring. That saves PCRE from having to
     scan along the subject looking for a newline to restart at.
    </literallayout>
   </refsect1>
  </refentry>
</reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/pdf.xml
+++ phpdoc/kr/functions/pdf.xml
 <reference id="ref.pdf">
  <title>PDF functions</title>
  <titleabbrev>PDF</titleabbrev>

  <partintro>
   <sect1 id="pdf.intro">
    <title>Introduction</title>
    <simpara>
     You can use the PDF functions in PHP to create PDF files if you
     have the PDF library by Thomas Merz  (available at 
     <ulink url="&url.pdf;">&url.pdf;</ulink>;
     you will also need <ulink url="&url.jpeg;">the JPEG library</ulink>
     and <ulink url="&url.tiff;">the TIFF library</ulink> to
     compile this. These two libs also quite often make problems when
     configuring php. Follow the messages of configure to fix possible
     problems.
    </simpara>
    <simpara>
     Please consult the excellent documentation for
     pdflib shipped with the source distribution of pdflib.
     It provides a very good overview of what pdflib capable of doing.
     Most of the functions in pdflib
     and the PHP module have the same name. The parameters are also
     identical.  You should also understand some of the concepts of PDF
     or Postscript to efficiently use this module.
     All lengths and coordinates are measured in Postscript points.
     There are generally 72 PostScript points to an inch, but this
     depends on the output resolution.
    </simpara>
    <simpara>
     There is another PHP module for pdf document creation based on
     <ulink url="&url.cpdf;">FastIO's</ulink>.
     ClibPDF. It has a slightly different API. Check the
     <link linkend="ref.cpdf">ClibPDF functions</link> section for
     details.
    </simpara>
    <simpara> 
     The pdf module introduces two new type of variable.
     It is called <parameter>pdfdoc</parameter>
     <parameter>pdfdoc</parameter> is a pointer to a pdf document and
     almost all functions need it as its first parameter.
     </simpara>
   </sect1>
   <sect1 id="pdf.oldlibs.confusion">
    <title>Confusion with old pdflib versions</title>
    <simpara>  
     Since the very begining of PDF support in PHP &mdash; starting with
     pdflib 0.6 &mdash;
     there has been tons of changes especially to the pdflib API. Most of
     these changes has been somehow covered by PHP, some has even required
     changes to the PHP API. Since pdflib
     3.x the API seems to be stabilzed and PHP 4 has adopted the version as a
     minimum requirement for PDF support. The consequence will be that many
     functions will disappear or be replaced by alternatives sooner or later. 
     Support for pdflib 0.6 is already completely given up.
     The following table list all the functions which are deprecated
     in PHP 4.02 and should be replaced by their new versions.
    </simpara>
    <para>
     <table>
      <title>Deprecated functions and its replacements</title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>Old function</entry>
         <entry>Replacement</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry><function>pdf_put_image</function></entry>
         <entry>Not needed anymore.</entry>
        </row>
        <row>
         <entry><function>pdf_get_font</function></entry>
         <entry><function>pdf_get_value</function> passing
         <literal>"font"</literal> as the second parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_get_fontsize</function></entry>
         <entry><function>pdf_get_value</function> passing 
                  <literal>"fontsize"</literal> as the second parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_get_fontname</function></entry>
         <entry><function>pdf_get_parameter</function>  passing    
         <literal>"fontname"</literal> as the second parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_set_info_creator</function></entry>
         <entry><function>pdf_set_info</function> passing    
         <literal>"Creator"</literal> as the second parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_set_info_title</function></entry>
         <entry><function>pdf_set_info</function> passing
         <literal>"Title"</literal> as the second parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_set_info_subject</function></entry>
         <entry><function>pdf_set_info</function> passing
         <literal>"Subject"</literal> as the second parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_set_info_author</function></entry>
         <entry><function>pdf_set_info</function> passing
         <literal>"Author"</literal> as the second parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_set_info_keywords</function></entry>
         <entry><function>pdf_set_info</function> passing
         <literal>"Keywords"</literal> as the second parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_set_leading</function></entry>
         <entry><function>pdf_set_value</function> passing
         <literal>"leading"</literal> as the second parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_set_text_rendering</function></entry>
         <entry><function>pdf_set_value</function> passing
         <literal>"textrendering"</literal> as the second parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_set_text_rise</function></entry>
         <entry><function>pdf_set_value</function> passing
         <literal>"textrise"</literal> as the second parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_set_horiz_scaling</function></entry>
         <entry><function>pdf_set_value</function> passing
         <literal>"horizscaling"</literal> as the second parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_set_text_matrix</function></entry>
         <entry>Not available anymore</entry>
        </row>
        <row>
         <entry><function>pdf_set_char_spacing</function></entry>
         <entry><function>pdf_set_value</function> passing
         <literal>"charspacing"</literal> as the second parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_set_word_spacing</function></entry>
         <entry><function>pdf_set_value</function> passing
         <literal>"wordspacing"</literal> as the second parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_set_transition</function></entry>
         <entry><function>pdf_set_parameter</function> passing
         <literal>"transition"</literal> as the second parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_set_duration</function></entry>
         <entry><function>pdf_set_value</function> passing
         <literal>"duration"</literal> as the second parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_open_gif</function></entry>
         <entry><function>pdf_open_image_file</function> passing
         <literal>"gif"</literal> as the second parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_open_jpeg</function></entry>
         <entry><function>pdf_open_image_file</function> passing
         <literal>"jpeg"</literal> as the second parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_open_tiff</function></entry>
         <entry><function>pdf_open_image_file</function> passing
         <literal>"tiff"</literal> as the second parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_open_png</function></entry>
         <entry><function>pdf_open_image_file</function> passing
         <literal>"png"</literal> as the second parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_get_imagewidth</function></entry>
         <entry><function>pdf_get_value</function> passing
         <literal>"imagewidth"</literal> as the second parameter and the image
         as the third parameter.</entry>
        </row>
        <row>
         <entry><function>pdf_get_imageheight</function></entry>
         <entry><function>pdf_get_value</function> passing
         <literal>"imageheight"</literal> as the second parameter and the
         image as the third parameter.</entry>
        </row>
        <row>
         <entry><function></function></entry>
         <entry><function></function></entry>
        </row>
       </tbody>
      </tgroup>
     </table>
    </para>
   </sect1>
   <sect1 id="pdf.install.pdflib">
    <title>Hints for installation of pdflib 3.x</title>
    <simpara>
     Since version 3.0 of pdflib you should configure pdflib with the option
     <literal>--enable-shared-pdflib</literal>.
    </simpara>
   </sect1>
   <sect1 id="pdf.oldlibs.hints">
    <title>Issues with older versions of pdflib</title>
    <simpara>
     If you use pdflib 2.01 check how the lib was installed.
     There should be a file or a to link libpdf.so. Version 2.01 just creates
     a lib with the name libpdf2.01.so which cannot be found when linking
     the test programm in configure. You will have to create a symbolic
     link from libpdf.so to libpdf2.01.so.).
    </simpara>
    <simpara>
     Version 2.20 of pdflib has introduced more changes to its API and
     support for chinese and japanese fonts. This unfortunately causes
     some changes of the pdf module of php4 (not php3). If you use pdflib 2.20
     handle the in memory generation of PDF documents with care. Until
     pdflib 3.0 is released it might be unstable. The encoding parameter
     of <function>pdf_set_font</function> has changed to a string. This
     means that instead of e.g. 4 you have to use 'winansi'.
    </simpara>
    <simpara>
     If you use pdflib 2.30 the <function>pdf_set_text_matrix</function>
     will have gone. It is not supported any more. In general it is a good
     advise to consult the release notes of the used version of pdflib
     for possible changes.
    </simpara>
    <simpara>
      Any version of PHP 4 after March, 9th 2000 do not support versions
      of pdflib older than 3.0. PHP 3 on the other hand should not be used
      with version newer than 2.01.
    </simpara>
   </sect1>
   <sect1 id="pdf.examples">
    <title>Examples</title>
    <simpara>
     Most of the functions are fairly easy to use. The most difficult part
     is probably to create a very simple pdf document at all. The following
     example should help to get started. 
     It creates the file <filename>test.pdf</filename>
     with one page. The page contains the text "Times Roman outlined" in an
     outlined, 30pt font. The text is also underlined.
    </simpara>
    <para>
     <example>
      <title>Creating a PDF document with pdflib</title>
      <programlisting>
&lt;?php
$fp = fopen("test.pdf", "w");
$pdf = pdf_open($fp);
pdf_set_info($pdf, "Author", "Uwe Steinmann");
pdf_set_info($pdf, "Title", "Test for PHP wrapper of PDFlib 2.0");
pdf_set_info($pdf, "Creator", "See Author");
pdf_set_info($pdf, "Subject", "Testing");
pdf_begin_page($pdf, 595, 842);
pdf_add_outline($pdf, "Page 1");
pdf_set_font($pdf, "Times-Roman", 30, "host");
pdf_set_value($pdf, "textrendering", 1);
pdf_show_xy($pdf, "Times Roman outlined", 50, 750);
pdf_moveto($pdf, 50, 740);
pdf_lineto($pdf, 330, 740);
pdf_stroke($pdf);
pdf_end_page($pdf);
pdf_close($pdf);
fclose($fp);
echo "&lt;A HREF=getpdf.php>finished&lt;/A>";
?>
      </programlisting>
      <simpara>
       The script <filename>getpdf.php</filename> just returns the pdf document.
      </simpara>
      <informalexample>
       <programlisting>
&lt;?php
$fp = fopen("test.pdf", "r");
header("Content-type: application/pdf");
fpassthru($fp);
fclose($fp);
?>
       </programlisting>
      </informalexample>
     </example>
    </para>
    <para>
     The pdflib distribution contains a more complex example which
     creates a serious of pages with an analog clock. This example
     converted into PHP using pdflib looks as the following (you
     can see the same example in the documentation for the
     <link linkend="ref.cpdf">clibpdf module)</link>:
    </para>
    <para>
     <example>
      <title>pdfclock example from pdflib distribution</title>
      <programlisting>
&lt;?php
$pdffilename = "clock.pdf";
$radius = 200;
$margin = 20;
$pagecount = 40;

$fp = fopen($pdffilename, "w");
$pdf = pdf_open($fp);
pdf_set_info($pdf, "Creator", "pdf_clock.php3");
pdf_set_info($pdf, "Author", "Uwe Steinmann");
pdf_set_info($pdf, "Title", "Analog Clock");

while($pagecount-- > 0) {
    pdf_begin_page($pdf, 2 * ($radius + $margin), 2 * ($radius + $margin));

    pdf_set_parameter($pdf, "transition", "wipe");
    pdf_set_value($pdf, "duration", 0.5);
  
    pdf_translate($pdf, $radius + $margin, $radius + $margin);
    pdf_save($pdf);
    pdf_setrgbcolor($pdf, 0.0, 0.0, 1.0);

    /* minute strokes */
    pdf_setlinewidth($pdf, 2.0);
    for ($alpha = 0; $alpha &lt; 360; $alpha += 6) {
        pdf_rotate($pdf, 6.0);
        pdf_moveto($pdf, $radius, 0.0);
        pdf_lineto($pdf, $radius-$margin/3, 0.0);
        pdf_stroke($pdf);
    }

    pdf_restore($pdf);
    pdf_save($pdf);

    /* 5 minute strokes */
    pdf_setlinewidth($pdf, 3.0);
    for ($alpha = 0; $alpha &lt; 360; $alpha += 30) { 
        pdf_rotate($pdf, 30.0);
        pdf_moveto($pdf, $radius, 0.0);
        pdf_lineto($pdf, $radius-$margin, 0.0);
        pdf_stroke($pdf);
    }

    $ltime = getdate();

    /* draw hour hand */
    pdf_save($pdf);
    pdf_rotate($pdf,-(($ltime['minutes']/60.0)+$ltime['hours']-3.0)*30.0);
    pdf_moveto($pdf, -$radius/10, -$radius/20);
    pdf_lineto($pdf, $radius/2, 0.0);
    pdf_lineto($pdf, -$radius/10, $radius/20);
    pdf_closepath($pdf);
    pdf_fill($pdf);
    pdf_restore($pdf);

    /* draw minute hand */
    pdf_save($pdf);
    pdf_rotate($pdf,-(($ltime['seconds']/60.0)+$ltime['minutes']-15.0)*6.0);
    pdf_moveto($pdf, -$radius/10, -$radius/20);
    pdf_lineto($pdf, $radius * 0.8, 0.0);
    pdf_lineto($pdf, -$radius/10, $radius/20);
    pdf_closepath($pdf);
    pdf_fill($pdf);
    pdf_restore($pdf);

    /* draw second hand */
    pdf_setrgbcolor($pdf, 1.0, 0.0, 0.0);
    pdf_setlinewidth($pdf, 2);
    pdf_save($pdf);
    pdf_rotate($pdf, -(($ltime['seconds'] - 15.0) * 6.0));
    pdf_moveto($pdf, -$radius/5, 0.0);
    pdf_lineto($pdf, $radius, 0.0);
    pdf_stroke($pdf);
    pdf_restore($pdf);

    /* draw little circle at center */
    pdf_circle($pdf, 0, 0, $radius/30);
    pdf_fill($pdf);

    pdf_restore($pdf);

    pdf_end_page($pdf);
}

$pdf = pdf_close($pdf);
fclose($fp);
echo "&lt;A HREF=getpdf.php?filename=".$pdffilename.">finished&lt;/A>";
?>
      </programlisting>
      <simpara>
       The PHP script <filename>getpdf.php</filename> just outputs the pdf document.
      </simpara>
      <programlisting>
&lt;?php
$fp = fopen($filename, "r");
header("Content-type: application/pdf");
fpassthru($fp);
fclose($fp);
?>
      </programlisting>
     </example></para>
   </sect1>
  </partintro>

  <refentry id="function.pdf-set-info">
   <refnamediv>
    <refname>pdf_set_info</refname>
    <refpurpose>Fills a field of the document information</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_set_info</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>fieldname</parameter></paramdef>
      <paramdef>string <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_set_info</function> function sets an information field
     of a pdf document.
     Possible values for the fieldname are 'Subject', 'Title', 'Creator',
     'Author', 'Keywords' and one user-defined name.
     It can be called before beginning a page.

     <example>
      <title>Setting document information</title>
      <programlisting>
&lt;?php 
$fd = fopen("test.pdf", "w");
$pdfdoc = pdf_open($fd);
pdf_set_info($pdfdoc, "Author", "Uwe Steinmann");
pdf_set_info($pdfdoc, "Creator", "Uwe Steinmann");
pdf_set_info($pdfdoc, "Title", "Testing Info Fields");
pdf_set_info($pdfdoc, "Subject", "Test");
pdf_set_info($pdfdoc, "Keywords", "Test, Fields");
pdf_set_info($pdfdoc, "CustomField", "What ever makes sense");
pdf_begin_page($pdfdoc, 595, 842);
pdf_end_page($pdfdoc);
pdf_close($pdfdoc);
?>
</programlisting></example></para>


    <note><simpara>
     This function replaces <function>pdf_set_info_keywords</function>,
              <function>pdf_set_info_title</function>,
              <function>pdf_set_info_subject</function>,
              <function>pdf_set_info_creator</function>,
              <function>pdf_set_info_sybject</function>.
    </simpara></note>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-open">
   <refnamediv>
    <refname>pdf_open</refname>
    <refpurpose>Opens a new pdf document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pdf_open</function></funcdef>
      <paramdef>int <parameter>file</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_open</function> function opens
     a new pdf document. The corresponding file has to be opened
     with <function>fopen</function> and the file descriptor passed
     as argument <parameter>file</parameter>.
     If you do not pass any parameters, the document will be created in memory
     and outputed page by page either to stdout or to the web browser.
    <note><simpara>
     The return value is needed as the first parameter in all other
     functions writing to the pdf document.
    </simpara></note>

    </para>
    <para>
     See also <function>fopen</function>,
              <function>pdf_close</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-close">
   <refnamediv>
    <refname>pdf_close</refname>
    <refpurpose>Closes a pdf document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_close</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_close</function> function closes the pdf document.
    </para>

    <para>
     See also <function>pdf_open</function>,
              <function>fclose</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-begin-page">
   <refnamediv>
    <refname>pdf_begin_page</refname>
    <refpurpose>Starts new page</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_begin_page</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>width</parameter></paramdef>
      <paramdef>double <parameter>height</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_begin_page</function> function starts a new
     page with height <parameter>height</parameter> and width
     <parameter>width</parameter>. In order to create a valid
     document you must call this function and
     <function>pdf_end_page</function> at least once.</para>

    <para>
     See also <function>pdf_end_page</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-end-page">
   <refnamediv>
    <refname>pdf_end_page</refname>
    <refpurpose>Ends a page</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_end_page</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_end_page</function> function ends a page.
     Once a page is ended it cannot be modified anymore.</para>

    <para>
     See also <function>pdf_begin_page</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-show">
   <refnamediv>
    <refname>pdf_show</refname>
    <refpurpose>Output text at current position</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_show</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>text</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_show</function> function outputs the
     string <parameter>text</parameter> at the current text position
     using the current font.</para>

    <para>
     See also <function>pdf_show_xy</function>,
              <function>pdf_show_boxed</function>,
              <function>pdf_set_text_pos</function>,
              <function>pdf_set_font</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-show-boxed">
   <refnamediv>
    <refname>pdf_show_boxed</refname>
    <refpurpose>Output text in a box</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pdf_show_boxed</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>text</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
      <paramdef>double <parameter>width</parameter></paramdef>
      <paramdef>double <parameter>height</parameter></paramdef>
      <paramdef>string <parameter>mode</parameter></paramdef>
      <paramdef>string <parameter><optional>feature</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_show_boxed</function> function outputs the
     string <parameter>text</parameter> in a box with its lower left position
     at (<parameter>x-coor</parameter>, <parameter>y-coor</parameter>).
     The boxes dimension is <parameter>height</parameter> by 
     <parameter>width</parameter>. The parameter <parameter>mode</parameter>
     determines how the text is type set. If <parameter>width</parameter>
     and <parameter>height</parameter> are zero, the
     <parameter>mode</parameter> can be "left", "right" or "center".
     If <parameter>width</parameter> or <parameter>height</parameter> is
     unequal zero it can also be "justify" and "fulljustify".
    </para>
    <para>If the parameter <parameter>feature</parameter> is set to "blind",
     the text is not shown.
    </para>
    <para>Returns the number of characters that could not be processed because
     they did not fit into the box.
    </para>
    <para>
     See also <function>pdf_show</function>,
     <function>pdf_show_xy</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-show-xy">
   <refnamediv>
    <refname>pdf_show_xy</refname>
    <refpurpose>Output text at given position</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_show_xy</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>text</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_show_xy</function> function outputs the
     string <parameter>text</parameter> at position
     (<parameter>x-coor</parameter>, <parameter>y-coor</parameter>).</para>

    <para>
     See also <function>pdf_show</function>,
              <function>pdf_show_boxed</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-set-font">
   <refnamediv>
    <refname>pdf_set_font</refname>
    <refpurpose>Selects a font face and size</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_set_font</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>font name</parameter></paramdef>
      <paramdef>double <parameter>size</parameter></paramdef>
      <paramdef>string <parameter>encoding</parameter></paramdef>
      <paramdef>int <parameter><optional>embed</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_set_font</function> function sets the
     current font face, font size and encoding. If you use pdflib 0.6
     you will need to
     provide the Adobe Font Metrics (afm-files) for the font in the
     font path (default is ./fonts). If you use php3 or a version of
     pdflib older than 2.20 the fourth parameter
     <parameter>encoding</parameter> can take the following values:
     0 = builtin, 1 = pdfdoc, 2 = macroman, 3 = macexpert, 4 = winansi.
     An encoding greater than 4 and less than 0 will default to winansi.
     winansi is often a good choice.
     If you use php4 and a version of pdflib >= 2.20 the encoding parameter
     has changed to a string. Use 'winansi', 'builtin', 'host', 'macroman' etc. 
instead.
     If the last parameter is set to
     1 the font is embedded into the pdf document otherwise it is not.
     To embed a font is usually a good idea if the font is not widely spread
     and you cannot ensure that the person watching your document has
     access on fonts in the document.
     I font is only embedded once even if you call 
     <function>pdf_set_font</function> several times.
    </para>

    <note>
     <simpara>
      This function has to be called after
      <function>pdf_begin_page</function> in order to create a valid
      pdf document.
     </simpara>
    </note>

    <note>
     <simpara>
      If you reference a font in a .upr file make sure the name
      in the afm file and the font name are the same. Otherwise,
      the font will be embedded several times (Thanks to Paul Haddon
      for finding this.)
     </simpara>
    </note>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-set-leading">
   <refnamediv>
    <refname>pdf_set_leading</refname>
    <refpurpose>Sets distance between text lines</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_set_leading</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>distance</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_set_leading</function> function sets the distance
     between text lines. This will be used if text is output by
     <function>pdf_continue_text</function>.</para>

    <para>
     See also <function>pdf_continue_text</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-set-parameter">
   <refnamediv>
    <refname>pdf_set_parameter</refname>
    <refpurpose>Sets certain parameters</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_set_parameter</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>name</parameter></paramdef>
      <paramdef>string <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_set_parameter</function> function sets several
     parameters of pdflib which are of the type string.</para>
    <para>
     See also <function>pdf_get_value</function>,
              <function>pdf_set_value</function>,
              <function>pdf_get_parameter</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-get-parameter">
   <refnamediv>
    <refname>pdf_get_parameter</refname>
    <refpurpose>Gets certain parameters</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>pdf_get_parameter</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>name</parameter></paramdef>
      <paramdef>double <parameter><optional>modifier</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_get_parameter</function> function gets several
     parameters of pdflib which are of the type string. The function parameter
     <parameter>modifier</parameter> characterizes the parameter to get.
     If the modifier is not needed it has to be 0 or not passed at all.</para>
    <para>
     See also <function>pdf_get_value</function>,
              <function>pdf_set_value</function>,
              <function>pdf_set_parameter</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-set-value">
   <refnamediv>
    <refname>pdf_set_value</refname>
    <refpurpose>Sets certain numerical value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_set_value</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>name</parameter></paramdef>
      <paramdef>double <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_set_value</function> function sets several
     numerical parameters of pdflib.</para>
    <para>
     See also <function>pdf_get_value</function>,
              <function>pdf_get_parameter</function>,
              <function>pdf_set_parameter</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-get-value">
   <refnamediv>
    <refname>pdf_get_value</refname>
    <refpurpose>Gets certain numerical value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>double <function>pdf_get_value</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>name</parameter></paramdef>
      <paramdef>double <parameter><optional>modifier</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_get_value</function> function gets several
     numerical parameters of pdflib. The function parameter
     <parameter>modifier</parameter> characterizes the parameter to get.
     If the modifier is not needed it has to be 0 or not passed at all.</para>
    <para>
     See also <function>pdf_set_value</function>,
              <function>pdf_get_parameter</function>,
              <function>pdf_set_parameter</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-get-image-height">
   <refnamediv>
    <refname>pdf_get_image_height</refname>
    <refpurpose>Returns height of an image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>pdf_get_image_height</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>int <parameter>image</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_get_image_height</function> function returns the
     heights of a pdf image in pixel.</para>
    <para>
     See also <function>pdf_open_image_file</function>,
              <function>pdf_open_memory_image</function>,
              <function>pdf_get_image_width</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-get-image-width">
   <refnamediv>
    <refname>pdf_get_image_width</refname>
    <refpurpose>Returns width of an image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>pdf_get_image_width</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>int <parameter>image</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_get_image_width</function> function returns the
     widths of a pdf image in pixel.</para>
    <para>
     See also <function>pdf_open_image_file</function>,
              <function>pdf_open_memory_image</function>,
              <function>pdf_get_image_height</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-set-text-rendering">
   <refnamediv>
    <refname>pdf_set_text_rendering</refname>
    <refpurpose>Determines how text is rendered</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_set_text_rendering</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_set_text_rendering</function> function determines
     how text is rendered. The possible values for <parameter>mode</parameter>
     are 0=fill text, 1=stroke text, 2=fill and stroke text, 3=invisible,
     4=fill text and add it to cliping path, 5=stroke text and add it to
     clipping path, 6=fill and stroke text and add
     it to cliping path, 7=add it to clipping path.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-set-horiz-scaling">
   <refnamediv>
    <refname>pdf_set_horiz_scaling</refname>
    <refpurpose>Sets horizontal scaling of text</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_set_horiz_scaling</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>scale</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_set_horiz_scaling</function> function sets the
     horizontal scaling to <parameter>scale</parameter> percent.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-set-text-rise">
   <refnamediv>
    <refname>pdf_set_text_rise</refname>
    <refpurpose>Sets the text rise</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_set_text_rise</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>rise</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_set_text_rise</function> function sets the
     text rising to <parameter>rise</parameter> points.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-set-text-matrix">
   <refnamediv>
    <refname>pdf_set_text_matrix</refname>
    <refpurpose>Sets the text matrix</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_set_text_matrix</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>array <parameter>matrix</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_set_text_matrix</function> function sets
     a matrix which describes a transformation applied on the current
     text font. The matrix has to passed as an array with six elements.</para>
    <note><simpara>This function is not available anymore since pdflib 2.3
    </simpara></note>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-set-text-pos">
   <refnamediv>
    <refname>pdf_set_text_pos</refname>
    <refpurpose>Sets text position</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_set_text_pos</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_set_text_pos</function> function sets the
     position of text for the next <function>pdf_show</function> 
     function call.</para>
    <para>
     See also <function>pdf_show</function>,
              <function>pdf_show_xy</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-set-char-spacing">
   <refnamediv>
    <refname>pdf_set_char_spacing</refname>
    <refpurpose>Sets character spacing</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_set_char_spacing</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>space</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_set_char_spacing</function> function sets the
     spacing between characters.</para>
    <para>
     See also <function>pdf_set_word_spacing</function>,
              <function>pdf_set_leading</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-set-word-spacing">
   <refnamediv>
    <refname>pdf_set_word_spacing</refname>
    <refpurpose>Sets spacing between words</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_set_word_spacing</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>space</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_set_word_spacing</function> function sets the
     spacing between words.</para>

    <para>
     See also <function>pdf_set_char_spacing</function>,
              <function>pdf_set_leading</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-skew">
   <refnamediv>
    <refname>pdf_skew</refname>
    <refpurpose>Skews the coordinate system</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_skew</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>alpha</parameter></paramdef>
      <paramdef>double <parameter>beta</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_skew</function> function skew the coordinate
     system by <parameter>alpha</parameter> (x) and 
     <parameter>beta</parameter> (y) degrees.
     <parameter>alpha</parameter> and <parameter>beta</parameter> may
     not be 90 or 270 degrees.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-continue-text">
   <refnamediv>
    <refname>pdf_continue_text</refname>
    <refpurpose>Outputs text in next line</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_continue_text</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>text</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_continue_text</function> function outputs the
     string in <parameter>text</parameter> in the next line.
     The distance between the lines can be set with
     <function>pdf_set_leading</function>.</para>

    <para>
     See also <function>pdf_show_xy</function>,
              <function>pdf_set_leading</function>,
              <function>pdf_set_text_pos</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-stringwidth">
   <refnamediv>
    <refname>pdf_stringwidth</refname>
    <refpurpose>Returns width of text using current font</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>double <function>pdf_stringwidth</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>text</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_stringwidth</function> function returns the
     width of the string in <parameter>text</parameter> by using the
     current font. It requires a font to be set before with
     <function>pdf_set_font</function>.</para>

    <para>
     See also <function>pdf_set_font</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-save">
   <refnamediv>
    <refname>pdf_save</refname>
    <refpurpose>Saves the current environment</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_save</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_save</function> function saves the current
     environment. It works like the postscript command gsave. Very
     useful if you want to translate or rotate an object without effecting
     other objects. <function>pdf_save</function> should always be
     followed by <function>pdf_restore</function> to restore the environment
     before <function>pdf_save</function>.</para>

    <para>
     See also <function>pdf_restore</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-restore">
   <refnamediv>
    <refname>pdf_restore</refname>
    <refpurpose>Restores formerly saved environment</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_restore</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_restore</function> function restores the
     environment saved with <function>pdf_save</function>. It works
     like the postscript command grestore.

     <example>
      <title>Save and Restore</title>
      <programlisting>
&lt;?php pdf_save($pdf);
// do all kinds of rotations, transformations, ...
pdf_restore($pdf) ?>
</programlisting></example></para>

    <para>
     See also <function>pdf_save</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-translate">
   <refnamediv>
    <refname>pdf_translate</refname>
    <refpurpose>Sets origin of coordinate system</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_translate</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_translate</function> function sets the origin of
     coordinate system to the point (<parameter>x-coor</parameter>,
     <parameter>y-coor</parameter>) relativ the current origin.
     The following example draws
     a line from (0, 0) to (200, 200) relative to the initial coordinate
     system. You have to set the current point after
     <function>pdf_translate</function> and before you start drawing
     more objects.

     <example>
      <title>Translation</title>
      <programlisting>
&lt;?php pdf_moveto($pdf, 0, 0);
pdf_lineto($pdf, 100, 100);
pdf_stroke($pdf);
pdf_translate($pdf, 100, 100);
pdf_moveto($pdf, 0, 0);
pdf_lineto($pdf, 100, 100);
pdf_stroke($pdf);
?>
</programlisting></example></para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-scale">
   <refnamediv>
    <refname>pdf_scale</refname>
    <refpurpose>Sets scaling</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_scale</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>x-scale</parameter></paramdef>
      <paramdef>double <parameter>y-scale</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_scale</function> function sets the scaling factor
     in both directions. The following example scales x and y direction
     by 72. The following line will therefore be drawn one inch in both
     directions.

     <example>
      <title>Scaling</title>
      <programlisting>
&lt;?php pdf_scale($pdf, 72.0, 72.0);
pdf_lineto($pdf, 1, 1);
pdf_stroke($pdf);
?>
</programlisting></example></para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-rotate">
   <refnamediv>
    <refname>pdf_rotate</refname>
    <refpurpose>Sets rotation</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_rotate</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>angle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_rotate</function> function sets the rotation in
     degress to <parameter>angle</parameter>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-setflat">
   <refnamediv>
    <refname>pdf_setflat</refname>
    <refpurpose>Sets flatness</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_setflat</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_setflat</function> function sets the flatness to
     a value between 0 and 100.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-setlinejoin">
   <refnamediv>
    <refname>pdf_setlinejoin</refname>
    <refpurpose>Sets linejoin parameter</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_setlinejoin</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>long <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_setlinejoin</function> function sets the linejoin
     parameter between a value of 0 and 2.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-setlinecap">
   <refnamediv>
    <refname>pdf_setlinecap</refname>
    <refpurpose>Sets linecap parameter</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_setlinecap</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>int <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_setlinecap</function> function sets the linecap
     parameter between a value of 0 and 2.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-setmiterlimit">
   <refnamediv>
    <refname>pdf_setmiterlimit</refname>
    <refpurpose>Sets miter limit</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_setmiterlimit</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_setmiterlimit</function> function sets the miter limit
     to a value greater of equal than 1.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-setlinewidth">
   <refnamediv>
    <refname>pdf_setlinewidth</refname>
    <refpurpose>Sets line width</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_setlinewidth</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>width</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_setlinewidth</function> function sets the line width
     to <parameter>width</parameter>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-setdash">
   <refnamediv>
    <refname>pdf_setdash</refname>
    <refpurpose>Sets dash pattern</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_setdash</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>white</parameter></paramdef>
      <paramdef>double <parameter>black</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_setdash</function> function sets the dash pattern
     <parameter>white</parameter> white points and <parameter>black</parameter>
     black points. If both are 0 a solid line is set.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-moveto">
   <refnamediv>
    <refname>pdf_moveto</refname>
    <refpurpose>Sets current point</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_moveto</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_moveto</function> function sets the current point
     to the coordinates <parameter>x-coor</parameter> and
     <parameter>y-coor</parameter>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-curveto">
   <refnamediv>
    <refname>pdf_curveto</refname>
    <refpurpose>Draws a curve</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_curveto</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>x1</parameter></paramdef>
      <paramdef>double <parameter>y1</parameter></paramdef>
      <paramdef>double <parameter>x2</parameter></paramdef>
      <paramdef>double <parameter>y2</parameter></paramdef>
      <paramdef>double <parameter>x3</parameter></paramdef>
      <paramdef>double <parameter>y3</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_curveto</function> function draws a Bezier curve
     from the current point to the point
     (<parameter>x3</parameter>, <parameter>y3</parameter>) using
     (<parameter>x1</parameter>, <parameter>y1</parameter>) and
     (<parameter>x2</parameter>, <parameter>y2</parameter>) as control
     points.</para>

    <para>
     See also <function>pdf_moveto</function>,
              <function>pdf_lineto</function>,
              <function>pdf_stroke</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-lineto">
   <refnamediv>
    <refname>pdf_lineto</refname>
    <refpurpose>Draws a line</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_lineto</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_lineto</function> function draws a line from
     the current point to the point with coordinates
     (<parameter>x-coor</parameter>, <parameter>y-coor</parameter>).</para>

    <para>
     See also <function>pdf_moveto</function>,
              <function>pdf_curveto</function>,
              <function>pdf_stroke</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-circle">
   <refnamediv>
    <refname>pdf_circle</refname>
    <refpurpose>Draws a circle</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_circle</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
      <paramdef>double <parameter>radius</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_circle</function> function draws a circle with
     center at point 
     (<parameter>x-coor</parameter>, <parameter>y-coor</parameter>)
     and radius <parameter>radius</parameter>.</para>

    <para>
     See also <function>pdf_arc</function>,
              <function>pdf_stroke</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-arc">
   <refnamediv>
    <refname>pdf_arc</refname>
    <refpurpose>Draws an arc</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_arc</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
      <paramdef>double <parameter>radius</parameter></paramdef>
      <paramdef>double <parameter>start</parameter></paramdef>
      <paramdef>double <parameter>end</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_arc</function> function draws an arc with
     center at point 
     (<parameter>x-coor</parameter>, <parameter>y-coor</parameter>)
     and radius <parameter>radius</parameter>, starting at angle
     <parameter>start</parameter> and ending at angle
     <parameter>end</parameter>.</para>

    <para>
     See also <function>pdf_circle</function>,
              <function>pdf_stroke</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-rect">
   <refnamediv>
    <refname>pdf_rect</refname>
    <refpurpose>Draws a rectangle</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_rect</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
      <paramdef>double <parameter>width</parameter></paramdef>
      <paramdef>double <parameter>height</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_rect</function> function draws a rectangle with
     its lower left corner at point 
     (<parameter>x-coor</parameter>, <parameter>y-coor</parameter>).
     This width is set to <parameter>width</parameter>.
     This height is set to <parameter>height</parameter>.</para>

    <para>
     See also <function>pdf_stroke</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-closepath">
   <refnamediv>
    <refname>pdf_closepath</refname>
    <refpurpose>Closes path</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_closepath</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_closepath</function> function closes the
     current path. This means, it draws a line from current point to
     the point where the first line was started. Many functions like
     <function>pdf_moveto</function>, <function>pdf_circle</function>
     and <function>pdf_rect</function> start a new path.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-stroke">
   <refnamediv>
    <refname>pdf_stroke</refname>
    <refpurpose>Draws line along path</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_stroke</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_stroke</function> function draws a line along
     current path. The current path is the sum of all line drawing.
     Without this function the line would not be drawn.</para>

    <para>
     See also <function>pdf_closepath</function>,
              <function>pdf_closepath_stroke</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-closepath-stroke">
   <refnamediv>
    <refname>pdf_closepath_stroke</refname>
    <refpurpose>Closes path and draws line along path</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_closepath_stroke</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_closepath_stroke</function> function is a
     combination of <function>pdf_closepath</function> and
     <function>pdf_stroke</function>. It also clears the path.</para>

    <para>
     See also <function>pdf_closepath</function>,
              <function>pdf_stroke</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-fill">
   <refnamediv>
    <refname>pdf_fill</refname>
    <refpurpose>Fills current path</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_fill</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_fill</function> function fills the interior of
     the current path with the current fill color.</para>

    <para>
     See also <function>pdf_closepath</function>,
              <function>pdf_stroke</function>,
              <function>pdf_setgray_fill</function>,
              <function>pdf_setgray</function>,
              <function>pdf_setrgbcolor_fill</function>,
              <function>pdf_setrgbcolor</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-fill-stroke">
   <refnamediv>
    <refname>pdf_fill_stroke</refname>
    <refpurpose>Fills and strokes current path</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_fill_stroke</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_fill_stroke</function> function fills the interior of
     the current path with the current fill color and draws current path.</para>

    <para>
     See also <function>pdf_closepath</function>,
              <function>pdf_stroke</function>,
              <function>pdf_fill</function>,
              <function>pdf_setgray_fill</function>,
              <function>pdf_setgray</function>,
              <function>pdf_setrgbcolor_fill</function>,
              <function>pdf_setrgbcolor</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-closepath-fill-stroke">
   <refnamediv>
    <refname>pdf_closepath_fill_stroke</refname>
    <refpurpose>Closes, fills and strokes current path</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_closepath_fill_stroke</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_closepath_fill_stroke</function> function closes,
     fills the interior of
     the current path with the current fill color and draws current path.</para>

    <para>
     See also <function>pdf_closepath</function>,
              <function>pdf_stroke</function>,
              <function>pdf_fill</function>,
              <function>pdf_setgray_fill</function>,
              <function>pdf_setgray</function>,
              <function>pdf_setrgbcolor_fill</function>,
              <function>pdf_setrgbcolor</function>.</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-endpath">
   <refnamediv>
    <refname>pdf_endpath</refname>
    <refpurpose>Ends current path</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_endpath</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_endpath</function> function ends
     the current path but does not close it.</para>

    <para>
     See also <function>pdf_closepath</function>.</para>

   </refsect1>
  </refentry>
  
  <refentry id="function.pdf-clip">
   <refnamediv>
    <refname>pdf_clip</refname>
    <refpurpose>Clips to current path</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_clip</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_clip</function> function clips all drawing
     to the current path.</para>

   </refsect1>
  </refentry>
  
  <refentry id="function.pdf-setgray-fill">
   <refnamediv>
    <refname>pdf_setgray_fill</refname>
    <refpurpose>Sets filling color to gray value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_setgray_fill</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>gray value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_setgray_fill</function> function sets the current
     gray value to fill a path.</para>

    <para>
     See also <function>pdf_setrgbcolor_fill</function>.</para>

   </refsect1>
  </refentry>
  
  <refentry id="function.pdf-setgray-stroke">
   <refnamediv>
    <refname>pdf_setgray_stroke</refname>
    <refpurpose>Sets drawing color to gray value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_setgray_stroke</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>gray value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_setgray_stroke</function> function sets the current
     drawing color to the given gray value.</para>

    <para>
     See also <function>pdf_setrgbcolor_stroke</function>.</para>

   </refsect1>
  </refentry>
  
  <refentry id="function.pdf-setgray">
   <refnamediv>
    <refname>pdf_setgray</refname>
    <refpurpose>Sets drawing and filling color to gray value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_setgray</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>gray value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_setgray</function> function sets the current
     drawing and filling color to the given gray value.</para>

    <para>
     See also <function>pdf_setrgbcolor_stroke</function>,
              <function>pdf_setrgbcolor_fill</function>.</para>

   </refsect1>
  </refentry>
  
  <refentry id="function.pdf-setrgbcolor-fill">
   <refnamediv>
    <refname>pdf_setrgbcolor_fill</refname>
    <refpurpose>Sets filling color to rgb color value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_setrgbcolor_fill</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>red value</parameter></paramdef>
      <paramdef>double <parameter>green value</parameter></paramdef>
      <paramdef>double <parameter>blue value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_setrgbcolor_fill</function> function sets the current
     rgb color value to fill a path.</para>

    <para>
     See also <function>pdf_setrgbcolor_fill</function>.</para>

   </refsect1>
  </refentry>
  
  <refentry id="function.pdf-setrgbcolor-stroke">
   <refnamediv>
    <refname>pdf_setrgbcolor_stroke</refname>
    <refpurpose>Sets drawing color to rgb color value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_setrgbcolor_stroke</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>red value</parameter></paramdef>
      <paramdef>double <parameter>green value</parameter></paramdef>
      <paramdef>double <parameter>blue value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_setrgbcolor_stroke</function> function sets the current
     drawing color to the given rgb color value.</para>

    <para>
     See also <function>pdf_setrgbcolor_stroke</function>.</para>

   </refsect1>
  </refentry>
  
  <refentry id="function.pdf-setrgbcolor">
   <refnamediv>
    <refname>pdf_setrgbcolor</refname>
    <refpurpose>Sets drawing and filling color to rgb color value</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_setrgbcolor</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>red value</parameter></paramdef>
      <paramdef>double <parameter>green value</parameter></paramdef>
      <paramdef>double <parameter>blue value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_setrgbcolor_stroke</function> function sets the current
     drawing and filling color to the given rgb color value.</para>

    <para>
     See also <function>pdf_setrgbcolor_stroke</function>,
              <function>pdf_setrgbcolor_fill</function>.</para>

   </refsect1>
  </refentry>
  
  <refentry id="function.pdf-add-outline">
   <refnamediv>
    <refname>pdf_add_outline</refname>
    <refpurpose>Adds bookmark for current page</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pdf_add_outline</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>text</parameter></paramdef>
      <paramdef>int <parameter><optional>parent</optional></parameter></paramdef>
      <paramdef>int <parameter><optional>open</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_add_outline</function> function adds a bookmark
     with text <parameter>text</parameter> that points to the current page.
     The bookmark is inserted as a child of <parameter>parent</parameter> and
     is by default open if <parameter>open</parameter> is not 0. The
     return value is an identifier for the bookmark which can be used
     as a parent for other bookmarks. Therefore you can build up hierarchies
     of bookmarks.
    </para>
    <simpara>
     Unfortunately pdflib does not make a copy of the string, which forces
     PHP to allocate the memory. Currently this piece of memory is not
     been freed by any PDF function but it will be taken care of by the
     PHP memory manager.</simpara>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-set-transition">
   <refnamediv>
    <refname>pdf_set_transition</refname>
    <refpurpose>Sets transition between pages</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_set_transition</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>int <parameter>transition</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_set_transition</function> function set the transition
     between following pages. The value of <parameter>transition</parameter>
     can be

     <simplelist>
      <member>
        0 for none,
      </member>
      <member>
        1 for two lines sweeping across the screen reveal the page,
      </member>
      <member>
        2 for multiple lines sweeping across the screen reveal the page,
      </member>
      <member>
        3 for a box reveals the page,
      </member>
      <member>
        4 for a single line sweeping across the screen reveals the page,
      </member>
      <member>
        5 for the old page dissolves to reveal the page,
      </member>
      <member>
        6 for the dissolve effect moves from one screen edge to another,
      </member>
      <member>
        7 for the old page is simply replaced by the new page (default)
      </member>
     </simplelist></para>
    <para>
     See also <function>pdf_set_duration</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-set-duration">
   <refnamediv>
    <refname>pdf_set_duration</refname>
    <refpurpose>Sets duration between pages</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_set_duration</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>duration</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_set_duration</function> function set the duration
     between following pages in seconds.</para>
    <para>
     See also <function>pdf_set_transition</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-open-gif">
   <refnamediv>
    <refname>pdf_open_gif</refname>
    <refpurpose>Opens a GIF image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pdf_open_gif</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_open_gif</function> function opens an image stored
     in the file with the name <parameter>filename</parameter>.
     The format of the image has to be gif. The function returns a pdf
     image identifier.
     <note><simpara>This function shouldn't be used anymore. Please use
     the function <function>pdf_open_image_file</function> instead.
     </simpara></note>

     <example>
      <title>Including a gif image</title>
      <programlisting>
&lt;?php
$im = pdf_open_gif($pdf, "test.gif");
pdf_place_image($pdf, $im, 100, 100, 1);
pdf_close_image($pdf, $im);
?>
      </programlisting>
     </example></para>

    <para>
     See also <function>pdf_close_image</function>,
              <function>pdf_open_jpeg</function>,
              <function>pdf_open_memory_image</function>,
              <function>pdf_execute_image</function>,
              <function>pdf_place_image</function>,
              <function>pdf_put_image</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-open-png">
    <refnamediv>
      <refname>pdf_open_png</refname>
      <refpurpose>
        Opens a PNG image
      </refpurpose>
    </refnamediv>
    <refsect1>
      <title>Description</title>
      <funcsynopsis>
     <funcprototype>
         <funcdef>int 
           <function>pdf_open_png</function>
         </funcdef>
         <paramdef>int 
           <parameter>pdf</parameter>
         </paramdef>
         <paramdef>string 
           <parameter>png_file</parameter>
         </paramdef>
     </funcprototype>
      </funcsynopsis>
      <para>    
        The <function>pdf_open_png</function> function opens an image stored
        in the file with the name <parameter>filename</parameter>.
        The format of the image has to be png. The function returns a pdf
        image identifier.
     <note><simpara>This function shouldn't be used anymore. Please use
     the function <function>pdf_open_image_file</function> instead.
     </simpara></note>
        <example>
          <title>Including a PNG image</title>
          <programlisting>
&lt;?php
$im = pdf_open_png ($pdf, "test.png");
pdf_place_image ($pdf, $im, 100, 100, 1);
pdf_close_image ($pdf, $im);
?>
          </programlisting>
        </example>
      </para>
      <para>
        See also <function>pdf_close_image</function>,
                 <function>pdf_open_jpeg</function>,
                 <function>pdf_open_gif</function>,
                 <function>pdf_open_memory_image</function>,
                 <function>pdf_execute_image</function>,
                 <function>pdf_place_image</function>,
                 <function>pdf_put_image</function>.
      </para>
    </refsect1>
  </refentry>
  
  <refentry id="function.pdf-open-image-file">
   <refnamediv>
    <refname>pdf_open_image_file</refname>
    <refpurpose>Reads an image from a file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pdf_open_image_file</function></funcdef>
      <paramdef>int <parameter>PDF-document</parameter></paramdef>
      <paramdef>string <parameter>format</parameter></paramdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The function <function>pdf_open_image_file</function> reads an image
     of format <parameter>format</parameter> from the file
     <parameter>filename</parameter>.
     Possible formats are 'png', 'tiff', 'jpeg' and 'gif'.
     The function returns a pdf image identifier.
     <example>
      <title>Inserting an image</title>
      <programlisting>
&lt;?php
$pim = pdf_open_image_file($pdf, "png", "picture.png");
pdf_place_image($pdf, $pim, 100, 100, 1);
pdf_close_image($pdf, $pim);
?>
     </programlisting>
    </example></para>

    <para>
     See also <function>pdf_close_image</function>,
              <function>pdf_open_jpeg</function>,
              <function>pdf_open_gif</function>,
              <function>pdf_open_tiff</function>,
              <function>pdf_open_png</function>,
              <function>pdf_execute_image</function>,
              <function>pdf_place_image</function>,
              <function>pdf_put_image</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-open-memory-image">
   <refnamediv>
    <refname>pdf_open_memory_image</refname>
    <refpurpose>Opens an image created with PHP's image functions</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pdf_open_memory_image</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>int <parameter>image</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_open_memory_image</function> function takes
     an image created with the PHP's image functions and makes it available
     for the pdf document. The function returns a pdf
     image identifier.

     <example>
      <title>Including a memory image</title>
      <programlisting>
&lt;?php
$im = ImageCreate(100, 100);
$col = ImageColorAllocate($im, 80, 45, 190);
ImageFill($im, 10, 10, $col);
$pim = pdf_open_memory_image($pdf, $im);
ImageDestroy($im);
pdf_place_image($pdf, $pim, 100, 100, 1);
pdf_close_image($pdf, $pim);
?>
     </programlisting>
    </example></para>

    <para>
     See also <function>pdf_close_image</function>,
              <function>pdf_open_jpeg</function>,
              <function>pdf_open_gif</function>,
              <function>pdf_open_png</function>
              <function>pdf_execute_image</function>,
              <function>pdf_place_image</function>,
              <function>pdf_put_image</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-open-jpeg">
   <refnamediv>
    <refname>pdf_open_jpeg</refname>
    <refpurpose>Opens a JPEG image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pdf_open_jpeg</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_open_jpeg</function> function opens an image stored
     in the file with the name <parameter>filename</parameter>.
     The format of the image has to be jpeg. The function returns a pdf
     image identifier.
     <note><simpara>This function shouldn't be used anymore. Please use
     the function <function>pdf_open_image_file</function> instead.
     </simpara></note></para>
    <para>
     See also <function>pdf_close_image</function>,
              <function>pdf_open_gif</function>,
              <function>pdf_open_png</function>,
              <function>pdf_open_memory_image</function>,
              <function>pdf_execute_image</function>,
              <function>pdf_place_image</function>,
              <function>pdf_put_image</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-open-tiff">
   <refnamediv>
    <refname>pdf_open_tiff</refname>
    <refpurpose>Opens a TIFF image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pdf_open_tiff</function></funcdef>
      <paramdef>int <parameter>PDF-document</parameter></paramdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_open_tiff</function> function opens an image stored
     in the file with the name <parameter>filename</parameter>.
     The format of the image has to be tiff. The function returns a pdf
     image identifier.
     <note><simpara>This function shouldn't be used anymore. Please use
     the function <function>pdf_open_image_file</function> instead.
     </simpara></note>
    </para>
    <para>
     See also <function>pdf_close_image</function>,
              <function>pdf_open_gif</function>,
              <function>pdf_open_jpeg</function>,
              <function>pdf_open_png</function>,
              <function>pdf_open_memory_image</function>,
              <function>pdf_execute_image</function>,
              <function>pdf_place_image</function>,
              <function>pdf_put_image</function>.
    </para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-close-image">
   <refnamediv>
    <refname>pdf_close_image</refname>
    <refpurpose>Closes an image</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_close_image</function></funcdef>
      <paramdef>int <parameter>image</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_close_image</function> function closes an image
     which has been opened with any of the <function>pdf_open_xxx</function>
     functions.</para> 
    <para>
     See also <function>pdf_open_jpeg</function>,
              <function>pdf_open_gif</function>,
              <function>pdf_open_memory_image</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-place-image">
   <refnamediv>
    <refname>pdf_place_image</refname>
    <refpurpose>Places an image on the page</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_place_image</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>int <parameter>image</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
      <paramdef>double <parameter>scale</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_place_image</function> function places an image
     on the page at postion (<parameter>x-coor</parameter>,
     <parameter>x-coor</parameter>). The image can be scaled at the same
     time.
    </para>
    <para>
     See also <function>pdf_put_image</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-put-image">
   <refnamediv>
    <refname>pdf_put_image</refname>
    <refpurpose>Stores an image in the PDF for later use</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_put_image</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>int <parameter>image</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_put_image</function> function places an image
     in the PDF file without showing it. The stored image can be
     displayed with the <function>pdf_execute_image</function>
     function as many times as needed. This is useful when using the same
     image multiple times in order to keep the file size small. Using
     <function>pdf_put_image</function> and
     <function>pdf_execute_image</function> is highly recommended for
     larger images (several kb) if they show up more than once in the
     document.
    <note><simpara>This function has become meaningless with version
     2.01 of pdflib. It will just output a warning.</simpara>
     </note></para>
    <para>
     See also <function>pdf_put_image</function>,
              <function>pdf_place_image</function>,
              <function>pdf_execute_image</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-execute-image">
   <refnamediv>
    <refname>pdf_execute_image</refname>
    <refpurpose>Places a stored image on the page</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_execute_image</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>int <parameter>image</parameter></paramdef>
      <paramdef>double <parameter>x-coor</parameter></paramdef>
      <paramdef>double <parameter>y-coor</parameter></paramdef>
      <paramdef>double <parameter>scale</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_execute_image</function> function displays an image that has 
been
     put in the PDF file with the <function>pdf_put_image</function>
     function on the current page at the given coordinates.</para>
    <para>
     The image can be scaled while displaying it. A scale of 1.0
     will show the image in the original size.
    <note><simpara>This function has become meaningless with version
     2.01 of pdflib. It will just output a warning.</simpara>
     </note>

     <example>
      <title>Multiple show of an image</title>
      <programlisting>
&lt;?php
$im = ImageCreate(100, 100);
$col1 = ImageColorAllocate($im, 80, 45, 190);
ImageFill($im, 10, 10, $col1);
$pim = pdf_open_memory_image($pdf, $im);
pdf_put_image($pdf, $pim);
pdf_execute_image($pdf, $pim, 100, 100, 1);
pdf_execute_image($pdf, $pim, 200, 200, 2);
pdf_close_image($pdf, $pim);
?>
     </programlisting>
    </example></para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-add-annotation">
   <refnamediv>
    <refname>pdf_add_annotation</refname>
    <refpurpose>Adds annotation</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_add_annotation</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>llx</parameter></paramdef>
      <paramdef>double <parameter>lly</parameter></paramdef>
      <paramdef>double <parameter>urx</parameter></paramdef>
      <paramdef>double <parameter>ury</parameter></paramdef>
      <paramdef>string <parameter>title</parameter></paramdef>
      <paramdef>string <parameter>content</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_add_annotation</function> adds a note with
     the lower left corner at (<parameter>llx</parameter>,
     <parameter>lly</parameter>) and the upper right corner at
     (<parameter>urx</parameter>, <parameter>ury</parameter>).</para>

   </refsect1>
  </refentry>

  <refentry id="function.pdf-set-border-style">
   <refnamediv>
    <refname>pdf_set_border_style</refname>
    <refpurpose>Sets style of border around links and annotations</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_set_border_style</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>string <parameter>style</parameter></paramdef>
      <paramdef>double <parameter>width</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_set_border_style</function> function sets the
     style and width of the suroundig box of links and annotations.
     The parameter <parameter>style</parameter> can be 'solid' or
     'dashed'.</para>
    <para>
     See also <function>pdf_set_border_color</function>,
              <function>pdf_set_border_dash</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-set-border-color">
   <refnamediv>
    <refname>pdf_set_border_color</refname>
    <refpurpose>Sets color of border around links and annotations</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_set_border_color</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>red</parameter></paramdef>
      <paramdef>double <parameter>green</parameter></paramdef>
      <paramdef>double <parameter>blue</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_set_border_color</function> function sets the
     color of the suroundig box of links and annotations.
     The three color components have to have a value between 0.0 and
     1.0.</para>
    <para>
     See also <function>pdf_set_border_style</function>,
              <function>pdf_set_border_dash</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.pdf-set-border-dash">
   <refnamediv>
    <refname>pdf_set_border_dash</refname>
    <refpurpose>Sets dash style of border around links and annotations</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pdf_set_border_dash</function></funcdef>
      <paramdef>int <parameter>pdf document</parameter></paramdef>
      <paramdef>double <parameter>black</parameter></paramdef>
      <paramdef>double <parameter>white</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>pdf_set_border_dash</function> function sets the
     lenght of
     black and white areas of a dashed line of the suroundig box of
     links and annotations.</para>
    <para>
     See also <function>pdf_set_border_style</function>,
              <function>pdf_set_border_color</function>.</para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/pfpro.xml
+++ phpdoc/kr/functions/pfpro.xml
 <reference id="ref.pfpro">
  <title>Verisign Payflow Pro functions</title>
  <titleabbrev>Verisign Payflow Pro</titleabbrev>
  <partintro>
   <simpara>
    This extension allows you to process credit cards and other financial
    transactions using Verisign Payment Services, formerly known as Signio
    (<ulink url="&url.pfpro;">&url.pfpro;</ulink>).
   </simpara>
   <simpara>
    These functions are only available if PHP has been compiled with the
    <option role="configure">--with-pfpro[=DIR]</option> option. You will
    require the appropriate SDK for your platform, which may be
    downloaded <ulink url="&url.pfpro.download;">from within the manager
    interface</ulink> once you have registered.
   </simpara>
   <simpara>
    Once you have downloaded the SDK you should copy the files from
    the <filename class="directory">lib</filename> directory of the
    distribution. Copy the header file <filename>pfpro.h</filename>
    to <filename class="directory">/usr/local/include</filename>
    and the library file <filename>libpfpro.so</filename> to
    <filename class="directory">/usr/local/lib</filename>.
   </simpara>
   <simpara>
    When using these functions, you may omit calls to
    <function>pfpro_init</function> and <function>pfpro_cleanup</function>
    as this extension will do so automatically if required. However the
    functions are still available in case you are processing a number of
    transactions and require fine control over the library.
    You may perform any number
    of transactions using <function>pfpro_process</function> between the two.
   </simpara>
   <simpara>
    These functions have been added in PHP 4.0.2.
   </simpara>

   <note><para>
    These functions only provide a link to Verisign Payment Services. Be sure
    to read the Payflow Pro Developers Guide for full details of the required
    parameters.
   </para></note>
  </partintro>

  <refentry id="function.pfpro-init">
   <refnamediv>
    <refname>pfpro_init</refname> 
    <refpurpose>Initialises the Payflow Pro library</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pfpro_init</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>pfpro_init</function> is used to initialise
     the Payflow Pro library. You may omit this call, in which case
     this extension will automatically call <function>pfpro_init</function>
     before the first transaction.
    </para>
    <para> 
     See also <function>pfpro_cleanup</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pfpro-cleanup">
   <refnamediv>
    <refname>pfpro_cleanup</refname> 
    <refpurpose>Shuts down the Payflow Pro library</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pfpro_cleanup</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>pfpro_cleanup</function> is used to shutdown the
     Payflow Pro library cleanly. It should be called after you
     have processed any transactions and before the end of your script.
     However you may omit this call, in which case this
     extension will automatically call <function>pfpro_cleanup</function>
     after your script terminates.
    </para>
    <para> 
     See also <function>pfpro_init</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pfpro-process">
   <refnamediv>
    <refname>pfpro_process</refname>
    <refpurpose>Process a transaction with Payflow Pro</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>pfpro_process</function></funcdef>
      <paramdef>array <parameter>parameters</parameter></paramdef>

      <paramdef>string
       <parameter><optional>address</optional></parameter>
      </paramdef>
      <paramdef>int
       <parameter><optional>port</optional></parameter>
      </paramdef>
      <paramdef>int
       <parameter><optional>timeout</optional></parameter>
      </paramdef>
      <paramdef>string
       <parameter><optional>proxy address</optional></parameter>
      </paramdef>
      <paramdef>int
       <parameter><optional>proxy port</optional></parameter>
      </paramdef>
      <paramdef>string
       <parameter><optional>proxy logon</optional></parameter>
      </paramdef>
      <paramdef>string
       <parameter><optional>proxy password</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns: An associative array containing the response
    </para>
    <para> 
     <function>pfpro_process</function> processes a transaction
     with Payflow Pro. The first parameter is an associative
     array containing keys and values that will be encoded and
     passed to the processor.
    </para>
    <para>
     The second parameter is optional and specifies the host
     to connect to. By default this is "test.signio.com", so
     you will certainly want to change this to "connect.signio.com"
     in order to process live transactions.
    </para>
    <para>
     The third parameter specifies the port to connect on. It
     defaults to 443, the standard SSL port.
    </para>
    <para>
     The fourth parameter specifies the timeout to be used, in seconds.
     This defaults to 30 seconds. Note that this timeout appears to only
     begin once a link to the processor has been established and so your
     script could potentially continue for a very long time in the event
     of DNS or network problems.
    </para>
    <para>
     The fifth parameter, if required, specifies the hostname of your
     SSL proxy. The sixth parameter specifies the port to use.
    </para>
    <para>
     The seventh and eighth parameters specify the logon identity
     and password to use on the proxy.
    </para>
    <para>
     The function returns an associative array of the keys and values
     in the response.
    </para>

    <note><para>
     Be sure to read the Payflow Pro Developers Guide for full details
     of the required parameters.
    </para></note>

    <example>
     <title>Payflow Pro example</title>
     <programlisting role="php">
&lt;?php

pfpro_init();

$transaction = array(USER       => 'mylogin',
                     PWD        => 'mypassword',
                     TRXTYPE    => 'S',
                     TENDER     => 'C',
                     AMT        => 1.50,
                     ACCT       => '4111111111111111',
                     EXPDATE    => '0904'
                     );

$response = pfpro_process($transaction);

if (!$response) {
  die("Couldn't establish link to Verisign.\n");
}

echo "Verisign response code was ".$response[RESULT];
echo ", which means: ".$response[RESPMSG]."\n";

echo "\nThe transaction request: ";
print_r($transaction);

echo "\nThe response: ";
print_r($response);

pfpro_cleanup();

?>
     </programlisting>
    </example>
   </refsect1>
  </refentry>



  <refentry id="function.pfpro-process-raw">
   <refnamediv>
    <refname>pfpro_process_raw</refname>
    <refpurpose>Process a raw transaction with Payflow Pro</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>pfpro_process_raw</function></funcdef>
      <paramdef>string <parameter>parameters</parameter></paramdef>
      <paramdef>string
       <parameter><optional>address</optional></parameter>
      </paramdef>
      <paramdef>int
       <parameter><optional>port</optional></parameter>
      </paramdef>
      <paramdef>int
       <parameter><optional>timeout</optional></parameter>
      </paramdef>
      <paramdef>string
       <parameter><optional>proxy address</optional></parameter>
      </paramdef>
      <paramdef>int
       <parameter><optional>proxy port</optional></parameter>
      </paramdef>
      <paramdef>string
       <parameter><optional>proxy logon</optional></parameter>
      </paramdef>
      <paramdef>string
       <parameter><optional>proxy password</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns: A string containing the response.
    </para>
    <para> 
     <function>pfpro_process_raw</function> processes a raw transaction
     string with Payflow Pro. You should really use
     <function>pfpro_process</function> instead, as the encoding
     rules of these transactions are non-standard.
    </para>
    <para>
     The first parameter in this case is a string containing the raw
     transaction request. All other parameters are the same as with
     <function>pfpro_process</function>. The return value is a string
     containing the raw response.
    </para>

    <note><para>
     Be sure to read the Payflow Pro Developers Guide for full details
     of the required parameters and encoding rules. You would be
     well advised to use <function>pfpro_process</function> instead.
    </para></note>

    <example>
     <title>Payflow Pro raw example</title>
     <programlisting role="php">
&lt;?php

pfpro_init();

$response = 
pfpro_process("USER=mylogin&amp;PWD[5]=m&amp;ndy&amp;TRXTYPE=S&amp;TENDER=C&amp;AMT=1.50&amp;ACCT=4111111111111111&amp;EXPDATE=0904");

if (!$response) {
  die("Couldn't establish link to Verisign.\n");
}

echo "Verisign raw response was ".$response;

pfpro_cleanup();

?>
     </programlisting>
    </example>
   </refsect1>
  </refentry>


  <refentry id="function.pfpro-version">
   <refnamediv>
    <refname>pfpro_version</refname>
    <refpurpose>Returns the version of the Payflow Pro software</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>pfpro_version</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>pfpro_version</function> returns the version string
     of the Payflow Pro library. At the time of writing, this was L211.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/pgsql.xml
+++ phpdoc/kr/functions/pgsql.xml
 <reference id="ref.pgsql">
  <title>PostgreSQL functions</title>
  <titleabbrev>PostgreSQL</titleabbrev>

  <partintro>
   <para>
    Postgres, developed originally in the UC Berkeley Computer Science 
    Department, pioneered many of the object-relational concepts now
    becoming available in some commercial databases.  It provides
    SQL92/SQL3 language support, transaction integrity, and type
    extensibility.  PostgreSQL is an open source descendant of this
    original Berkeley code.
   </para>
   <para>
    PostgreSQL is available without cost. The current version is
    available at <ulink url="&url.pgsql;">www.PostgreSQL.org</ulink>.
   </para>
   <para>
    Since version 6.3 (03/02/1998) PostgreSQL uses unix domain sockets.
    A table is shown below describing these new connection possibilities.
    This socket will be found in <filename>/tmp/.s.PGSQL.5432</filename>.
    This option can be enabled with the '-i' flag to <command>postmaster
    </command> and it's meaning is: "listen on TCP/IP sockets as well as
    Unix domain sockets".
    <table>
     <title>Postmaster and PHP</title>
     <tgroup cols="3">
      <thead>
       <row>
        <entry>Postmaster</entry>
        <entry>PHP</entry>
        <entry>Status</entry>
       </row>
      </thead>
      <tbody>
       <row>
        <entry>postmaster &amp;</entry>
        <entry>pg_connect("dbname=MyDbName");</entry>
        <entry>OK</entry>
       </row>
       <row>
        <entry>postmaster -i &amp;</entry>
        <entry>pg_connect("dbname=MyDbName");</entry>
        <entry>OK</entry>
       </row>
       <row>
        <entry>postmaster &amp;</entry>
        <entry>pg_connect("host=localhost dbname=MyDbName");</entry>
        <entry>
         Unable to connect to PostgreSQL server: connectDB() failed:
         Is the postmaster running and accepting TCP/IP (with -i)
         connection at 'localhost' on port '5432'? in
         /path/to/file.php3 on line 20.
        </entry>
       </row>
       <row>
        <entry>postmaster -i &amp;</entry>
        <entry>pg_connect("host=localhost dbname=MyDbName");</entry>
        <entry>OK</entry>
       </row>
      </tbody>
     </tgroup>
    </table>
   </para>
   <para>
    One can establish a connection with the following value pairs
    set in the command string:
    <command>$conn = pg_Connect("host=myHost port=myPort tty=myTTY
    options=myOptions user=myUser password=myPassword dbname=myDB");
    </command>
   </para>
   <para>
    The previous syntax of:
    <command>$conn = pg_connect ("host", "port", "options", "tty",
    "dbname")
    </command>
    has been deprecated.
   </para>
   <para>
    To use the large object (lo) interface, it is necessary to enclose
    it within a transaction block. A transaction block starts with a
    <command>begin</command> and if the transaction was valid ends
    with <command>commit</command> or <command>end</command>.  If the
    transaction fails the transaction should be closed with
    <command>rollback</command> or <command>abort</command>.
    <example>
     <title>Using Large Objects</title>
     <programlisting role="php">
&lt;?php
    $database = pg_Connect ("dbname=jacarta");
    pg_exec ($database, "begin");
    $oid = pg_locreate ($database);
    echo ("$oid\n");
    $handle = pg_loopen ($database, $oid, "w");
    echo ("$handle\n");
    pg_lowrite ($handle, "gaga");
    pg_loclose ($handle);
    pg_exec ($database, "commit");
?>
     </programlisting>
    </example>
   </para>
  </partintro>

  <refentry id="function.pg-close">
   <refnamediv>
    <refname>pg_close</refname>
    <refpurpose>Close a PostgreSQL connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>pg_close</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns false if connection is not a valid connection index, true
     otherwise.  Closes down the connection to a PostgreSQL database
     associated with the given connection index.
    </para>
    <note><para> 
     This isn't usually necessary, as non-persistent open
     links are automatically closed at the end of the script's
     execution.
    </para></note>
    <para> 
     <function>pg_close</function> will not close persistent links
     generated by <function>pg_pconnect</function>.
    </para>      
   </refsect1>
  </refentry>

  <refentry id="function.pg-cmdtuples">
   <refnamediv>
    <refname>pg_cmdtuples</refname>
    <refpurpose>Returns number of affected tuples</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pg_cmdtuples</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_cmdtuples</function> returns the number of tuples
     (instances) affected by INSERT, UPDATE, and DELETE queries. If no
     tuple is affected the function will return 0.
     <example>
      <title><function>Pg_cmdtuples</function></title>
      <programlisting role="php">
&lt;?php
$result = pg_exec ($conn, "INSERT INTO publisher VALUES ('Author')");
$cmdtuples = pg_cmdtuples ($result);
echo $cmdtuples . " &lt;- cmdtuples affected.";
?>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-connect">
   <refnamediv>
    <refname>pg_connect</refname>
    <refpurpose>Open a PostgreSQL connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pg_connect</function></funcdef>
      <paramdef>string <parameter>conn_string</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a connection index on success, or false if the connection
     could not be made.  Opens a connection to a PostgreSQL database.
     The arguments should be within a quoted string.
     <example>
     <title>Using pg_connect arguments</title>
     <programlisting role="php">
&lt;?php
$dbconn = pg_Connect ("dbname=mary");
//connect to a database named "mary"
$dbconn2 = pg_Connect ("host=localhost port=5432 dbname=mary");
//connect to a database named "mary" on "localhost" at port "5432"
$dbconn3 = pg_Connect ("user=lamb password=baaaa dbname=mary ");
//connect to a database named "mary" with a username and password
?>
     </programlisting>
     </example>
     The arguments available include <parameter>dbname</parameter> 
     <parameter>port</parameter>, <parameter>host</parameter>, 
     <parameter>tty</parameter>, <parameter>options</parameter>,
     <parameter>user</parameter>, and <parameter>password</parameter>
    </para>
    <para>
     This function returns a connection index that is needed by other
     PostgreSQL functions. You can have multiple connections open at
     once.
    </para>
    <para>
     The previous syntax of:
     <command>$conn = pg_connect ("host", "port", "options", "tty",
    "dbname")
     </command>
     has been deprecated.
    </para>
    <para>
     See also <function>pg_pconnect</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-dbname">
   <refnamediv>
    <refname>pg_dbname</refname>
    <refpurpose>Get the database name</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>pg_dbname</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the name of the database that the given PostgreSQL
     connection index is connected to, or false if connection is not a
     valid connection index.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-end-copy">
   <refnamediv>
    <refname>pg_end_copy</refname>
    <refpurpose>Sync with PostgreSQL backend</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>pg_end_copy</function></funcdef>
      <paramdef>resource
       <parameter><optional>connection</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>pg_end_copy</function> syncs PostgreSQL frontend with
     the backend after doing a copy operation. It must be issued or
     the backend may get "out of sync" with the frontend. Returns
     TRUE if successfull, FALSE otherwise.
    </para>
    <para>
     For further details and an example, see also
     <function>pg_put_line</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-errormessage">
   <refnamediv>
    <refname>pg_errormessage</refname>
    <refpurpose>Get the error message string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>pg_errormessage</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string containing the error message, false on failure.
     Details about the error probably cannot be retrieved using the
     <function>pg_errormessage</function> function if an error occured
     on the last database action for which a valid connection exists,
     this function will return a string containing the error message
     generated by the backend server.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-exec">
   <refnamediv>
    <refname>pg_exec</refname>
    <refpurpose>Execute a query</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pg_exec</function></funcdef>
      <paramdef>int <parameter>connection</parameter></paramdef>
      <paramdef>string <parameter>query</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a result index if query could be executed, false on
     failure or if connection is not a valid connection index. Details
     about the error can be retrieved using the
     <function>pg_ErrorMessage</function> function if connection is
     valid.  Sends an SQL statement to the PostgreSQL database
     specified by the connection index. The connection must be a valid
     index that was returned by <function>pg_Connect</function>.  The
     return value of this function is an index to be used to access
     the results from other PostgreSQL functions.  
     <note>
      <simpara>
       PHP/FI returned 1 if the query was not expected to return data
       (inserts or updates, for example) and greater than 1 even on
       selects that did not return anything. No such assumption can be
       made in PHP.  
      </simpara>
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-fetch-array">
   <refnamediv>
    <refname>pg_fetch_array</refname>
    <refpurpose>Fetch a row as an array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>pg_fetch_array</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int <parameter>row</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>result_type</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns: An array that corresponds to the fetched row, or false
     if there are no more rows.
    </para>
    <para>
     <function>Pg_fetch_array</function> is an extended version of
     <function>pg_fetch_row</function>.  In addition to storing the
     data in the numeric indices of the result array, it also stores
     the data in associative indices, using the field names as keys.
    </para>
    <para>
     The third optional argument <parameter>result_type</parameter> in
     <function>pg_fetch_array</function> is a constant and can take the
     following values: PGSQL_ASSOC, PGSQL_NUM, and PGSQL_BOTH.
     <note>
      <para>
       <parameter>Result_type</parameter> was added in PHP 4.0.
      </para>
     </note>
    </para>
    <para>
     An important thing to note is that using
     <function>pg_fetch_array</function> is NOT significantly
     slower than using <function>pg_fetch_row</function>, while it
     provides a significant added value.
    </para>
    <para>
     For further details, see also
     <function>pg_fetch_row</function>
    </para>
    <example>
     <title>PostgreSQL fetch array</title>
     <programlisting role="php">
&lt;?php 
$conn = pg_pconnect ("dbname=publisher");
if (!$conn) {
    echo "An error occured.\n";
    exit;
}

$result = pg_Exec ($conn, "SELECT * FROM authors");
if (!$result) {
    echo "An error occured.\n";
    exit;
}

$arr = pg_fetch_array ($result, 0);
echo $arr[0] . " &lt;- array\n";

$arr = pg_fetch_array ($result, 1);
echo $arr["author"] . " &lt;- array\n";
?>
     </programlisting>
    </example>
   </refsect1>
  </refentry>

  <refentry id="function.pg-fetch-object">
   <refnamediv>
    <refname>pg_fetch_object</refname>
    <refpurpose>Fetch a row as an object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>object <function>pg_fetch_object</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int <parameter>row</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>result_type</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns: An object with properties that correspond to the fetched
     row, or false if there are no more rows.
    </para>
    <para> 
     <function>Pg_fetch_object</function> is similar to
     <function>pg_fetch_array</function>, with one difference - an
     object is returned, instead of an array.  Indirectly, that means
     that you can only access the data by the field names, and not by
     their offsets (numbers are illegal property names).
    </para>
    <para>
     The third optional argument <parameter>result_type</parameter> in
     <function>pg_fetch_object</function> is a constant and can take the
     following values: PGSQL_ASSOC, PGSQL_NUM, and PGSQL_BOTH.
     <note>
      <para>
       <parameter>Result_type</parameter> was added in PHP 4.0.
      </para>
     </note>
    </para>
    <para>
     Speed-wise, the function is identical to
     <function>pg_fetch_array</function>, and almost as quick as
     <function>pg_fetch_row</function> (the difference is
     insignificant).
    </para>
    <para> 
     See also: <function>pg_fetch_array</function> and
     <function>pg_fetch_row</function>.
     <example>
      <title>Postgres fetch object</title>
      <programlisting role="php">
&lt;?php 
$database = "verlag";
$db_conn = pg_connect ("host=localhost port=5432 dbname=$database");
if (!$db_conn): ?>
    &lt;H1>Failed connecting to postgres database &lt;?php echo $database ?>&lt;/H1> 
&lt;?php
    exit;
endif;

$qu = pg_exec ($db_conn, "SELECT * FROM verlag ORDER BY autor");
$row = 0; // postgres needs a row counter other dbs might not 

while ($data = pg_fetch_object ($qu, $row)):
    echo $data->autor." (";
    echo $data->jahr ."): ";
    echo $data->titel."&lt;BR>";
    $row++;
endwhile; ?>

&lt;PRE>&lt;?php
$fields[] = Array ("autor", "Author");
$fields[] = Array ("jahr",  "  Year");
$fields[] = Array ("titel", " Title");

$row= 0; // postgres needs a row counter other dbs might not
while ($data = pg_fetch_object ($qu, $row)):
    echo "----------\n";
    reset ($fields);
    while (list (,$item) = each ($fields)):
        echo $item[1].": ".$data->$item[0]."\n";
    endwhile;
    $row++;
endwhile;
echo "----------\n"; ?>
&lt;/PRE> &lt;?php
pg_freeResult ($qu);
pg_close ($db_conn);
?>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-fetch-row">
   <refnamediv>
    <refname>pg_fetch_row</refname>
    <refpurpose>Get a row as an enumerated array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>pg_fetch_row</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int <parameter>row</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns: An array that corresponds to the fetched row, or false
     if there are no more rows.
    </para>
    <para>
     <function>Pg_fetch_row</function> fetches one row of data from
     the result associated with the specified result identifier.  The
     row is returned as an array.  Each result column is stored in an
     array offset, starting at offset 0.
    </para>
    <para>
     See also: <function>pg_fetch_array</function>,
     <function>pg_fetch_object</function>,
     <function>pg_result</function>.
     <example>
      <title>Postgres fetch row</title>
      <programlisting role="php">
&lt;?php 
$conn = pg_pconnect ("dbname=publisher");
if (!$conn) {
    echo "An error occured.\n";
    exit;
}

$result = pg_Exec ($conn, "SELECT * FROM authors");
if (!$result) {
    echo "An error occured.\n";
    exit;
}

$num = pg_numrows($result); 

for ($i=0; $i&lt;$num; $i++) {
  $r = pg_fetch_row($result, $i);

  for ($j=0; $j&lt;count($r); $j++) {
    echo "$r[$j]&amp;nbsp;";
  }

  echo "&lt;BR>";

}
 
?>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-fieldisnull">
   <refnamediv>
    <refname>pg_fieldisnull</refname>
    <refpurpose>Test if a field is NULL</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pg_fieldisnull</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter>row</parameter></paramdef>
      <paramdef>mixed <parameter>field</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Test if a field is NULL or not. Returns 0 if the field in the
     given row is not NULL. Returns 1 if the field in the given row is
     NULL. Field can be specified as number or fieldname. Row
     numbering starts at 0.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-fieldname">
   <refnamediv>
    <refname>pg_fieldname</refname>
    <refpurpose>Returns the name of a field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>pg_fieldname</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter>field_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_fieldname</function> will return the name of the
     field occupying the given column number in the given PostgreSQL
     result identifier.  Field numbering starts from 0.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-fieldnum">
   <refnamediv>
    <refname>pg_fieldnum</refname>
    <refpurpose>Returns the field number of the named field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pg_fieldnum</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>string <parameter>field_name</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_fieldnum</function> will return the number of the
     column slot that corresponds to the named field in the given
     PosgreSQL result identifier.  Field numbering starts at 0.  This
     function will return -1 on error.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-fieldprtlen">
   <refnamediv>
    <refname>pg_fieldprtlen</refname>
    <refpurpose>Returns the printed length</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pg_fieldprtlen</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter>row_number</parameter></paramdef>
      <paramdef>string <parameter>field_name</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_fieldprtlen</function> will return the actual
     printed length (number of characters) of a specific value in a
     PostgreSQL result.  Row numbering starts at 0.  This function
     will return -1 on an error.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-fieldsize">
   <refnamediv>
    <refname>pg_fieldsize</refname> 
    <refpurpose>
     Returns the internal storage size of the named field
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pg_fieldsize</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter>field_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_fieldsize</function> will return the internal
     storage size (in bytes) of the field number in the given
     PostgreSQL result. Field numbering starts at 0. A field size of
     -1 indicates a variable length field. This function will return
     false on error.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-fieldtype">
   <refnamediv>
    <refname>pg_fieldtype</refname> 
    <refpurpose>
     Returns the type name for the corresponding field number
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>pg_fieldtype</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter>field_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_fieldtype</function> will return a string containing
     the type name of the given field in the given PostgreSQL result
     identifier.  Field numbering starts at 0.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-freeresult">
   <refnamediv>
    <refname>pg_freeresult</refname> 
    <refpurpose>Free result memory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pg_freeresult</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_freeresult</function> only needs to be called if you
     are worried about using too much memory while your script is
     running.  All result memory will automatically be freed when the
     script is finished.  But, if you are sure you are not going to
     need the result data anymore in a script, you may call
     <function>pg_freeresult</function> with the result identifier as
     an argument and the associated result memory will be freed.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-getlastoid">
   <refnamediv>
    <refname>pg_getlastoid</refname> 
    <refpurpose>Returns the last object identifier</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pg_getlastoid</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_getlastoid</function> can be used to retrieve the
     <varname>oid</varname> assigned to an inserted tuple if the
     result identifier is used from the last command sent via
     <function>pg_exec</function> and was an SQL INSERT.  This
     function will return a positive integer if there was a valid
     <varname>oid</varname>.  It will return -1 if an error occured or
     the last command sent via <function>pg_exec</function> was not an
     INSERT.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-host">
   <refnamediv>
    <refname>pg_host</refname> 
    <refpurpose>
     Returns the host name associated with the connection
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>pg_host</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_host</function> will return the host name of the
     given PostgreSQL connection identifier is connected to.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-loclose">
   <refnamediv>
    <refname>pg_loclose</refname>
    <refpurpose>Close a large object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pg_loclose</function></funcdef>
      <paramdef>int <parameter>fd</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_loclose</function> closes an Inversion Large
     Object. <parameter>Fd</parameter> is a file descriptor for the
     large object from <function>pg_loopen</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-locreate">
   <refnamediv>
    <refname>pg_locreate</refname>
    <refpurpose>Create a large object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pg_locreate</function></funcdef>
      <paramdef>int <parameter>conn</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_locreate</function> creates an Inversion Large
     Object and returns the <varname>oid</varname> of the large
     object.  <parameter>conn</parameter> specifies a valid database
     connection.  PostgreSQL access modes INV_READ, INV_WRITE, and
     INV_ARCHIVE are not supported, the object is created always with
     both read and write access. INV_ARCHIVE has been removed from
     PostgreSQL itself (version 6.3 and above).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-loexport">
   <refnamediv>
    <refname>pg_loexport</refname>
    <refpurpose>Export a large object to file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>pg_loexport</function></funcdef>
      <paramdef>int
       <parameter>oid</parameter>
      </paramdef>
      <paramdef>int
       <parameter>file</parameter>
      </paramdef>
      <paramdef>int
       <parameter><optional>connection_id</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <parameter>oid</parameter> argument specifies the object id
     of the large object to export and the
     <parameter>filename</parameter> argument specifies the pathname
     of the file. Returns FALSE if an error occurred, TRUE
     otherwise. Remember that handling large objects in PostgreSQL
     must happen inside a transaction.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-loimport">
   <refnamediv>
    <refname>pg_loimport</refname>
    <refpurpose>Import a large object from file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pg_loimport</function></funcdef>
      <paramdef>int
       <parameter>file</parameter>
      </paramdef>
      <paramdef>int
       <parameter><optional>connection_id</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <parameter>filename</parameter> argument specifies the
     pathname of the file to be imported as a large object. Returns
     FALSE if an error occurred, object id of the just created large
     object otherwise. Remember that handling large objects in
     PostgreSQL must happen inside a transaction.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-loopen">
   <refnamediv>
    <refname>pg_loopen</refname>
    <refpurpose>Open a large object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pg_loopen</function></funcdef>
      <paramdef>int <parameter>conn</parameter></paramdef>
      <paramdef>int <parameter>objoid</parameter></paramdef>
      <paramdef>string <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_loopen</function> open an Inversion Large Object and
     returns file descriptor of the large object. The file descriptor
     encapsulates information about the connection. Do not close the
     connection before closing the large object file descriptor.
     <parameter>objoid</parameter> specifies a valid large object oid
     and <parameter>mode</parameter> can be either "r", "w", or "rw".
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-loread">
   <refnamediv>
    <refname>pg_loread</refname>
    <refpurpose>Read a large object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>pg_loread</function></funcdef>
      <paramdef>int <parameter>fd</parameter></paramdef>
      <paramdef>int <parameter>len</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>pg_loread</function> reads at most
     <parameter>len</parameter> bytes from a large object and
     returns it as a string.
     <parameter>fd</parameter> specifies a valid large object file
     descriptor and<parameter>len</parameter> specifies the maximum
     allowable size of the large object segment.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-loreadall">
   <refnamediv>
    <refname>pg_loreadall</refname>
    <refpurpose>
     Read a entire large object and send straight to browser
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pg_loreadall</function></funcdef>
      <paramdef>int <parameter>fd</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_loreadall</function> reads a large object and
     passes it straight through to the browser after sending all pending
     headers. Mainly intended for sending binary data like images or sound.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-lounlink">
   <refnamediv>
    <refname>pg_lounlink</refname>
    <refpurpose>Delete a large object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>pg_lounlink</function></funcdef>
      <paramdef>int <parameter>conn</parameter></paramdef>
      <paramdef>int <parameter>lobjid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_lounlink</function> deletes a large object with the
     <parameter>lobjid</parameter> identifier for that large object.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-lowrite">
   <refnamediv>
    <refname>pg_lowrite</refname>
    <refpurpose>Write a large object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pg_lowrite</function></funcdef>
      <paramdef>int <parameter>fd</parameter></paramdef>
      <paramdef>string <parameter>buf</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_lowrite</function> writes at most to a large object
     from a variable <parameter>buf</parameter> and returns the number
     of bytes actually written, or false in the case of an error.
     <parameter>fd</parameter> is a file descriptor for the large
     object from <function>pg_loopen</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-numfields">
   <refnamediv>
    <refname>pg_numfields</refname> 
    <refpurpose>Returns the number of fields</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pg_numfields</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_numfields</function> will return the number of
     fields (columns) in a PostgreSQL result.  The argument is a valid
     result identifier returned by <function>pg_exec</function>. This
     function will return -1 on error.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-numrows">
   <refnamediv>
    <refname>pg_numrows</refname> 
    <refpurpose>Returns the number of rows</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pg_numrows</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_numrows</function> will return the number of rows in a
     PostgreSQL result.  The argument is a valid result identifier
     returned by <function>pg_exec</function>. This function will
     return -1 on error.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-options">
   <refnamediv>
    <refname>pg_options</refname> 
    <refpurpose>Get the options associated with the connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>pg_options</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_options</function> will return a string containing
     the options specified on the given PostgreSQL connection
     identifier.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-pconnect">
   <refnamediv>
    <refname>pg_pconnect</refname>
    <refpurpose>Open a persistant PostgreSQL connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pg_pconnect</function></funcdef>
      <paramdef>string <parameter>conn_string</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a connection index on success, or false if the connection
     could not be made.  Opens a connection to a PostgreSQL database.
     The arguments should be within a quoted string.
     The arguments available include <parameter>dbname</parameter> 
     <parameter>port</parameter>, <parameter>host</parameter>, 
     <parameter>tty</parameter>, <parameter>options</parameter>,
     <parameter>user</parameter>, and <parameter>password</parameter>
    </para>
    <para>
     This function returns a connection index that is needed by other
     PostgreSQL functions. You can have multiple connections open at
     once.
    </para>
    <para>
     The previous syntax of:
     <command>$conn = pg_pconnect ("host", "port", "options", "tty",
    "dbname")
     </command>
     has been deprecated.
    </para>
    <para>
     See also <function>pg_connect</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-port">
   <refnamediv>
    <refname>pg_port</refname>
    <refpurpose>
     Return the port number associated with the connection
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pg_port</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_port</function> will return the port number that the
     given PostgreSQL connection identifier is connected to.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-put-line">
   <refnamediv>
    <refname>pg_put_line</refname>
    <refpurpose>Send a NULL-terminated string to PostgreSQL backend</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>pg_put_line</function></funcdef>
      <paramdef>resource
       <parameter><optional>connection_id</optional></parameter>
      </paramdef>
      <paramdef>string <parameter>data</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>pg_put_line</function> sends a NULL-terminated string
     to the PostgreSQL backend server. This is useful for example for
     very high-speed inserting of data into a table, initiated by
     starting a PostgreSQL copy-operation. That final NULL-character
     is added automatically. Returns TRUE if successfull, FALSE
     otherwise.
    </para>
    <note>
     <para> 
      Note the application must explicitly send the two characters "\."
      on a final line to indicate to the backend that it has finished
      sending its data.
     </para>
    </note>
    <para>
     See also <function>pg_end_copy</function>.
     <example>
      <title>High-speed insertion of data into a table</title>
      <programlisting role="php">
&lt;?php 
    $conn = pg_pconnect ("dbname=foo");
    pg_exec($conn, "create table bar (a int4, b char(16), d float8)");
    pg_exec($conn, "copy bar from stdin");
    pg_put_line($conn, "3\thello world\t4.5\n");
    pg_put_line($conn, "4\tgoodbye world\t7.11\n");
    pg_put_line($conn, "\\.\n");
    pg_end_copy($conn);
?>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-result">
   <refnamediv>
    <refname>pg_result</refname>
    <refpurpose>Returns values from a result identifier</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>pg_result</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter>row_number</parameter></paramdef>
      <paramdef>mixed <parameter>fieldname</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_result</function> will return values from a result
     identifier produced by <function>pg_Exec</function>.  The
     <parameter>row_number</parameter> and
     <parameter>fieldname</parameter> sepcify what cell in the table
     of results to return.  Row numbering starts from 0.  Instead of
     naming the field, you may use the field index as an unquoted
     number.  Field indices start from 0.
    </para>
    <para>
     PostgreSQL has many built in types and only the basic ones are
     directly supported here.  All forms of integer, boolean and oid
     types are returned as integer values.  All forms of float, and
     real types are returned as double values.  All other types,
     including arrays are returned as strings formatted in the same
     default PostgreSQL manner that you would see in the
     <command>psql</command> program.
    </para>  
   </refsect1>
  </refentry>

  <refentry id="function.pg-set-client-encoding">
   <refnamediv>
    <refname>pg_set_client_encoding</refname>
    <refpurpose>
     Set the client encoding
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pg_set_client_encoding</function></funcdef>
      <paramdef>int 
       <parameter><optional>connection</optional></parameter>
      </paramdef>
      <paramdef>string <parameter>encoding</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The function set the client encoding and return 0 if success or
     -1 if error.
    </para>
    <para>
     <parameter>encoding</parameter> is the client
     encoding and can be either :
     SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW, UNICODE,
     MULE_INTERNAL, LATINX (X=1...9), KOI8, WIN, ALT,
     SJIS, BIG5, WIN1250.
    </para>
    <note>
     <para>
      This function requires PHP-4.0.2 or higher and PostgreSQL-7.0 or
      higher.
     </para>
     <para>
      The function used to be called
      <function>pg_setclientencoding</function>.
     </para>
    </note>
    <para>
     See also <function>pg_client_encoding</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-client-encoding">
   <refnamediv>
    <refname>pg_client_encoding</refname>
    <refpurpose>
     Get the client encoding
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>      
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>pg_client_encoding</function></funcdef>
      <paramdef>int 
       <parameter><optional>connection</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The functions returns the client encoding as the string. The
     returned string should be either :
     SQL_ASCII, EUC_JP, EUC_CN, EUC_KR, EUC_TW, UNICODE,
     MULE_INTERNAL, LATINX (X=1...9), KOI8, WIN, ALT,
     SJIS, BIG5, WIN1250. 
    </para>
    <note>
     <para>
      This function requires PHP-4.0.2 or higher and PostgreSQL-7.0 or
      higher.
     </para>
     <para>
      The function used to be called
      <function>pg_clientencoding</function>.
     </para>
    </note>
    <para>
     See also <function>pg_set_client_encoding</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-trace">
   <refnamediv>
    <refname>pg_trace</refname>
    <refpurpose>Enable tracing a PostgreSQL connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>pg_trace</function></funcdef>
      <paramdef>string
       <parameter>filename</parameter>
      </paramdef>
      <paramdef>string
       <parameter><optional>mode</optional></parameter>
      </paramdef>
      <paramdef>int
       <parameter><optional>connection</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Enables tracing of the PostgreSQL frontend/backend communication
     to a debugging file. To fully understand the results one needs to
     be familiar with the internals of PostgreSQL communication
     protocol.  For those who are not, it can still be useful for
     tracing errors in queries sent to the server, you could do for
     example <command>grep '^To backend' trace.log</command> and see
     what query actually were sent to the PostgreSQL server.
    </para>
    <para>
     <parameter>Filename</parameter> and <parameter>mode</parameter>
     are the same as in <function>fopen</function>
     (<parameter>mode</parameter> defaults to 'w'),
     <parameter>connection</parameter> specifies the connection to
     trace and defaults to the last one opened.
    </para>
    <para>
     Returns TRUE if <parameter>filename</parameter> could be opened
     for logging, FALSE otherwise.
    </para>
    <para>
     See also <function>fopen</function> and
     <function>pg_untrace</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-tty">
   <refnamediv>
    <refname>pg_tty</refname>
    <refpurpose>
     Return the tty name associated with the connection
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>pg_tty</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Pg_tty</function> will return the tty name that server
     side debugging output is sent to on the given PostgreSQL
     connection identifier.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pg-untrace">
   <refnamediv>
    <refname>pg_untrace</refname>
    <refpurpose>Disable tracing of a PostgreSQL connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>pg_untrace</function></funcdef>
      <paramdef>int
       <parameter><optional>connection</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Stop tracing started by <function>pg_trace</function>.
     <parameter>connection</parameter> specifies the connection that was
     traced and defaults to the last one opened.
    </para>
    <para>
     Returns always TRUE.
    </para>
    <para>
     See also <function>pg_trace</function>.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/posix.xml
+++ phpdoc/kr/functions/posix.xml
 <reference id="ref.posix">
  <title>POSIX functions</title>
  <titleabbrev>POSIX</titleabbrev>

  <partintro>
   <para>
    This module contains an interface to those functions defined in the
    IEEE 1003.1 (POSIX.1) standards document which are not accessible
    through other means. POSIX.1 for example defined the open(), read(),
    write() and close() functions, too, which traditionally have been
    part of PHP 3 for a long time. Some more system specific functions
    have not been available before, though, and this module tries to
    remedy this by providing easy access to these functions.
   </para>
  </partintro>


  <refentry id="function.posix-kill">
   <refnamediv>
    <refname>posix_kill</refname>
    <refpurpose>Send a signal to a process</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>posix_kill</function></funcdef>
      <paramdef>int <parameter>pid</parameter></paramdef>
      <paramdef>int <parameter>sig</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Send the signal <parameter>sig</parameter> to the process
     with the process identifier <parameter>pid</parameter>.
     Returns FALSE, if unable to send the signal, TRUE otherwise.</para>
    <para>
     See also the kill(2) manual page of your POSIX system, which
     contains additional information about negative process
     identifiers, the special pid 0, the special pid -1, and the
     signal number 0.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-getpid">
   <refnamediv>
    <refname>posix_getpid</refname>
    <refpurpose>Return the current process identifier</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>posix_getpid</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Return the process identifier of the current process.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-getppid">
   <refnamediv>
    <refname>posix_getppid</refname>
    <refpurpose>Return the parent process identifier</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>posix_getppid</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Return the process identifier of the parent process of the current
     process.
        </para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-getuid">
   <refnamediv>
    <refname>posix_getuid</refname>
    <refpurpose>
     Return the real user ID of the current process
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>posix_getuid</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Return the numeric real user ID of the current process. See also
     <function>posix_getpwuid</function> for information on how to
     convert this into a useable username.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-geteuid">
   <refnamediv>
    <refname>posix_geteuid</refname>
    <refpurpose>
     Return the effective user ID of the current process
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>posix_geteuid</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Return the numeric effective user ID of the current process. See
     also <function>posix_getpwuid</function> for information on how
     to convert this into a useable username.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-getgid">
   <refnamediv>
    <refname>posix_getgid</refname>
    <refpurpose>
     Return the real group ID of the current process
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>posix_getgid</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Return the numeric real group ID of the current process. See also
     <function>posix_getgrgid</function> for information on how to
     convert this into a useable group name.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-getegid">
   <refnamediv>
    <refname>posix_getegid</refname>
    <refpurpose>
     Return the effective group ID of the current process
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>posix_getegid</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Return the numeric effective group ID of the current process. See
     also <function>posix_getgrgid</function> for information on how
     to convert this into a useable group name.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-setuid">
   <refnamediv>
    <refname>posix_setuid</refname> 
    <refpurpose>
     Set the effective UID of the current process
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>posix_setuid</function></funcdef>
      <paramdef>int <parameter>uid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Set the real user ID of the current process. This is a privileged
     function and you need appropriate privileges (usually root) on
     your system to be able to perform this function.</para>
    <para>
     Returns TRUE on success, FALSE otherwise. See also
     <function>posix_setgid</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-setgid">
   <refnamediv>
    <refname>posix_setgid</refname> 
    <refpurpose>
     Set the effective GID of the current process
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>posix_setgid</function></funcdef>
      <paramdef>int <parameter>gid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Set the real group ID of the current process. This is a
     privileged function and you need appropriate privileges (usually
     root) on your system to be able to perform this function. The
     appropriate order of function calls is
     <function>posix_setgid</function> first,
     <function>posix_setuid</function> last.</para>
    <para>
     Returns TRUE on success, FALSE otherwise.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-getgroups">
   <refnamediv>
    <refname>posix_getgroups</refname>
    <refpurpose>
     Return the group set of the current process
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>posix_getgroups</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of integers containing the numeric group ids of
     the group set of the current process. See also
     <function>posix_getgrgid</function> for information on how to
     convert this into useable group names.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-getlogin">
   <refnamediv>
    <refname>posix_getlogin</refname>
    <refpurpose>Return login name</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>posix_getlogin</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the login name of the user owning the current process.
     See <function>posix_getpwnam</function> for information how to
     get more information about this user.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-getpgrp">
   <refnamediv>
    <refname>posix_getpgrp</refname>
    <refpurpose>
     Return the current process group identifier
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>posix_getpgrp</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Return the process group identifier of the current process. See
     POSIX.1 and the getpgrp(2) manual page on your POSIX system for
     more information on process groups.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-setsid">
   <refnamediv>
    <refname>posix_setsid</refname>
    <refpurpose>Make the current process a session leader</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>posix_setsid</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Make the current process a session leader. See POSIX.1 and
     the setsid(2) manual page on your POSIX system for more
     informations on process groups and job control. Returns 
     the session id.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-setpgid">
   <refnamediv>
    <refname>posix_setpgid</refname>
    <refpurpose>set process group id for job control</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>posix_setpgid</function></funcdef>
      <paramdef>int <parameter>pid</parameter></paramdef>
      <paramdef>int <parameter>pgid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Let the process <parameter>pid</parameter> join the process
     group <parameter>pgid</parameter>. See POSIX.1 and
     the setsid(2) manual page on your POSIX system for more
     informations on process groups and job control. Returns
     TRUE on success, FALSE otherwise.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-getpgid">
   <refnamediv>
    <refname>posix_getpgid</refname>
    <refpurpose>Get process group id for job control</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>posix_getpgid</function></funcdef>
      <paramdef>int <parameter>pid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the process group identifier of the process
     <parameter>pid</parameter>.</para>
    <para>
     This is not a POSIX function, but is common on BSD and System V
     systems. If your system does not support this function at system
     level, this PHP function will always return FALSE.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-getsid">
   <refnamediv>
    <refname>posix_getsid</refname>
    <refpurpose>Get the current sid of the process</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>posix_getsid</function></funcdef>
      <paramdef>int <parameter>pid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Return the sid of the process <parameter>pid</parameter>.
     If <parameter>pid</parameter> is 0, the sid of the
     current process is returned.</para>
    <para>
     This is not a POSIX function, but is common on System V
     systems. If your system does not support this function at system
     level, this PHP function will always return FALSE.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-uname">
   <refnamediv>
    <refname>posix_uname</refname>
    <refpurpose>Get system name</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>posix_uname</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a hash of strings with information about the
     system. The indices of the hash are
     <itemizedlist>
      <listitem><simpara>
        sysname - operating system name (e.g. Linux)
       </simpara></listitem>
      <listitem><simpara>
        nodename - system name (e.g. valiant)
       </simpara></listitem>
      <listitem><simpara>
        release - operating system release (e.g. 2.2.10)
       </simpara></listitem>
      <listitem><simpara>
        version - operating system version (e.g. #4 Tue Jul 20
        17:01:36 MEST 1999)
       </simpara></listitem>
      <listitem><simpara>
        machine - system architecture (e.g. i586)
       </simpara></listitem>
      <listitem><simpara>
        domainname - DNS domainname (e.g. php.net)
       </simpara></listitem>
     </itemizedlist>
    </para>
    <para>
     domainname is a GNU extension and not part of POSIX.1, so this
     field is only available on GNU systems or when using the GNU libc.
    </para>
    <para>
     Posix requires that you must not make any assumptions about the
     format of the values, e.g. you cannot rely on three digit version
     numbers or anything else returned by this function.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-times">
   <refnamediv>
    <refname>posix_times</refname>
    <refpurpose>Get process times</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>posix_times</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a hash of strings with information about the
     current process CPU usage. The indices of the hash are
     <itemizedlist>
      <listitem><simpara>
        ticks - the number of clock ticks that have elapsed since
        reboot.
       </simpara></listitem>
      <listitem><simpara>
        utime - user time used by the current process.
       </simpara></listitem>
      <listitem><simpara>
        stime - system time used by the current process.
       </simpara></listitem>
      <listitem><simpara>
        cutime - user time used by current process and children.
       </simpara></listitem>
      <listitem><simpara>
        cstime - system time used by current process and children.
       </simpara></listitem>
     </itemizedlist></para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-ctermid">
   <refnamediv>
    <refname>posix_ctermid</refname>
    <refpurpose>Get path name of controlling terminal</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>posix_ctermid</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Needs to be written.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-ttyname">
   <refnamediv>
    <refname>posix_ttyname</refname>
    <refpurpose>Determine terminal device name</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>posix_ttyname</function></funcdef>
      <paramdef>int <parameter>fd</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Needs to be written.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-isatty">
   <refnamediv>
    <refname>posix_isatty</refname>
    <refpurpose>
     Determine if a file descriptor is an interactive terminal
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>posix_isatty</function></funcdef>
      <paramdef>int <parameter>fd</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Needs to be written.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-getcwd">
   <refnamediv>
    <refname>posix_getcwd</refname>
    <refpurpose>Pathname of current directory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>posix_getcwd</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Needs to be written ASAP.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-mkfifo">
   <refnamediv>
    <refname>posix_mkfifo</refname>
    <refpurpose>
     Create a fifo special file (a named pipe)
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>posix_getcwd</function></funcdef>
      <paramdef>string <parameter>pathname</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Needs to be written ASAP..</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-getgrnam">
   <refnamediv>
    <refname>posix_getgrnam</refname>
    <refpurpose>Return info about a group by name</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>posix_getgrnam</function></funcdef>
      <paramdef>string <parameter>name</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Needs to be written.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-getgrgid">
   <refnamediv>
    <refname>posix_getgrgid</refname>
    <refpurpose>Return info about a group by group id</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>posix_getgrgid</function></funcdef>
      <paramdef>int <parameter>gid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Needs to be written.</para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-getpwnam">
   <refnamediv>
    <refname>posix_getpwnam</refname>
    <refpurpose>Return info about a user by username</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>posix_getpwnam</function></funcdef>
      <paramdef>string <parameter>username</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an associative array containing information about a
     user referenced by an alphanumeric username, passed in the
     <parameter>username</parameter> parameter.
    </para>
    <para>
     The array elements returned are:
     <table>
      <title>The user information array</title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>Element</entry>
         <entry>Description</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>name</entry>
         <entry>
          The name element contains the username of the user. This is
          a short, usually less than 16 character "handle" of the user,
          not her real, full name. This should be the same as the
          <parameter>username</parameter> parameter used when calling the
          function, and hence redundant.
         </entry>
        </row>
        <row>
         <entry>passwd</entry>
         <entry>
          The passwd element contains the user's password in an encrypted
          format. Often, for example on a system employing "shadow"
          passwords, an asterisk is returned instead.
         </entry>
        </row>
        <row>
         <entry>uid</entry>
         <entry>
          User ID of the user in numeric form.
         </entry>
        </row>
        <row>
         <entry>gid</entry>
         <entry>
          The group ID of the user. Use the function
          <function>posix_getgrgid</function> to resolve the
          group name and a list of its members.
         </entry>
        </row>
        <row>
         <entry>gecos</entry>
         <entry>
          GECOS is an obsolete term that refers to the finger information
          field on a Honeywell batch processing system. The field, however,
          lives on, and its contents have been formalized by POSIX. The
          field contains a comma separated list containing the user's full
          name, office phone, office number, and home phone number. On most
          systems, only the user's full name is available.
         </entry>
        </row>
        <row>
         <entry>dir</entry>
         <entry>
          This element contains the absolute path to the
          home directory of the user.
         </entry>
        </row>
        <row>
         <entry>shell</entry>
         <entry>
          The shell element contains the absolute path to the executable of
          the user's default shell.
         </entry>
        </row>
       </tbody>
      </tgroup>
     </table>
    </para>    
   </refsect1>
  </refentry>
  
  <refentry id="function.posix-getpwuid">
   <refnamediv>
    <refname>posix_getpwuid</refname>
    <refpurpose>Return info about a user by user id</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>posix_getpwuid</function></funcdef>
      <paramdef>int <parameter>uid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an associative array containing information about a
     user referenced by a numeric user ID, passed in the
     <parameter>uid</parameter> parameter.
    </para>
    <para>
     The array elements returned are:
     <table>
      <title>The user information array</title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>Element</entry>
         <entry>Description</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>name</entry>
         <entry>
          The name element contains the username of the user. This is
          a short, usually less than 16 character "handle" of the user,
          not her real, full name. 
         </entry>
        </row>
        <row>
         <entry>passwd</entry>
         <entry>
          The passwd element contains the user's password in an encrypted
          format. Often, for example on a system employing "shadow"
          passwords, an asterisk is returned instead.
         </entry>
        </row>
        <row>
         <entry>uid</entry>
         <entry>
          User ID, should be the same as the <parameter>uid</parameter>
          parameter used when calling the function, and hence redundant.
         </entry>
        </row>
        <row>
         <entry>gid</entry>
         <entry>
          The group ID of the user. Use the function
          <function>posix_getgrgid</function> to resolve the
          group name and a list of its members.
         </entry>
        </row>
        <row>
         <entry>gecos</entry>
         <entry>
          GECOS is an obsolete term that refers to the finger information
          field on a Honeywell batch processing system. The field, however,
          lives on, and its contents have been formalized by POSIX. The
          field contains a comma separated list containing the user's full
          name, office phone, office number, and home phone number. On most
          systems, only the user's full name is available.
         </entry>
        </row>
        <row>
         <entry>dir</entry>
         <entry>
          This element contains the absolute path to the
          home directory of the user.
         </entry>
        </row>
        <row>
         <entry>shell</entry>
         <entry>
          The shell element contains the absolute path to the executable of
          the user's default shell.
         </entry>
        </row>
       </tbody>
      </tgroup>
     </table>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.posix-getrlimit">
   <refnamediv>
    <refname>posix_getrlimit</refname>
    <refpurpose>Return info about system ressource limits</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>posix_getrlimit</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Needs to be written ASAP.</para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/pspell.xml
+++ phpdoc/kr/functions/pspell.xml
 <reference id="ref.pspell">
  <title>Pspell Functions</title>
  <titleabbrev>Pspell</titleabbrev>

  <partintro>
   <simpara>
    These functions allow you to check the spelling of a word and offer
        suggestions.
   </simpara>
   <simpara>
    You need the aspell and pspell libraries, available from <ulink
    url="&url.aspell;">&url.aspell;</ulink> and
    <ulink url="&url.pspell;">&url.pspell;</ulink> respectively, and
    add the <option role="configure">--with-pspell[=dir]</option> option
    when compiling php.
   </simpara>
  </partintro>

  <refentry id="function.pspell-add-to-personal">
   <refnamediv>
    <refname>pspell_add_to_personal</refname>
    <refpurpose>Add the word to a personal wordlist.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pspell_add_to_personal</function></funcdef>
      <paramdef>int <parameter>dictionary_link</parameter></paramdef>
      <paramdef>string <parameter>word</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Pspell_add_to_personal</function> adds a word to the personal 
         wordlist. If you used <function>pspell_new_config</function> with
         <function>pspell_config_personal</function> to open the dictionary,
         you can save the wordlist later with
         <function>pspell_save_wordlist</function>. Please, note that this function
         will not work unless you have pspell .11.2 and aspell .32.5 or later.
    </simpara>
    <para>
     <example>
      <title><function>Pspell_add_to_personal</function></title>
      <programlisting role="php">
$pspell_config = pspell_config_create ("en");
pspell_config_personal ($pspell_config, "/var/dictionaries/custom.pws");
$pspell_link = pspell_new_config ($pspell_config);

pspell_add_to_personal ($pspell_link, "Vlad");
pspell_save_wordlist ($pspell_link);
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-add-to-session">
   <refnamediv>
    <refname>pspell_add_to_session</refname>
    <refpurpose>Add the word to the wordlist in the current session.
        </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pspell_add_to_session</function></funcdef>
      <paramdef>int <parameter>dictionary_link</parameter></paramdef>
      <paramdef>string <parameter>word</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Pspell_add_to_session</function> adds a word to the wordlist
         associated with the current session. It is very similar to
         <function>pspell_add_to_personal</function>
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-check">
   <refnamediv>
    <refname>pspell_check</refname>
    <refpurpose>Check a word</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>pspell_check</function></funcdef>
      <paramdef>int <parameter>dictionary_link</parameter></paramdef>
      <paramdef>string <parameter>word</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Pspell_check</function> checks the spelling of a word
     and returns true if the spelling is correct, false if not.
    </simpara>
    <para>
     <example>
      <title><function>Pspell_check</function></title>
      <programlisting role="php">
$pspell_link = pspell_new ("en");

if (pspell_check ($pspell_link, "testt")) {
    echo "This is a valid spelling";
} else {
    echo "Sorry, wrong spelling";
}
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-clear-session">
   <refnamediv>
    <refname>pspell_clear_session</refname>
    <refpurpose>Clear the current session.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pspell_clear_session</function></funcdef>
      <paramdef>int <parameter>dictionary_link</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Pspell_clear_session</function> clears the current session.
         The current wordlist becomes blank, and, for example, if you try to save
         it with <function>pspell_save_wordlist</function>, nothing happens.
    </simpara>
    <para>
     <example>
      <title><function>Pspell_add_to_personal</function></title>
      <programlisting role="php">
$pspell_config = pspell_config_create ("en");
pspell_config_personal ($pspell_config, "/var/dictionaries/custom.pws");
$pspell_link = pspell_new_config ($pspell_config);

pspell_add_to_personal ($pspell_link, "Vlad");
pspell_clear_session ($pspell_link);
pspell_save_wordlist ($pspell_link);    //"Vlad" will not be saved
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-config-create">
   <refnamediv>
    <refname>pspell_config_create</refname>
    <refpurpose>Create a config used to open a dictionary.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pspell_config_create</function></funcdef>
      <paramdef>string <parameter>language</parameter></paramdef>
      <paramdef>string 
       <parameter>
        <optional>spelling</optional>
       </parameter>
      </paramdef>
      <paramdef>string 
       <parameter>
        <optional>jargon</optional>
       </parameter>
      </paramdef>
      <paramdef>string 
       <parameter>
        <optional>encoding</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Pspell_config_create</function> has a very similar syntax to
         <function>pspell_new</function>. In fact, using 
         <function>pspell_config_create</function> immediatelly followed by 
         <function>pspell_new_config</function> will produce the exact same result.
         However, after creating a new config, you can also use
         <function>pspell_config_*</function> functions before calling
         <function>pspell_new_config</function> to take advantage of some
         advanced functionality.
    </simpara>
    <para>
     The language parameter is the language code which consists of the
     two letter ISO 639 language code and an optional two letter ISO
     3166 country code after a dash or underscore. 
    </para>
    <para>
     The spelling parameter is the requested spelling for languages
     with more than one spelling such as English. Known values are
     'american', 'british', and 'canadian'.
    </para>
    <para>
     The jargon parameter contains extra information to distinguish
     two different words lists that have the same language and
     spelling parameters.
    </para>
    <para>
     The encoding parameter is the encoding that words are expected to
     be in.  Valid values are 'utf-8', 'iso8859-*', 'koi8-r',
     'viscii', 'cp1252', 'machine unsigned 16', 'machine unsigned
     32'. This parameter is largely untested, so be careful when
     using.
    </para>
    <para>
     The mode parameter is the mode in which spellchecker will work.
     There are several modes available:
     <itemizedlist>
      <listitem>
       <simpara>
        PSPELL_FAST - Fast mode (least number of suggestions)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        PSPELL_NORMAL - Normal mode (more suggestions)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        PSPELL_BAD_SPELLERS - Slow mode (a lot of suggestions)
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     For more information and examples, check out inline manual pspell
     website:<ulink url="&url.pspell;">&url.pspell;</ulink>.
    </para>
    <para>
     <example>
      <title><function>Pspell_config_create</function></title>
      <programlisting role="php">
$pspell_config = pspell_config_create ("en");
pspell_config_personal ($pspell_config, "/var/dictionaries/custom.pws");
pspell_config_repl ($pspell_config, "/var/dictionaries/custom.repl");
$pspell_link = pspell_new_personal (pspell_config);
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-config-ignore">
   <refnamediv>
    <refname>pspell_config_ignore</refname>
    <refpurpose>Ignore words less than N characters long.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pspell_config_ignore</function></funcdef>
      <paramdef>int <parameter>dictionary_link</parameter></paramdef>
      <paramdef>int <parameter>n</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Pspell_config_ignore</function> should be used on a config
         before calling <function>pspell_new_config</function>. This function
         allows short words to be skipped by the spellchecker. Words less then
         n characters will be skipped.
    </simpara>
    <para>
     <example>
      <title><function>Pspell_config_ignore</function></title>
      <programlisting role="php">
$pspell_config = pspell_config_create ("en");
pspell_config_ignore($pspell_config, 5);
$pspell_link = pspell_new_config($pspell_config);
pspell_check($pspell_link, "abcd");     //will not result in an error
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-config-mode">
   <refnamediv>
    <refname>pspell_config_mode</refname>
    <refpurpose>Change the mode number of suggestions returned.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pspell_config_mode</function></funcdef>
      <paramdef>int <parameter>dictionary_link</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Pspell_config_mode</function> should be used on a config
         before calling <function>pspell_new_config</function>. This function
         determines how many suggestions will be returned by 
         <function>pspell_suggest</function>.
        </simpara>
        <para>
     The mode parameter is the mode in which spellchecker will work.
     There are several modes available:
     <itemizedlist>
      <listitem>
       <simpara>
        PSPELL_FAST - Fast mode (least number of suggestions)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        PSPELL_NORMAL - Normal mode (more suggestions)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        PSPELL_BAD_SPELLERS - Slow mode (a lot of suggestions)
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     <example>
      <title><function>Pspell_config_mode</function></title>
      <programlisting role="php">
$pspell_config = pspell_config_create ("en");
pspell_config_mode($pspell_config, PSPELL_FAST);
$pspell_link = pspell_new_config($pspell_config);
pspell_check($pspell_link, "thecat");
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-config-personal">
   <refnamediv>
    <refname>pspell_config_personal</refname>
    <refpurpose>Set a file that contains personal wordlist.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pspell_config_personal</function></funcdef>
      <paramdef>int <parameter>dictionary_link</parameter></paramdef>
      <paramdef>string <parameter>file</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Pspell_config_personal</function> should be used on a config
         before calling <function>pspell_new_config</function>. The personal
         wordlist will be loaded and used in addition to the standard one after
         you call <function>pspell_new_config</function>. If the file does not
         exist, it will be created. The file is also the file where
         <function>pspell_save_wordlist</function> will save personal wordlist to.
         The file should be writable by whoever php runs as (e.g. nobody). Please,
         note that this function will not work unless you have pspell .11.2 and
         aspell .32.5 or later.
    </simpara>
    <para>
     <example>
      <title><function>Pspell_config_personal</function></title>
      <programlisting role="php">
$pspell_config = pspell_config_create ("en");
pspell_config_personal ($pspell_config, "/var/dictionaries/custom.pws");
$pspell_link = pspell_new_config ($pspell_config);
pspell_check ($pspell_link, "thecat");
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-config-repl">
   <refnamediv>
    <refname>pspell_config_repl</refname>
    <refpurpose>Set a file that contains replacement pairs.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pspell_config_repl</function></funcdef>
      <paramdef>int <parameter>dictionary_link</parameter></paramdef>
      <paramdef>string <parameter>file</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Pspell_config_repl</function> should be used on a config
         before calling <function>pspell_new_config</function>. The replacement
         pairs improve the quality of the spellchecker. When a word is misspelled,
         and a proper suggestion was not found in the list,
         <function>pspell_store_replacement</function> can be used to store a 
         replacement pair and then <function>pspell_save_wordlist</function> to
         save the wordlist along with the replacement pairs. The file should be
         writable by whoever php runs as (e.g. nobody). Please, note that this
         function will not work unless you have pspell .11.2 and aspell .32.5 or
         later.
    </simpara>
    <para>
     <example>
      <title><function>Pspell_config_repl</function></title>
      <programlisting role="php">
$pspell_config = pspell_config_create ("en");
pspell_config_personal ($pspell_config, "/var/dictionaries/custom.pws");
pspell_config_repl ($pspell_config, "/var/dictionaries/custom.repl");
$pspell_link = pspell_new_config ($pspell_config);
pspell_check ($pspell_link, "thecat");
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-config-runtogether">
   <refnamediv>
    <refname>pspell_config_runtogether</refname>
    <refpurpose>Consider run-together words as valid compounds.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pspell_config_runtogether</function></funcdef>
      <paramdef>int <parameter>dictionary_link</parameter></paramdef>
      <paramdef>boolean <parameter>flag</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Pspell_config_runtogether</function> should be used on a config
         before calling <function>pspell_new_config</function>. This function
         determines whether run-together words will be treated as legal
         compounds.  That is, "thecat" will be a legal compound,
         athough there should be a space between the two
         words. Changing this setting only affects the results returned
         by <function>pspell_check</function>;
         <function>pspell_suggest</function> will still return suggestions.
    </simpara>
    <para>
     <example>
      <title><function>Pspell_config_runtogether</function></title>
      <programlisting role="php">
$pspell_config = pspell_config_create ("en");
pspell_config_runtogether ($pspell_config, true);
$pspell_link = pspell_new_config ($pspell_config);
pspell_check ($pspell_link, "thecat");
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-config-save-repl">
   <refnamediv>
    <refname>pspell_config_save_repl</refname>
    <refpurpose>Determine whether to save a replacement pairs list
        along with the wordlist.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pspell_config_save_repl</function></funcdef>
      <paramdef>int <parameter>dictionary_link</parameter></paramdef>
      <paramdef>boolean <parameter>flag</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Pspell_config_save_repl</function> should be used on a config
         before calling <function>pspell_new_config</function>. It determines
         whether <function>pspell_save_wordlist</function> will save the
         replacement pairs along with the wordlist. Usually there is no need to use
         this function because if <function>pspell_config_repl</function> is used,
         the replacement pairs will be saved by 
         <function>pspell_save_wordlist</function> anyway, and if it is not,
         the replacement pairs will not be saved. Please, note that this function
         will not work unless you have pspell .11.2 and aspell .32.5 or later.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-new">
   <refnamediv>
    <refname>pspell_new</refname>
    <refpurpose>Load a new dictionary</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pspell_new</function></funcdef>
      <paramdef>string <parameter>language</parameter></paramdef>
      <paramdef>string 
       <parameter>
        <optional>spelling</optional>
       </parameter>
      </paramdef>
      <paramdef>string 
       <parameter>
        <optional>jargon</optional>
       </parameter>
      </paramdef>
      <paramdef>string 
       <parameter>
        <optional>encoding</optional>
       </parameter>
      </paramdef>
      <paramdef>int 
       <parameter>
        <optional>mode</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Pspell_new</function> opens up a new dictionary and
     returns the dictionary link identifier for use in other pspell
     functions.
    </simpara>
    <para>
     The language parameter is the language code which consists of the
     two letter ISO 639 language code and an optional two letter ISO
     3166 country code after a dash or underscore. 
    </para>
    <para>
     The spelling parameter is the requested spelling for languages
     with more than one spelling such as English. Known values are
     'american', 'british', and 'canadian'.
    </para>
    <para>
     The jargon parameter contains extra information to distinguish
     two different words lists that have the same language and
     spelling parameters.
    </para>
    <para>
     The encoding parameter is the encoding that words are expected to
     be in.  Valid values are 'utf-8', 'iso8859-*', 'koi8-r',
     'viscii', 'cp1252', 'machine unsigned 16', 'machine unsigned
     32'. This parameter is largely untested, so be careful when
     using.
    </para>
    <para>
     The mode parameter is the mode in which spellchecker will work.
     There are several modes available:
     <itemizedlist>
      <listitem>
       <simpara>
        PSPELL_FAST - Fast mode (least number of suggestions)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        PSPELL_NORMAL - Normal mode (more suggestions)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        PSPELL_BAD_SPELLERS - Slow mode (a lot of suggestions)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        PSPELL_RUN_TOGETHER - Consider run-together words as legal
        compounds.  That is, "thecat" will be a legal compound,
        athough there should be a space between the two
        words. Changing this setting only affects the results returned
        by <function>pspell_check</function>;
        <function>pspell_suggest</function> will still return
        suggestions.
       </simpara>
      </listitem>
     </itemizedlist>
     Mode is a bitmask constructed from different constants listed
     above.  However, PSPELL_FAST, PSPELL_NORMAL and
     PSPELL_BAD_SPELLERS are mutually exclusive, so you should select
     only one of them.
    </para>
    <para>
     For more information and examples, check out inline manual pspell
     website:<ulink url="&url.pspell;">&url.pspell;</ulink>.
    </para>
    <para>
     <example>
      <title><function>Pspell_new</function></title>
      <programlisting role="php">
$pspell_link = pspell_new ("en", "", "", "", 
                           (PSPELL_FAST|PSPELL_RUN_TOGETHER));
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-new-config">
   <refnamediv>
    <refname>pspell_new_config</refname>
    <refpurpose>Load a new dictionary with settings based on a given config
        </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pspell_new_config</function></funcdef>
      <paramdef>int <parameter>config</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Pspell_new_config</function> opens up a new dictionary with
         settings specified in a config, created with with
         <function>pspell_config_create</function> and modified with
         <function>pspell_config_*</function> functions. This method provides you
         with the most flexibility and has all the functionality provided by
         <function>pspell_new</function> and 
         <function>pspell_new_personal</function>.
    </simpara>
    <para>
     The config parameter is the one returned by
         <function>pspell_config_create</function> when the config was created.
    </para>
    <para>
     <example>
      <title><function>Pspell_new_config</function></title>
      <programlisting role="php">
$pspell_config = pspell_config_create ("en");
pspell_config_personal ($pspell_config, "/var/dictionaries/custom.pws");
pspell_config_repl ($pspell_config, "/var/dictionaries/custom.repl");
$pspell_link = pspell_new_personal (pspell_config);
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-new-personal">
   <refnamediv>
    <refname>pspell_new_personal</refname>
    <refpurpose>Load a new dictionary with personal wordlist</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pspell_new_personal</function></funcdef>
      <paramdef>string <parameter>personal</parameter></paramdef>
      <paramdef>string <parameter>language</parameter></paramdef>
      <paramdef>string 
       <parameter>
        <optional>spelling</optional>
       </parameter>
      </paramdef>
      <paramdef>string 
       <parameter>
        <optional>jargon</optional>
       </parameter>
      </paramdef>
      <paramdef>string 
       <parameter>
        <optional>encoding</optional>
       </parameter>
      </paramdef>
      <paramdef>int 
       <parameter>
        <optional>mode</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Pspell_new_personal</function> opens up a new dictionary with
         a personal wordlist and returns the dictionary link identifier for use
         in other pspell functions. The wordlist can be modified and saved with
         <function>pspell_save_wordlist</function>, if desired. However, the
         replacement pairs are not saved. In order to save replacement pairs, you
         should create a config using <function>pspell_config_create</function>,
         set the personal wordlist file with <function>pspell_config_personal
         </function>, set the file for replacement pairs with 
         <function>pspell_config_repl</function>, and open a new dictionary with
         <function>pspell_new_config</function>.
    </simpara>
    <para>
     The personal parameter specifies the file where words added to the
         personal list will be stored. It should be an absolute filename
         beginning with '/' because otherwise it will be relative to $HOME,
         which is "/root" for most systems, and is probably not what you want.
    </para>
    <para>
     The language parameter is the language code which consists of the
     two letter ISO 639 language code and an optional two letter ISO
     3166 country code after a dash or underscore. 
    </para>
    <para>
     The spelling parameter is the requested spelling for languages
     with more than one spelling such as English. Known values are
     'american', 'british', and 'canadian'.
    </para>
    <para>
     The jargon parameter contains extra information to distinguish
     two different words lists that have the same language and
     spelling parameters.
    </para>
    <para>
     The encoding parameter is the encoding that words are expected to
     be in.  Valid values are 'utf-8', 'iso8859-*', 'koi8-r',
     'viscii', 'cp1252', 'machine unsigned 16', 'machine unsigned
     32'. This parameter is largely untested, so be careful when
     using.
    </para>
    <para>
     The mode parameter is the mode in which spellchecker will work.
     There are several modes available:
     <itemizedlist>
      <listitem>
       <simpara>
        PSPELL_FAST - Fast mode (least number of suggestions)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        PSPELL_NORMAL - Normal mode (more suggestions)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        PSPELL_BAD_SPELLERS - Slow mode (a lot of suggestions)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        PSPELL_RUN_TOGETHER - Consider run-together words as legal
        compounds.  That is, "thecat" will be a legal compound,
        athough there should be a space between the two
        words. Changing this setting only affects the results returned
        by <function>pspell_check</function>;
        <function>pspell_suggest</function> will still return
        suggestions.
       </simpara>
      </listitem>
     </itemizedlist>
     Mode is a bitmask constructed from different constants listed
     above.  However, PSPELL_FAST, PSPELL_NORMAL and
     PSPELL_BAD_SPELLERS are mutually exclusive, so you should select
     only one of them.
    </para>
    <para>
     For more information and examples, check out inline manual pspell
     website:<ulink url="&url.pspell;">&url.pspell;</ulink>.
    </para>
    <para>
     <example>
      <title><function>Pspell_new_personal</function></title>
      <programlisting role="php">
$pspell_link = pspell_new_personal ("/var/dictionaries/custom.pws", 
                "en", "", "", "", PSPELL_FAST|PSPELL_RUN_TOGETHER));
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-save-wordlist">
   <refnamediv>
    <refname>pspell_save_wordlist</refname>
    <refpurpose>Save the personal wordlist to a file.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pspell_save_wordlist</function></funcdef>
      <paramdef>int <parameter>dictionary_link</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Pspell_save_wordlist</function> saves the personal wordlist
         from the current session. The dictionary has to be open with
         <function>pspell_new_personal</function>, and the location of files to be
         saved specified with <function>pspell_config_personal</function> and 
         (optionally) <function>pspell_config_repl</function>. Please, note that
         this function will not work unless you have pspell .11.2 and aspell .32.5
         or later.
    </simpara>
    <para>
     <example>
      <title><function>Pspell_add_to_personal</function></title>
      <programlisting role="php">
$pspell_config = pspell_config_create ("en");
pspell_config_personal ($pspell_config, "/tmp/dicts/newdict");
$pspell_link = pspell_new_config ($pspell_config);

pspell_add_to_personal ($pspell_link, "Vlad");
pspell_save_wordlist ($pspell_link);
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-store-replacement">
   <refnamediv>
    <refname>pspell_store_replacement</refname>
    <refpurpose>Store a replacement pair for a word</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>pspell_store_replacement</function></funcdef>
      <paramdef>int <parameter>dictionary_link</parameter></paramdef>
      <paramdef>string <parameter>misspelled</parameter></paramdef>
      <paramdef>string <parameter>correct</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Pspell_store_replacement</function> stores a replacement pair for
         a word, so that replacement can be returned by
         <function>pspell_suggest</function> later. In order to be able to take
         advantage of this function, you have to use 
         <function>pspell_new_personal</function> to open the dictionary. In order
         to permanently save the replacement pair, you have to
         use <function>pspell_config_personal</function> and
         <function>pspell_config_repl</function> to set the path where to save your
         custom wordlists, and then use <function>pspell_save_wordlist</function>
         for the changes to be written to disk. Please, note that this function
         will not work unless you have pspell .11.2 and aspell .32.5 or later.
    </simpara>
    <para>
     <example>
      <title><function>Pspell_store_replacement</function></title>
      <programlisting role="php">
$pspell_config = pspell_config_create ("en");
pspell_config_personal ($pspell_config, "/var/dictionaries/custom.pws");
pspell_config_repl ($pspell_config, "/var/dictionaries/custom.repl");
$pspell_link = pspell_new_config ($pspell_config);

pspell_store_replacement ($pspell_link, $misspelled, $correct);
pspell_save_wordlist ($pspell_link);
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.pspell-suggest">
   <refnamediv>
    <refname>pspell_suggest</refname>
    <refpurpose>Suggest spellings of a word</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>pspell_suggest</function></funcdef>
      <paramdef>int <parameter>dictionary_link</parameter></paramdef>
      <paramdef>string <parameter>word</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Pspell_suggest</function> returns an array of possible
     spellings for the given word.
    </simpara>
    <para>
     <example>
      <title><function>Pspell_suggest</function></title>
      <programlisting role="php">
$pspell_link = pspell_new ("en");

if (!pspell_check ($pspell_link, "testt")) {
    $suggestions = pspell_suggest ($pspell_link, "testt");

    for ($i=0; $i &lt; count ($suggestions); $i++) {
        echo "Possible spelling: " . $suggestions[$i] . "&lt;br>"; 
    }
}
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/readline.xml
+++ phpdoc/kr/functions/readline.xml
 <reference id="ref.readline">
  <title>GNU Readline</title>
  <titleabbrev>Readline</titleabbrev>

  <partintro>
   <simpara>
    The <function>readline</function> functions implement an interface
    to the GNU Readline library.  These are functions that provide
    editable command lines.  An example being the way Bash allows you
    to use the arrow keys to insert characters or scroll through
    command history.  Because of the interactive nature of this
    library, it will be of little use for writing Web applications,
    but may be useful when writing scripts meant to be run from a
    shell.
   </simpara>
   <simpara>
    The home page of the GNU Readline project is
    <ulink url="&url.readline;">&url.readline;</ulink>.  It's maintained
    by Chet Ramey, who's also the author of Bash.
   </simpara>
  </partintro>

  <refentry id="function.readline">
   <refnamediv>
    <refname>readline</refname>
    <refpurpose>Reads a line</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>readline</function></funcdef>
      <paramdef>string 
       <parameter><optional>prompt</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns a single string from the user.  You may
     specify a string with which to prompt the user.  The line
     returned has the ending newline removed.  You must add this line
     to the history yourself using
     <function>readline_add_history</function>.
    </para>
    <example>
     <title><function>Readline</function></title>
     <programlisting role="php">
//get 3 commands from user
for ($i=0; $i < 3; $i++) {
        $line = readline ("Command: ");
        readline_add_history ($line);
}

//dump history
print_r (readline_list_history());

//dump variables
print_r (readline_info());
     </programlisting>
    </example>
   </refsect1>
  </refentry>

  <refentry id="function.readline-add-history">
   <refnamediv>
    <refname>readline_add_history</refname>
    <refpurpose>Adds a line to the history</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>readline_add_history</function></funcdef>
      <paramdef>string <parameter>line</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function adds a line to the command line history.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.readline-clear-history">
   <refnamediv>
    <refname>readline_clear_history</refname>
    <refpurpose>Clears the history</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>readline_clear_history</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function clears the entire command line history.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.readline-completion-function">
   <refnamediv>
    <refname>readline_completion_function</refname>
    <refpurpose>Registers a completion function</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean 
       <function>readline_completion_function</function>
      </funcdef>
      <paramdef>string <parameter>line</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function registers a completion function.  You must supply
     the name of an existing function which accepts a partial command
     line and returns an array of possible matches.  This is the same
     kind of functionality you'd get if you hit your tab key while
     using Bash.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.readline-info">
   <refnamediv>
    <refname>readline_info</refname>
    <refpurpose>Gets/sets various internal readline variables</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>readline_info</function></funcdef>
      <paramdef>string 
       <parameter><optional>varname</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>newvalue</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     If called with no parameters, this function returns an array of
     values for all the setting readline uses.  The elements will
     be indexed by the following values: done, end, erase_empty_line,
     library_version, line_buffer, mark, pending_input, point, prompt,
     readline_name, and terminal_name.
    </para>
    <para>
     If called with one parameter, the value of that setting is
     returned.  If called with two parameters, the setting will be
     changed to the given value.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.readline-list-history">
   <refnamediv>
    <refname>readline_list_history</refname>
    <refpurpose>Lists the history</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>readline_list_history</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns an array of the entire command line
     history.  The elements are indexed by integers starting at zero.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.readline-read-history">
   <refnamediv>
    <refname>readline_read_history</refname>
    <refpurpose>Reads the history</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean 
       <function>readline_read_history</function>
      </funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function reads a command history from a file.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.readline-write-history">
   <refnamediv>
    <refname>readline_write_history</refname>
    <refpurpose>Writes the history</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean 
       <function>readline_write_history</function>
      </funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function writes the command history to a file.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/recode.xml
+++ phpdoc/kr/functions/recode.xml
 <reference id="ref.recode">
  <title>GNU Recode functions</title>
  <titleabbrev>Recode</titleabbrev>

  <partintro>
   <para>
    This module contains an interface to the GNU Recode library,
    version 3.5. To be able to use the functions defined in this
    module you must compile you PHP interpreter using the --with-recode
    option. In order to do so, you must have GNU Recode 3.5 or higher
    installed on your system.
   </para>
   <para>
    The GNU Recode library converts files between various coded
    character sets and surface encodings. When this cannot be
    achieved exactly, it may get rid of the offending characters or
    fall back on approximations. The library recognises or produces
    nearly 150 different character sets and is able to convert files
    between almost any pair. Most RFC 1345 character sets are supported.
   </para>
  </partintro>

  <refentry id="function.recode-string">
   <refnamediv>
    <refname>recode_string</refname>
    <refpurpose>Recode a string according to a recode request</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>recode_string</function></funcdef>
      <paramdef>string <parameter>request</parameter></paramdef>
      <paramdef>string <parameter>string</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Recode the string <parameter>string</parameter> according to
     the recode request <parameter>request</parameter>. Returns the
     recoded string or FALSE, if unable to perform the recode request.
    </para>
    <para>
     A simple recode request may be &quot;lat1..iso646-de&quot;.
     See also the GNU Recode documentation of your installation
     for detailed instructions about recode requests.
    <example>
     <title>Basic <function>recode_string</function> example:</title>
      <programlisting role="php">
print recode_string (&quot;us..flat&quot;, &quot;The following character has a 
diacritical mark: &amp;aacute;&quot;);
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.recode">
   <refnamediv>
    <refname>recode</refname>
    <refpurpose>Recode a string according to a recode request</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>recode_string</function></funcdef>
      <paramdef>string <parameter>request</parameter></paramdef>
      <paramdef>string <parameter>string</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <note>
     <simpara>
      This is an alias for <function>recode_string</function>. It has
      been added in PHP 4.
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.recode-file">
   <refnamediv>
    <refname>recode_file</refname>
    <refpurpose>
     Recode from file to file according to recode request
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>recode_file</function></funcdef>
      <paramdef>string <parameter>request</parameter></paramdef>
      <paramdef>resource <parameter>input</parameter></paramdef>
      <paramdef>resource <parameter>output</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Recode the file referenced by file handle
     <parameter>input</parameter> into the file referenced by file
     handle <parameter>output</parameter> according to the recode
     <parameter>request</parameter>.  Returns FALSE, if unable to
     comply, TRUE otherwise.
    </para>
    <para>
     This function does not currently process filehandles referencing
     remote files (URLs). Both filehandles must refer to local files.
    </para>
    <para>
    <example>
     <title>Basic <function>recode_file</function> example</title>
      <programlisting role="php">
$input = fopen ('input.txt', 'r');
$output = fopen ('output.txt', 'w');
recode_file (&quot;us..flat&quot;, $input, $output);
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/regex.xml
+++ phpdoc/kr/functions/regex.xml
 <reference id="ref.regex">
  <title>Regular Expression Functions (POSIX Extended)</title>
  <titleabbrev>Regexps</titleabbrev>

  <partintro>
   <para>
    Regular expressions are used for complex string manipulation in
    PHP. The functions that support regular expressions are:
    <itemizedlist>
     <listitem>
      <simpara><function>ereg</function></simpara>
     </listitem>
     <listitem>
      <simpara><function>ereg_replace</function></simpara>
     </listitem>
     <listitem>
      <simpara><function>eregi</function></simpara>
     </listitem>
     <listitem>
      <simpara><function>eregi_replace</function></simpara>
     </listitem>
     <listitem>
      <simpara><function>split</function></simpara>
     </listitem>
     <listitem>
      <simpara><function>spliti</function></simpara>
     </listitem>
    </itemizedlist>
    These functions all take a regular expression string as their
    first argument.  PHP uses the POSIX extended regular expressions
    as defined by POSIX 1003.2.  For a full description of POSIX
    regular expressions see the regex man pages included in the regex
    directory in the PHP distribution. It's in manpage format, so
    you'll want to do something along the lines of <command>man
    /usr/local/src/regex/regex.7</command> in order to read it.

    <!-- Should add discussion of PCRE functions here. -->

   </para>
   <para>
    <example>
     <title>Regular Expression Examples</title>
     <programlisting role="php">
ereg (&quot;abc&quot;, $string);            
/* Returns true if &quot;abc&quot;
   is found anywhere in $string. */

ereg (&quot;^abc&quot;, $string);
/* Returns true if &quot;abc&quot;
   is found at the beginning of $string. */

ereg ("abc$", $string);
/* Returns true if &quot;abc&quot;
   is found at the end of $string. */

eregi ("(ozilla.[23]|MSIE.3)", $HTTP_USER_AGENT);  
/* Returns true if client browser
   is Netscape 2, 3 or MSIE 3. */

ereg ("([[:alnum:]]+) ([[:alnum:]]+) ([[:alnum:]]+)", $string,$regs); 
/* Places three space separated words
   into $regs[1], $regs[2] and $regs[3]. */

$string = ereg_replace ("^", "&lt;BR&gt;", $string); 
/* Put a &lt;BR&gt; tag at the beginning of $string. */
 
$string = ereg_replace ("$", "&lt;BR&gt;", $string); 
/* Put a &lt;BR&gt; tag at the end of $string. */

$string = ereg_replace ("\n", "", $string);
/* Get rid of any newline
   characters in $string. */
     </programlisting>
    </example>
   </para>
  </partintro>

  <refentry id="function.ereg">
   <refnamediv>
    <refname>ereg</refname>
    <refpurpose>Regular expression match</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ereg</function></funcdef>
      <paramdef>string <parameter>pattern</parameter></paramdef>
      <paramdef>string <parameter>string</parameter></paramdef>
      <paramdef>array 
       <parameter><optional>regs</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Searches a <parameter>string</parameter> for matches to the regular
     expression given in <parameter>pattern</parameter>.
    </simpara>
    <simpara>
     If matches are found for parenthesized substrings of
     <parameter>pattern</parameter> and the function is called with
     the third argument <parameter>regs</parameter>, the matches will
     be stored in the elements of the array
     <parameter>regs</parameter>. $regs[1] will contain the substring
     which starts at the first left parenthesis; $regs[2] will contain
     the substring starting at the second, and so on. $regs[0] will
     contain a copy of <parameter>string</parameter>.
    </simpara>
    <simpara>
     If <function>ereg</function> finds any matches at all, $regs will
     be filled with exactly ten elements, even though more or fewer
     than ten parenthesized substrings may actually have matched.
     This has no effect on <function>ereg</function>'s ability to
     match more substrings. If no matches are found, $regs will not be
     altered by <function>ereg</function>.
    </simpara>
    <simpara>
     Searching is case sensitive.
    </simpara>
    <simpara>
     Returns true if a match for <parameter>pattern</parameter> was
     found in <parameter>string</parameter>, or false if no matches
     were found or an error occurred.
    </simpara>
    <para>
     The following code snippet takes a date in ISO format
     (YYYY-MM-DD) and prints it in DD.MM.YYYY format:
     <example>
      <title><function>Ereg</function> Example</title>
      <programlisting role="php">
if (ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", $date, $regs)) {
    echo "$regs[3].$regs[2].$regs[1]";
} else {
    echo "Invalid date format: $date";
}
      </programlisting>
     </example>
    </para>
    <simpara>
     See also <function>eregi</function>,
     <function>ereg_replace</function>, and
     <function>eregi_replace</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.ereg-replace">
   <refnamediv>
    <refname>ereg_replace</refname>
    <refpurpose>Replace regular expression</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ereg_replace</function></funcdef>
      <paramdef>string <parameter>pattern</parameter></paramdef>
      <paramdef>string <parameter>replacement</parameter></paramdef>
      <paramdef>string <parameter>string</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     This function scans <parameter>string</parameter> for matches to
     <parameter>pattern</parameter>, then replaces the matched text
     with <parameter>replacement</parameter>.
    </simpara>
    <simpara>
     The modified string is returned. (Which may mean that the
     original string is returned if there are no matches to be
     replaced.)
    </simpara>
    <simpara>
     If <parameter>pattern</parameter> contains parenthesized
     substrings, <parameter>replacement</parameter> may contain
     substrings of the form
     <literal>\\<replaceable>digit</replaceable></literal>, which will
     be replaced by the text matching the digit'th parenthesized
     substring; <literal>\\0</literal> will produce the entire
     contents of string.  Up to nine substrings may be used.
     Parentheses may be nested, in which case they are counted by the
     opening parenthesis.
    </simpara>  
    <simpara>
     If no matches are found in <parameter>string</parameter>, then
     <parameter>string</parameter> will be returned unchanged.
    </simpara>
    <para>
     For example, the following code snippet prints "This was a test"
     three times:
     <example>
      <title><function>Ereg_replace</function> Example</title>
      <programlisting>
$string = "This is a test";
echo ereg_replace (" is", " was", $string);
echo ereg_replace ("( )is", "\\1was", $string);
echo ereg_replace ("(( )is)", "\\2was", $string);
      </programlisting>
     </example>
    </para>
    <para>
     One thing to take note of is that if you use an integer value as
     the <parameter>replacement</parameter> parameter, you may not get
     the results you expect. This is because
     <function>ereg_replace</function> will interpret the number as
     the ordinal value of a character, and apply that. For instance:
     <example>
      <title><function>ereg_replace</function> Example</title>
      <programlisting>
&lt;?php
/* This will not work as expected. */
$num = 4;
$string = "This string has four words.";
$string = ereg_replace('four', $num, $string);
echo $string;   /* Output: 'This string has   words.' */

/* This will work. */
$num = '4';
$string = "This string has four words.";
$string = ereg_replace('four', $num, $string);
echo $string;   /* Output: 'This string has 4 words.' */
?>
      </programlisting>
     </example>
    </para>
    <simpara>
     See also <function>ereg</function>, <function>eregi</function>,
     and <function>eregi_replace</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.eregi">
   <refnamediv>
    <refname>eregi</refname>
    <refpurpose>case insensitive regular expression match</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>eregi</function></funcdef>
      <paramdef>string <parameter>pattern</parameter></paramdef>
      <paramdef>string <parameter>string</parameter></paramdef>
      <paramdef>array 
       <parameter><optional>regs</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function is identical to <function>ereg</function> except
     that this ignores case distinction when matching alphabetic
     characters.
    </para>
    <para>
     See also <function>ereg</function>,
     <function>ereg_replace</function>, and
     <function>eregi_replace</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.eregi-replace">
   <refnamediv>
    <refname>eregi_replace</refname>
    <refpurpose>replace regular expression case insensitive</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>eregi_replace</function></funcdef>
      <paramdef>string <parameter>pattern</parameter></paramdef>
      <paramdef>string <parameter>replacement</parameter></paramdef>
      <paramdef>string <parameter>string</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function is identical to <function>ereg_replace</function>
     except that this ignores case distinction when matching
     alphabetic characters.
    </para>
    <para>
     See also <function>ereg</function>, <function>eregi</function>,
     and <function>ereg_replace</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.split">
   <refnamediv>
    <refname>split</refname>
    <refpurpose>split string into array by regular expression</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>split</function></funcdef>
      <paramdef>string <parameter>pattern</parameter></paramdef>
      <paramdef>string <parameter>string</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>limit</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of strings, each of which is a substring of
     <parameter>string</parameter> formed by splitting it on
     boundaries formed by the regular expression
     <parameter>pattern</parameter>.  If <parameter>limit</parameter>
     is set, the returned array will contain a maximum of
     <parameter>limit</parameter> elements with the last element
     containing the whole rest of <parameter>string</parameter>.  If
     an error occurs, <function>split</function> returns false.
    </para>
    <para>
     To split off the first four fields from a line from
     <filename>/etc/passwd</filename>:
     <example>
      <title><function>Split</function> Example</title>
      <programlisting role="php">
$passwd_list = split (":", $passwd_line, 5);
      </programlisting>
     </example>
    </para>
    <para>
     To parse a date which may be delimited with slashes, dots, or
     hyphens:
     <example>
      <title><function>Split</function> Example</title>
      <programlisting role="php">
$date = "04/30/1973";  // Delimiters may be slash, dot, or hyphen
list ($month, $day, $year) = split ('[/.-]', $date);
echo "Month: $month; Day: $day; Year: $year&lt;br&gt;\n";
      </programlisting>
     </example>
    </para>

    <para>
     Note that <parameter>pattern</parameter> is case-sensitive.
    </para>

    <para>
     Note that if you don't require the power of regular expressions,
     it is faster to use <function>explode</function>, which doesn't
     incur the overhead of the regular expression engine.
    </para>

    <para>
     For users looking for a way to emulate perl's <command>$chars =
      split('', $str)</command> behaviour, please see the examples for
     <function>preg_split</function>.
    </para>

    <para>
     Please note that <parameter>pattern</parameter> is a regular
     expression.  If you want to split on any of the characters which
     are considered special by regular expressions, you'll need to
     escape them first. If you think <function>split</function> (or
     any other regex function, for that matter) is doing something
     weird, please read the file <filename>regex.7</filename>,
     included in the <filename>regex/</filename> subdirectory of the
     PHP distribution. It's in manpage format, so you'll want to do
     something along the lines of <command>man
     /usr/local/src/regex/regex.7</command> in order to read it.
    </para>

    <para>
     See also: <function>spliti</function>,
     <function>explode</function>, and <function>implode</function>.
    </para>

   </refsect1>
  </refentry>
  
  <refentry id="function.spliti">
   <refnamediv>
    <refname>spliti</refname>
    <refpurpose>
     Split string into array by regular expression case insensitive
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>split</function></funcdef>
      <paramdef>string <parameter>pattern</parameter></paramdef>
      <paramdef>string <parameter>string</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>limit</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function is identical to <function>split</function> except
     that this ignores case distinction when matching alphabetic
     characters.
    </para>
    <para>
     See also: <function>split</function>,
     <function>explode</function>, and <function>implode</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sql-regcase">
   <refnamediv>
    <refname>sql_regcase</refname>
    <refpurpose>
     Make regular expression for case insensitive match
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>sql_regcase</function></funcdef>
      <paramdef>string <parameter>string</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a valid regular expression which will match
     <parameter>string</parameter>, ignoring case. This expression is
     <parameter>string</parameter> with each character converted to a
     bracket expression; this bracket expression contains that
     character's uppercase and lowercase form if applicable, otherwise
     it contains the original character twice.
     <example>
      <title><function>Sql_regcase</function> Example</title>
      <programlisting role="php">
echo sql_regcase ("Foo bar");
      </programlisting>
     </example>
     prints <screen>[Ff][Oo][Oo][  ][Bb][Aa][Rr]</screen>.
    </para>
    <para>
     This can be used to achieve case insensitive pattern matching in
     products which support only case sensitive regular expressions.
    </para>
   </refsect1>
  </refentry>


 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/satellite.xml
+++ phpdoc/kr/functions/satellite.xml
<!-- 

        $Id: satellite.xml,v 1.1 2001/01/10 01:05:47 corean Exp $

        Author: David Eriksson <[EMAIL PROTECTED]> 

-->

 <reference id="ref.satellite">
  <title>Satellite CORBA client extension</title>
  <titleabbrev>Satellite</titleabbrev>

  <partintro>
   <para>
    The Satellite extension is used for accessing CORBA objects.  You
    will need to set the idl_directory= entry in php.ini to a path
    where you store all IDL files you use.
   </para>
  </partintro>

  <refentry id="class.orbitobject">
   <refnamediv>
    <refname>OrbitObject</refname>
    <refpurpose>Access CORBA objects</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>new <function>OrbitObject</function></funcdef>
      <paramdef>string <parameter>ior</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This class provides access to a CORBA object. The
     <parameter>ior</parameter> parameter should be a string
     containing the IOR (Interoperable Object Reference) that
     identifies the remote object.
    </para>
    <para>
     <example>
      <title>Sample IDL file</title>
      <programlisting>
interface MyInterface {
    void SetInfo (string info);
    string GetInfo();

    attribute int value;
}
      </programlisting>
     </example>
    </para>
    <para>
     <example>
      <title>PHP code for accessing MyInterface</title>
      <programlisting role="php">
&lt;?php
$obj = new OrbitObject ($ior);

$obj->SetInfo ("A 2GooD object");

echo $obj->GetInfo();

$obj->value = 42;

echo $obj->value;
?>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="class.orbitenum">
   <refnamediv>
    <refname>OrbitEnum</refname>
    <refpurpose>Use CORBA enums</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>new <function>OrbitEnum</function></funcdef>
      <paramdef>string <parameter>id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This class represents the enumeration identified with the
     <parameter>id</parameter> parameter.  The
     <parameter>id</parameter> can be either the name of the
     enumeration (e.g "MyEnum"), or the full repository id
     (e.g. "IDL:MyEnum:1.0").
    </para>
    <para>
     <example>
      <title>Sample IDL file</title>
      <programlisting>
enum MyEnum {
    a,b,c,d,e
};
      </programlisting>
     </example>
    </para>
    <para>
     <example>
      <title>PHP code for accessing MyEnum</title>
      <programlisting role="php">
&lt;?php
$enum = new OrbitEnum ("MyEnum");

echo $enum->a;  /* write 0 */
echo $enum->c;  /* write 2 */
echo $enum->e;  /* write 4 */
?>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="class.orbitstruct">
   <refnamediv>
    <refname>OrbitStruct</refname>
    <refpurpose>Use CORBA structs</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>new <function>OrbitStruct</function></funcdef>
      <paramdef>string <parameter>id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This class represents the structure identified with the
     <parameter>id</parameter> parameter.  The
     <parameter>id</parameter> can be either the name of the struct
     (e.g "MyStruct"), or the full repository id
     (e.g. "IDL:MyStruct:1.0").
    </para>
    <para>
     <example>
      <title>Sample IDL file</title>
      <programlisting>
struct MyStruct {
    short shortvalue;
    string stringvalue;
};

interface SomeInterface {
  void SetValues (MyStruct values);
  MyStruct GetValues();
}
      </programlisting>
     </example>
    </para>
    <para>
     <example>
      <title>PHP code for accessing MyStruct</title>
      <programlisting role="php">
&lt;?php
$obj = new OrbitObject ($ior);

$initial_values = new OrbitStruct ("IDL:MyStruct:1.0");
$initial_values->shortvalue = 42;
$initial_values->stringvalue = "HGTTG";

$obj->SetValues ($initial_values);

$values = $obj->GetValues();

echo $values->shortvalue;
echo $values->stringvalue;
?>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.satellite_caught_exception">
   <refnamediv>
    <refname>satellite_caught_exception</refname>
    <refpurpose>
     See if an exception was caught from the previous function
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool 
       <function>satellite_caught_exception</function>
      </funcdef>
      <paramdef></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns true if an exception has been caught.
    </para>
    <para>
     <example>
      <title>Sample IDL file</title>
      <programlisting>
/* ++?????++ Out of Cheese Error. Redo From Start. */
exception OutOfCheeseError {
    int parameter;
}

interface AnotherInterface {
    void AskWhy() raises (OutOfCheeseError);
}
      </programlisting>
     </example>
    </para>
    <para>
     <example>
      <title>PHP code for handling CORBA exceptions</title>
      <programlisting role="php">
&lt;?php
$obj = new OrbitObject ($ior);

$obj->AskWhy();

if (satellite_caught_exception()) {
    if ("IDL:OutOfCheeseError:1.0" == satellite_exception_id()) {
        $exception = satellite_exception_value();
        echo $exception->parameter;
    }
}
?>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.satellite_exception_id">
   <refnamediv>
    <refname>satellite_exception_id</refname>
    <refpurpose>Get the repository id for the latest excetpion.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>satellite_exception_id</function></funcdef>
      <paramdef></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Return a repository id string. (E.g. "IDL:MyException:1.0".)  For
     example usage see
     <function>satellite_caught_exception</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.satellite_exception_value">
   <refnamediv>
    <refname>satellite_exception_value</refname>
    <refpurpose>
     Get the exception struct for the latest exception
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>OrbitStruct 
       <function>satellite_exception_value</function>
      </funcdef>
      <paramdef></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Return an exception struct.  For example usage see
     <function>satellite_caught_exception</function>.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->


Index: phpdoc/kr/functions/sem.xml
+++ phpdoc/kr/functions/sem.xml
 <reference id="ref.sem">
  <title>Semaphore and Shared Memory Functions</title>
  <titleabbrev>Semaphore</titleabbrev>

  <partintro>
   <para>
    This module provides semaphore functions using System V
    semaphores.  Semaphores may be used to provide exclusive access to
    resources on the current machine, or to limit the number of
    processes that may simultaneously use a resource.
   </para>
   <para>
    This module provides also shared memory functions using System V
    shared memory. Shared memory may be used to provide access to
    global variables. Different httpd-daemons and even other programs
    (such as Perl, C, ...) are able to access this data to provide a
    global data-exchange. Remember, that shared memory is NOT safe
    against simultaneous access. Use semaphores for synchronization.
    <table>
     <title>Limits of Shared Memory by the Unix OS</title>
     <tgroup cols="2">
      <tbody>
       <row>
        <entry>SHMMAX</entry> 
        <entry>max size of shared memory, normally 131072 bytes</entry>
       </row>
       <row>
        <entry>SHMMIN</entry>
        <entry>minimum size of shared memory, normally 1 byte</entry>
       </row>
       <row>
        <entry>SHMMNI</entry> 
        <entry>
         max amount of shared memory segments on a system,
         normally 100
        </entry>
       </row>
       <row>
        <entry>SHMSEG</entry>
        <entry>
         max amount of shared memory segments per process, normally 6
        </entry>
       </row>
      </tbody>
     </tgroup>
    </table>
   </para>
   <note>
    <simpara>
     These functions do not work on Windows systems.
    </simpara>
   </note>
  </partintro>

  <refentry id="function.sem-get">
   <refnamediv>
    <refname>sem_get</refname>
    <refpurpose>Get a semaphore id</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>sem_get</function></funcdef>
      <paramdef>int <parameter>key</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>max_acquire</optional></parameter>
      </paramdef>
      <paramdef>int 
       <parameter><optional>perm</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns: A positive semaphore identifier on success, or false on
     error.
    </para>
    <para>
     <function>Sem_get</function> returns an id that can be used to
     access the System V semaphore with the given key.  The semaphore
     is created if necessary using the permission bits specified in
     perm (defaults to 0666).  The number of processes that can
     acquire the semaphore simultaneously is set to max_acquire
     (defaults to 1).  Actually this value is set only if the process
     finds it is the only process currently attached to the semaphore.
    </para>
    <para>
     A second call to <function>sem_get</function> for the same key
     will return a different semaphore identifier, but both
     identifiers access the same underlying semaphore.
    </para>  
    <para> 
     See also: <function>sem_acquire</function> and
     <function>sem_release</function>.
    </para>
    <note>
     <simpara>
      This function does not work on Windows systems
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.sem-acquire">
   <refnamediv>
    <refname>sem_acquire</refname>
    <refpurpose>Acquire a semaphore</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>sem_acquire</function></funcdef>
      <paramdef>int <parameter>sem_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns: true on success, false on error.
    </para>
    <para>
     <function>Sem_acquire</function> blocks (if necessary) until the
     semaphore can be acquired.  A process attempting to acquire a
     semaphore which it has already acquired will block forever
     if acquiring the semaphore would cause its max_acquire value to
     be exceeded.
    </para>
    <para>
     After processing a request, any semaphores acquired by the
     process but not explicitly released will be released automatically
     and a warning will be generated.
    </para>
    <para> 
     See also: <function>sem_get</function> and
     <function>sem_release</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sem-release">
   <refnamediv>
    <refname>sem_release</refname>
    <refpurpose>Release a semaphore</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>sem_release</function></funcdef>
      <paramdef>int <parameter>sem_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns: true on success, false on error.
    </para>
    <para>
     <function>Sem_release</function> releases the semaphore if it
     is currently acquired by the calling process, otherwise
     a warning is generated.
    </para>
    <para>
      After releasing the semaphore, <function>sem_acquire</function>
      may be called to re-acquire it.
    </para>
    <para> 
     See also: <function>sem_get</function> and
     <function>sem_acquire</function>.
    </para>
    <note>
     <simpara>
      This function does not work on Windows systems
     </simpara>
    </note>    
   </refsect1>
  </refentry>

  <refentry id="function.shm-attach">
   <refnamediv>
    <refname>shm_attach</refname>
    <refpurpose>Creates or open a shared memory segment</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>shm_attach</function></funcdef>
      <paramdef>int <parameter>key</parameter></paramdef> 
      <paramdef>int
       <parameter><optional>memsize</optional></parameter>
      </paramdef>
      <paramdef>int
       <parameter><optional>perm</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Shm_attach</function> returns an id that that can be
     used to access the System V shared memory with the given key, the
     first call creates the shared memory segment with mem_size
     (default: sysvshm.init_mem in the <link
     linkend="configuration.file">configuration file</link>, otherwise
     10000 bytes) and the optional perm-bits (default: 0666).
    </para>
    <para>
     A second call to <function>shm_attach</function> for the same
     <parameter>key</parameter> will return a different shared memory
     identifier, but both identifiers access the same underlying
     shared memory. <parameter>Memsize</parameter> and
     <parameter>perm</parameter> will be ignored.
    </para>
    <note>
     <simpara>
      This function does not work on Windows systems
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.shm-detach">
   <refnamediv>
    <refname>shm_detach</refname>
    <refpurpose>Disconnects from shared memory segment</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>shm_detach</function></funcdef>
      <paramdef>int <parameter>shm_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Shm_detach</function> disconnects from the shared
     memory given by the <parameter>shm_identifier</parameter> created
     by <function>shm_attach</function>. Remember, that shared memory
     still exist in the Unix system and the data is still present.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.shm-remove">
   <refnamediv>
    <refname>shm_remove</refname> 
    <refpurpose>Removes shared memory from Unix systems</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>shm_remove</function></funcdef>
      <paramdef>int <parameter>shm_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Removes shared memory from Unix systems. All data will be
     destroyed.
    </para>
    <note>
     <simpara>
      This function does not work on Windows systems
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.shm-put-var">
   <refnamediv>
    <refname>shm_put_var</refname> 
    <refpurpose>Inserts or updates a variable in shared
     memory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>shm_put_var</function></funcdef>
      <paramdef>int <parameter>shm_identifier</parameter></paramdef>
      <paramdef>int <parameter>variable_key</parameter></paramdef>
      <paramdef>mixed <parameter>variable</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Inserts or updates a <parameter>variable</parameter> with a given
     <parameter>variable_key</parameter>. All variable-types (double,
     int, string, array) are supported.
    </para> 
    <note>
     <simpara>
      This function does not work on Windows systems
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.shm-get-var">
   <refnamediv>
    <refname>shm_get_var</refname> 
    <refpurpose>Returns a variable from shared memory
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>shm_get_var</function></funcdef>
      <paramdef>int <parameter>id</parameter></paramdef>
      <paramdef>int <parameter>variable_key</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Shm_get_var</function> returns the variable with a given
     <parameter>variable_key</parameter>. The variable is still present
     in the shared memory.
    </para>
    <note>
     <simpara>
      This function does not work on Windows systems
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.shm-remove-var">
   <refnamediv>
    <refname>shm_remove_var</refname> 
    <refpurpose>Removes a variable from shared memory
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>shm_remove_var</function></funcdef>
      <paramdef>int <parameter>id</parameter></paramdef>
      <paramdef>int <parameter>variable_key</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Removes a variable with a given <parameter>variable_key</parameter>
     and frees the occupied memory.
    </para>
    <note>
     <simpara>
      This function does not work on Windows systems
     </simpara>
    </note>
   </refsect1>
  </refentry>

</reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/sesam.xml
+++ phpdoc/kr/functions/sesam.xml
 <reference id="ref.sesam">
  <title>SESAM database functions</title>
  <titleabbrev>SESAM</titleabbrev>

  <partintro>
   <para>
    SESAM/SQL-Server is a mainframe database system, developed by
    Fujitsu Siemens Computers, Germany. It runs on high-end mainframe
    servers using the operating system BS2000/OSD.
   </para>
   <para>
    In numerous productive BS2000 installations, SESAM/SQL-Server has
    proven ...
    <itemizedlist>
     <listitem>
      <simpara>
       the ease of use of Java-, Web- and client/server connectivity,
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       the capability to work with an availability of more than
       99.99%,
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       the ability to manage tens and even hundreds of thousands of
       users.
      </simpara>
     </listitem>
    </itemizedlist>
   </para>
   <para>
    Now there is a PHP3 SESAM interface available which allows
    database operations via PHP-scripts.
   </para>
   <note>
    <title>Configuration notes</title>
    <para>
     There is no standalone support for the PHP SESAM interface, it
     works only as an integrated Apache module. In the Apache PHP
     module, this <link linkend="ini.sect.sesam">SESAM interface is
     configured</link> using Apache directives.
     <table>
      <title>SESAM Configuration directives</title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>Directive</entry>
         <entry>Meaning</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry><literal>php3_sesam_oml</literal></entry>
         <entry>
          Name of BS2000 PLAM library containing the loadable SESAM
          driver modules.  Required for using SESAM functions.
    <para>
     Example:
     <informalexample>
      <programlisting role="apache">
php3_sesam_oml $.SYSLNK.SESAM-SQL.030
      </programlisting>
     </informalexample>
    </para>
   </entry>
   </row>
    <row>
     <entry><literal>php3_sesam_configfile</literal></entry>
     <entry>Name of SESAM application configuration file.
      Required for using SESAM functions.
    <para>
     Example:
     <informalexample>
      <programlisting role="apache">
php3_sesam_configfile $SESAM.SESAM.CONF.AW
      </programlisting>
     </informalexample>
     It will usually contain a configuration like (see SESAM reference
     manual):
     <informalexample>
      <programlisting role="bs2000">
CNF=B
NAM=K
NOTYPE
      </programlisting>
     </informalexample>
    </para>
   </entry>
   </row>
    <row>
     <entry><literal>php3_sesam_messagecatalog</literal></entry>
     <entry>
      Name of SESAM message catalog file.  In most cases, this
      directive is not neccessary. Only if the SESAM message file is
      not installed in the system's BS2000 message file table, it can
      be set with this directive.
    <para>
     Example:
     <informalexample>
      <programlisting role="apache">
php3_sesam_messagecatalog $.SYSMES.SESAM-SQL.030
      </programlisting>
     </informalexample>
    </para>
   </entry>
   </row>
   </tbody>
   </tgroup>
   </table>
   </para>
    <para>
     In addition to the configuration of the PHP/SESAM interface, you
     have to configure the SESAM-Database server itself on your
     mainframe as usual. That means:
     <itemizedlist>
      <listitem>
       <simpara>
        starting the SESAM database handler (DBH), and
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        connecting the databases with the SESAM database handler
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     To get a connection between a PHP script and the database
     handler, the <literal>CNF</literal> and <literal>NAM</literal>
     parameters of the selected SESAM configuration file must match
     the id of the started database handler.
    </para>
    <para>
     In case of distributed databases you have to start a
     SESAM/SQL-DCN agent with the distribution table including the
     host and database names.
    </para>
    <para>
     The communication between PHP (running in the POSIX subsystem)
     and the database handler (running outside the POSIX subsystem) is
     realized by a special driver module called SQLSCI and SESAM
     connection modules using common memory.  Because of the common
     memory access, and because PHP is a static part of the web
     server, database accesses are very fast, as they do not require
     remote accesses via ODBC, JDBC or UTM.
    </para>
    <para>
     Only a small stub loader (SESMOD) is linked with PHP, and the
     SESAM connection modules are pulled in from SESAM's OML PLAM
     library.  In the <link
     linkend="ini.sect.sesam">configuration</link>, you must tell PHP
     the name of this PLAM library, and the file link to use for the
     SESAM configuration file (As of SESAM V3.0, SQLSCI is available
     in the SESAM Tool Library, which is part of the standard
     distribution).
    </para>
    <para>
     Because the SQL command quoting for single quotes uses duplicated
     single quotes (as opposed to a single quote preceded by a
     backslash, used in some other databases), it is advisable to set
     the PHP configuration directives <link
     linkend="ini.magic-quotes-gpc"><literal>php3_magic_quotes_gpc</literal></link>
     and <link
     
linkend="ini.magic-quotes-sybase"><literal>php3_magic_quotes_sybase</literal></link>
     to <literal>On</literal> for all PHP scripts using the SESAM
     interface.
    </para>
   </note>
   <note>
    <title>Runtime considerations</title>
    <para>
     Because of limitations of the BS2000 process model, the driver
     can be loaded only after the Apache server has forked off its
     server child processes. This will slightly slow down the initial
     SESAM request of each child, but subsequent accesses will respond
     at full speed.
    </para>
    <para>
     When explicitly defining a Message Catalog for SESAM, that
     catalog will be loaded each time the driver is loaded (i.e., at
     the initial SESAM request). The BS2000 operating system prints a
     message after successful load of the message catalog, which will
     be sent to Apache's error_log file. BS2000 currently does not
     allow suppression of this message, it will slowly fill up the
     log.
    </para>
    <para>
     Make sure that the SESAM OML PLAM library and SESAM configuration
     file are readable by the user id running the web server.
     Otherwise, the server will be unable to load the driver, and will
     not allow to call any SESAM functions. Also, access to the
     database must be granted to the user id under which the Apache
     server is running. Otherwise, connections to the SESAM database
     handler will fail.
    </para>
   </note>
   <note>
    <title>Cursor Types</title>
    <para>
     The result cursors which are allocated for SQL "select type"
     queries can be either "sequential" or "scrollable". Because of
     the larger memory overhead needed by "scrollable" cursors, the
     default is "sequential".
    </para>
    <para>
     When using "scrollable" cursors, the cursor can be freely
     positioned on the result set. For each "scrollable" query, there
     are global default values for the scrolling type (initialized to:
     <literal>SESAM_SEEK_NEXT</literal>) and the scrolling offset
     which can either be set once by
     <function>sesam_seek_row</function> or each time when fetching a
     row using <function>sesam_fetch_row</function>. When fetching a
     row using a "scrollable" cursor, the following post-processing is
     done for the global default values for the scrolling type and
     scrolling offset:
     <table>
      <title>Scrolled Cursor Post-Processing</title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>Scroll Type</entry>
         <entry>Action</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry><literal>SESAM_SEEK_NEXT</literal></entry>
         <entry>none</entry>
        </row>
        <row>
         <entry><literal>SESAM_SEEK_PRIOR</literal></entry>
         <entry>none</entry>
        </row>
        <row>
         <entry><literal>SESAM_SEEK_FIRST</literal></entry>
         <entry>
          set scroll type to <literal>SESAM_SEEK_NEXT</literal>
         </entry>
        </row>
        <row>
         <entry><literal>SESAM_SEEK_LAST</literal></entry>
         <entry>
          set scroll type to <literal>SESAM_SEEK_PRIOR</literal>
         </entry>
        </row>
        <row>
         <entry><literal>SESAM_SEEK_ABSOLUTE</literal></entry>
         <entry>Auto-Increment internal offset value</entry>
        </row>
        <row>
         <entry><literal>SESAM_SEEK_RELATIVE</literal></entry>
         <entry>none. (maintain global default 
          <parameter>
           offset</parameter> value, which allows for, e.g., fetching
           each 10th row backwards)
         </entry>
        </row>
       </tbody>
      </tgroup>
     </table>
    </para>
   </note>
   <note>
    <title>
     Porting note
    </title>
    <para>
     Because in the PHP world it is natural to start indexes at zero
     (rather than 1), some adaptions have been made to the SESAM
     interface: whenever an indexed array is starting with index 1 in
     the native SESAM interface, the PHP interface uses index 0 as a
     starting point. E.g., when retrieving columns with
     <function>sesam_fetch_row</function>, the first column has the
     index 0, and the subsequent columns have indexes up to (but not
     including) the column count ($array["count"]).  When porting
     SESAM applications from other high level languages to PHP, be
     aware of this changed interface. Where appropriate, the
     description of the respective php sesam functions include a note
     that the index is zero based.
    </para>
   </note>
   <note>
    <title>Security concerns</title>
    <para>
     When allowing access to the SESAM databases, the web server user
     should only have as little privileges as possible. For most
     databases, only read access privilege should be granted.
     Depending on your usage scenario, add more access rights as you
     see fit. Never allow full control to any database for any user
     from the 'net! Restrict access to php scripts which must
     administer the database by using password control and/or SSL
     security.
    </para>
   </note>
   <note>
    <title>Migration from other SQL databases</title>
    <para>
     No two SQL dialects are ever 100% compatible. When porting 
     SQL applications from other database interfaces to SESAM,
     some adaption may be required. The following typical
     differences should be noted:
     <itemizedlist>
      <listitem>
       <simpara>Vendor specific data types</simpara>
       <simpara>
        Some vendor specific data types may have to be replaced by
        standard SQL data types (e.g., <literal>TEXT</literal> could
        be replaced by <literal>VARCHAR(max. size)</literal>).
       </simpara>
      </listitem>
      <listitem>
       <simpara>Keywords as SQL identifiers</simpara>
       <simpara>
        In SESAM (as in standard SQL), such identifiers must be
        enclosed in double quotes (or renamed).
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        Display length in data types
       </simpara>
       <simpara>
        SESAM data types have a precision, not a display
        length. Instead of <literal>int(4)</literal> (intended use:
        integers up to '9999'), SESAM requires simply
        <literal>int</literal> for an implied size of 31 bits. Also,
        the only datetime data types available in SESAM are:
        <literal>DATE</literal>, <literal>TIME(3)</literal> and
        <literal>TIMESTAMP(3)</literal>.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        SQL types with vendor-specific <literal>unsigned</literal>,
        <literal>zerofill</literal>, or
        <literal>auto_increment</literal> attributes
       </simpara>
       <simpara>
        <literal>Unsigned</literal> and<literal> zerofill</literal>
        are not supported.  <literal>Auto_increment</literal> is
        automatic (use <literal>"INSERT ...  VALUES(*, ...)"</literal>
        instead of <literal>"... VALUES(0, ...)"</literal> to take
        advantage of SESAM-implied auto-increment.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <command>int ... DEFAULT '0000'</command>
       </simpara>
       <simpara>
        Numeric variables must not be initialized with string
        constants. Use <command>DEFAULT 0</command> instead. To
        initialize variables of the datetime SQL data types, the
        initialization string must be prefixed with the respective
        type keyword, as in: <literal> CREATE TABLE exmpl ( xtime
        timestamp(3) DEFAULT TIMESTAMP '1970-01-01 00:00:00.000' NOT
        NULL ); </literal>
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <command>$count = xxxx_num_rows();</command>
       </simpara>
       <simpara>
        Some databases promise to guess/estimate the number of the
        rows in a query result, even though the returned value is
        grossly incorrect.  SESAM does not know the number of rows in
        a query result before actually fetching them. If you REALLY
        need the count, try <command>SELECT COUNT(...) WHERE
        ...</command>, it will tell you the number of hits.  A second
        query will (hopefully) return the results.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        <command>DROP TABLE thename;</command>
       </simpara>
       <simpara>
        In SESAM, in the <command>DROP TABLE</command> command, the
        table name must be either followed by the keyword
        <literal>RESTRICT</literal> or
        <literal>CASCADE</literal>. When specifying
        <literal>RESTRICT</literal>, an error is returned if there are
        dependent objects (e.g., VIEWs), while with
        <literal>CASCADE</literal>, dependent objects will be deleted
        along with the specified table.
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
   </note>
   <note>
    <title>
     Notes on the use of various SQL types
    </title>
    <para>
     SESAM does not currently support the BLOB type. A future version
     of SESAM will have support for BLOB.
    </para>
    <para>
     At the PHP interface, the following type conversions are
     automatically applied when retrieving SQL fields:
     <table>
      <title>SQL to PHP Type Conversions</title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>SQL Type</entry>
         <entry>PHP Type</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>SMALLINT, INTEGER</entry>
         <entry>"integer"</entry>
        </row>
        <row>
         <entry>NUMERIC, DECIMAL, FLOAT, REAL, DOUBLE</entry>
         <entry>"double"</entry>
        </row>
        <row>
         <entry>DATE, TIME, TIMESTAMP</entry>
         <entry>"string"</entry>
        </row>
        <row>
         <entry>VARCHAR, CHARACTER</entry>
         <entry>"string"</entry>
        </row>
       </tbody>
      </tgroup>
     </table>
     When retrieving a complete row, the result is returned as an
     array. Empty fields are not filled in, so you will have to check
     for the existence of the individual fields yourself (use
     <function>isset</function> or <function>empty</function> to test
     for empty fields).  That allows more user control over the
     appearance of empty fields (than in the case of an empty string
     as the representation of an empty field).
    </para>
   </note>
   <note>
    <title>Support of SESAM's "multiple fields" feature</title>
    <para>
     The special "multiple fields" feature of SESAM allows a column to
     consist of an array of fields. Such a "multiple field" column can
     be created like this:
     <example>
      <title>Creating a "multiple field" column</title>
      <programlisting role="sesam">
CREATE TABLE multi_field_test (
    pkey CHAR(20) PRIMARY KEY,
    multi(3) CHAR(12)
)
      </programlisting>
     </example>
     and can be filled in using:
     <example>
      <title>Filling a "multiple field" column</title>
      <programlisting role="sesam">
INSERT INTO multi_field_test (pkey, multi(2..3) )
    VALUES ('Second', &lt;'first_val', 'second_val'&gt;)
      </programlisting>
     </example>
     Note that (like in this case) leading empty sub-fields are
     ignored, and the filled-in values are collapsed, so that in the
     above example the result will appear as multi(1..2) instead of
     multi(2..3).
    </para>
    <para>
     When retrieving a result row, "multiple columns" are accessed
     like "inlined" additional columns. In the example above, "pkey"
     will have the index 0, and the three "multi(1..3)" columns will
     be accessible as indices 1 through 3.
    </para>
   </note>
   <para>
    For specific SESAM details, please refer to <ulink
    url="&url.sesam.en;">the SESAM/SQL-Server documentation
    (english)</ulink> or <ulink url="&url.sesam.de;">the
    SESAM/SQL-Server documentation (german)</ulink>, both available
    online, or use the respective manuals.
   </para>
  </partintro>

  <refentry id="function.sesam-connect">
   <refnamediv>
    <refname>sesam_connect</refname>
    <refpurpose>Open SESAM database connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>sesam_connect</function></funcdef>
      <paramdef>string <parameter>catalog</parameter></paramdef>
      <paramdef>string <parameter>schema</parameter></paramdef>
      <paramdef>string <parameter>user</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns <literal>TRUE</literal> if a connection to the SESAM
     database was made, or <literal>FALSE</literal> on error.
    </para>
    <para>
     <function>sesam_connect</function> establishes a connection to an
     SESAM database handler task. The connection is always
     "persistant" in the sense that only the very first invocation
     will actually load the driver from the configured SESAM OML PLAM
     library. Subsequent calls will reuse the driver and will
     immediately use the given catalog, schema, and user.
    </para>
    <para>
     When creating a database, the <parameter>"catalog"</parameter>
     name is specified in the SESAM configuration directive
     <command>//ADD-SQL-DATABASE-CATALOG-LIST ENTRY-1 =
     *CATALOG(CATALOG-NAME = catalogname,...)</command>
    </para>
    <para>
     The <parameter>"schema"</parameter> references the desired
     database schema (see SESAM handbook).
    </para>
    <para>
     The <parameter>"user"</parameter> argument references one of the
     users which are allowed to access this
     <parameter>"catalog"</parameter> /
     <parameter>"schema"</parameter> combination. Note that
     <parameter>"user"</parameter> is completely independent from both
     the system's user id's and from HTTP user/password protection. It
     appears in the SESAM configuration only.
    </para>
    <para>
     See also <function>sesam_disconnect</function>.
     <example>
      <title>Connect to a SESAM database</title>
      <programlisting role="php">
&lt;?php
if (!sesam_connect ("mycatalog", "myschema", "otto")
    die("Unable to connect to SESAM";
?&gt;
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sesam-disconnect">
   <refnamediv>
    <refname>sesam_disconnect</refname>
    <refpurpose>Detach from SESAM connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>sesam_disconnect</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns: always <literal>TRUE</literal>.
    </para>
    <para>
     <function>sesam_disconnect</function> closes the logical link to
     a SESAM database (without actually disconnecting and unloading
     the driver).
    </para>
    <para>
     Note that this isn't usually necessary, as the open connection is
     automatically closed at the end of the script's execution.
     Uncommitted data will be discarded, because an implicit
     <function>sesam_rollback</function> is executed.
    </para>
    <para>
     <function>sesam_disconnect</function> will not close the
     persistent link, it will only invalidate the currently defined
     <parameter>"catalog"</parameter>, <parameter>"schema"</parameter>
     and <parameter>"user"</parameter> triple, so that any sesam
     function called after <function>sesam_disconnect</function> will
     fail.
    </para>
    <para>
     See also: <function>sesam_connect</function>.
     <example>
      <title>Closing a SESAM connection</title>
      <programlisting role="php">
if (sesam_connect ("mycatalog", "myschema", "otto")) {
    ... some queries and stuff ...
    sesam_disconnect(); 
}
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sesam-settransaction">
   <refnamediv>
    <refname>sesam_settransaction</refname>
    <refpurpose>Set SESAM transaction parameters</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>sesam_settransaction</function></funcdef>
      <paramdef>int <parameter>isolation_level</parameter></paramdef>
      <paramdef>int <parameter>read_only</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns: <literal>TRUE</literal> if the values are valid, and the
     <function>settransaction</function> operation was successful,
     <literal>FALSE</literal> otherwise.
    </para>
    <para>
     <function>sesam_settransaction</function> overrides the default
     values for the "isolation level" and "read-only" transaction
     parameters (which are set in the SESAM configuration file), in
     order to optimize subsequent queries and guarantee database
     consistency. The overridden values are used for the next
     transaction only.
    </para>
    <para>
     <function>sesam_settransaction</function> can only be called
     before starting a transaction, not after the transaction has been
     started already.
    </para>
    <para>
     To simplify the use in php scripts, the following constants have
     been predefined in php (see SESAM handbook for detailed
     explanation of the semantics):
     <table>
      <title>
       Valid values for <parameter>"Isolation_Level"</parameter>
       parameter
      </title>
      <tgroup cols="3">
       <thead>
        <row>
         <entry>Value</entry>
         <entry>Constant</entry>
         <entry>Meaning</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>1</entry>
         <entry><literal>SESAM_TXISOL_READ_UNCOMMITTED</literal></entry>
         <entry>Read Uncommitted</entry>
        </row>
        <row>
         <entry>2</entry>
         <entry><literal>SESAM_TXISOL_READ_COMMITTED</literal></entry>
         <entry>Read Committed</entry>
        </row>
        <row>
         <entry>3</entry>
         <entry><literal>SESAM_TXISOL_REPEATABLE_READ</literal></entry>
         <entry>Repeatable Read</entry>
        </row>
        <row>
         <entry>4</entry>
         <entry><literal>SESAM_TXISOL_SERIALIZABLE</literal></entry>
         <entry>Serializable</entry>
        </row>
       </tbody>
      </tgroup>
     </table>
     <table>
      <title>
       Valid values for <parameter>"Read_Only"</parameter> parameter
      </title>
      <tgroup cols="3">
       <thead>
        <row>
         <entry>Value</entry>
         <entry>Constant</entry>
         <entry>Meaning</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>0</entry>
         <entry><literal>SESAM_TXREAD_READWRITE</literal></entry>
         <entry>Read/Write</entry>
        </row>
        <row>
         <entry>1</entry>
         <entry><literal>SESAM_TXREAD_READONLY</literal></entry>
         <entry>Read-Only</entry>
        </row>
       </tbody>
      </tgroup>
     </table>
    </para>
    <para>
     The values set by <function>sesam_settransaction</function> will
     override the default setting specified in the <link
     linkend="ini.sesam-configfile">SESAM configuration file</link>.
    </para>
    <para>
     <example>
      <title>Setting SESAM transaction parameters</title>
      <programlisting role="php">
&lt;?php
sesam_settransaction (SESAM_TXISOL_REPEATABLE_READ,
                     SESAM_TXREAD_READONLY);
?&gt;
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sesam-commit">
   <refnamediv>
    <refname>sesam_commit</refname>
    <refpurpose>
     Commit pending updates to the SESAM database
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>sesam_commit</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns: <literal>TRUE</literal> on success,
     <literal>FALSE</literal> on errors
    </para>
    <para>
     <function>sesam_commit</function> commits any pending updates to
     the database.
    </para>
    <para>
     Note that there is no "auto-commit" feature as in other
     databases, as it could lead to accidental data loss. Uncommitted
     data at the end of the current script (or when calling
     <function>sesam_disconnect</function>) will be discarded by an
     implied <function>sesam_rollback</function> call.
    </para>
    <para>
    </para>
    <para>
     See also: <function>sesam_rollback</function>.
     <example>
      <title>Committing an update to the SESAM database</title>
      <programlisting role="php">
&lt;?php
if (sesam_connect ("mycatalog", "myschema", "otto")) {
    if (!sesam_execimm ("INSERT INTO mytable VALUES (*, 'Small Test', &lt;0, 8, 
15&gt;)"))
        die("insert failed");
    if (!sesam_commit())
        die("commit failed");
}
?&gt;
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.sesam-rollback">
   <refnamediv>
    <refname>sesam_rollback</refname>
    <refpurpose>
     Discard any pending updates to the SESAM database
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>sesam_rollback</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns: <literal>TRUE</literal> on success,
     <literal>FALSE</literal> on errors
    </para>
    <para>
     <function>sesam_rollback</function> discards any pending updates
     to the database. Also affected are result cursors and result
     descriptors.
    </para>
    <para>
     At the end of each script, and as part of the
     <function>sesam_disconnect</function> function, an implied
     <function>sesam_rollback</function> is executed, discarding any
     pending changes to the database.
    </para>
    <para>
     See also: <function>sesam_commit</function>.
     <example>
      <title>Discarding an update to the SESAM database</title>
      <programlisting role="php">
&lt;?php
if (sesam_connect ("mycatalog", "myschema", "otto")) {
    if (sesam_execimm ("INSERT INTO mytable VALUES (*, 'Small Test', &lt;0, 8, 
15&gt;)")
        && sesam_execimm ("INSERT INTO othertable VALUES (*, 'Another Test', 1)"))
        sesam_commit();
    else
        sesam_rollback();
}
?&gt;
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.sesam-execimm">
   <refnamediv>
    <refname>sesam_execimm</refname>
    <refpurpose>Execute an "immediate" SQL-statement</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>sesam_execimm</function></funcdef>
      <paramdef>string <parameter>query</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns: A SESAM "result identifier" on success, or
     <literal>FALSE</literal> on error.
    </para>
    <para>
     <function>sesam_execimm</function> executes an "immediate"
     statement (i.e., a statement like UPDATE, INSERT or DELETE which
     returns no result, and has no INPUT or OUTPUT variables).
     "select type" queries can not be used with
     <function>sesam_execimm</function>.  Sets the
     <parameter>affected_rows</parameter> value for retrieval by the
     <function>sesam_affected_rows</function> function.
    </para>
    <para>
     Note that <function>sesam_query</function> can handle both
     "immediate" and "select-type" queries. Use
     <function>sesam_execimm</function> only if you know beforehand
     what type of statement will be executed.  An attempt to use
     SELECT type queries with <function>sesam_execimm</function> will
     return <literal>$err["sqlstate"] == "42SBW"</literal>.
    </para>
    <para>
     The returned "result identifier" can not be used for retrieving
     anything but the <function>sesam_affected_rows</function>; it is
     only returned for symmetry with the
     <function>sesam_query</function> function.
    </para>
    <para>
     <informalexample>
      <programlisting role="php">
$stmt = "INSERT INTO mytable VALUES ('one', 'two')";
$result = sesam_execimm ($stmt);
$err = sesam_diagnostic();
print ("sqlstate = ".$err["sqlstate"]."\n".
       "Affected rows = ".$err["rowcount"]." == ".
       sesam_affected_rows($result)."\n");
      </programlisting>
     </informalexample>
     See also: <function>sesam_query</function> and
     <function>sesam_affected_rows</function>.
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.sesam-query">
   <refnamediv>
    <refname>sesam_query</refname>
    <refpurpose>Perform a SESAM SQL query and prepare the result</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>sesam_query</function></funcdef>
      <paramdef>string <parameter>query</parameter></paramdef>
      <paramdef>boolean
       <parameter><optional>scrollable</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns: A SESAM "result identifier" on success, or
     <literal>FALSE</literal> on error.
    </para>
    <para>
     A "result_id" resource is used by other functions to retrieve the
     query results.
    </para>
    <para>
     <function>sesam_query</function> sends a query to the currently
     active database on the server. It can execute both "immediate"
     SQL statements and "select type" queries. If an "immediate"
     statement is executed, then no cursor is allocated, and any
     subsequent <function>sesam_fetch_row</function> or
     <function>sesam_fetch_result</function> call will return an empty
     result (zero columns, indicating end-of-result).  For "select
     type" statements, a result descriptor and a (scrollable or
     sequential, depending on the optional boolean
     <parameter>scrollable</parameter> parameter) cursor will be
     allocated. If <parameter>scrollable</parameter> is omitted, the
     cursor will be sequential.
    </para>
    <para>
     When using "scrollable" cursors, the cursor can be freely
     positioned on the result set. For each "scrollable" query, there
     are global default values for the scrolling type (initialized to:
     <literal>SESAM_SEEK_NEXT</literal>) and the scrolling offset
     which can either be set once by
     <function>sesam_seek_row</function> or each time when fetching a
     row using <function>sesam_fetch_row</function>.
    </para>
    <para>
     For "immediate" statements, the number of affected rows is saved
     for retrieval by the <function>sesam_affected_rows</function>
     function.
    </para>
    <para>
     See also: <function>sesam_fetch_row</function> and
     <function>sesam_fetch_result</function>.
     <example>
      <title>
       Show all rows of the "phone" table as a html table
      </title>
      <programlisting role="php">
&lt;?php
if (!sesam_connect ("phonedb", "demo", "otto"))
    die ("cannot connect");
$result = sesam_query ("select * from phone");
if (!$result) {
    $err = sesam_diagnostic();
    die ($err["errmsg"]);
}
echo "&lt;TABLE BORDER&gt;\n";
// Add title header with column names above the result:
if ($cols = sesam_field_array ($result)) {
    echo " &lt;TR&gt;&lt;TH 
COLSPAN=".$cols["count"]."&gt;Result:&lt;/TH&gt;&lt;/TR&gt;\n";
    echo " &lt;TR&gt;\n";
    for ($col = 0; $col &lt; $cols["count"]; ++$col) {
        $colattr = $cols[$col];
        /* Span the table head over SESAM's "Multiple Fields": */
        if ($colattr["count"] &gt; 1) {
            echo "  &lt;TH COLSPAN=".$colattr["count"]."&gt;".$colattr["name"].
                "(1..".$colattr["count"].")&lt;/TH&gt;\n";
            $col += $colattr["count"] - 1;
        } else
            echo "  &lt;TH&gt;" . $colattr["name"] . "&lt;/TH&gt;\n";
    }
    echo " &lt;/TR&gt;\n";
}

do {
    // Fetch the result in chunks of 100 rows max.
    $ok = sesam_fetch_result ($result, 100);
    for ($row=0; $row &lt; $ok["rows"]; ++$row) {
        echo " &lt;TR&gt;\n";
        for ($col = 0; $col &lt; $ok["cols"]; ++$col) {
            if (isset($ok[$col][$row]))
                echo "  &lt;TD&gt;" . $ok[$col][$row] . "&lt;/TD&gt;\n";
            } else {
                echo "  &lt;TD&gt;-empty-&lt;/TD&gt;\n";
            }
        }
        echo " &lt;/TR&gt;\n";
    }
} 
while ($ok["truncated"]) { // while there may be more data
    echo "&lt;/TABLE&gt;\n";
}
// free result id
sesam_free_result($result);
?&gt;
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sesam-num-fields">
   <refnamediv>
    <refname>sesam_num_fields</refname>
    <refpurpose>
     Return the number of fields/columns in a result set
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>sesam_num_fields</function></funcdef>
      <paramdef>string <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     After calling <function>sesam_query</function> with a "select
     type" query, this function gives you the number of columns in the
     result.  Returns an integer describing the total number of
     columns (aka.  fields) in the current
     <parameter>result_id</parameter> result set or
     <literal>FALSE</literal> on error.
    </para>
    <para>
     For "immediate" statements, the value zero is returned. The SESAM
     "multiple field" columns count as their respective dimension,
     i.e., a three-column "multiple field" counts as three columns.
    </para>
    <para>
     See also: <function>sesam_query</function> and
     <function>sesam_field_array</function> for a way to distinguish
     between "multiple field" columns and regular columns.
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.sesam-field-name">
   <refnamediv>
    <refname>sesam_field_name</refname>
    <refpurpose>
     Return one column name of the result set
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>sesam_field_name</function></funcdef>
      <paramdef>string <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter>index</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the name of a field (i.e., the column name) in the result
     set, or <literal>FALSE</literal> on error.
    </para>
    <para>
     For "immediate" queries, or for dynamic columns, an empty string
     is returned.
    </para>
    <note>
     <para>
      The column index is zero-based, not one-based as in SESAM.
     </para>
    </note>
    <para>
     See also: <function>sesam_field_array</function>. It provides an
     easier interface to access the column names and types, and allows
     for detection of "multiple fields".
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sesam-diagnostic">
   <refnamediv>
    <refname>sesam_diagnostic</refname>
    <refpurpose>
     Return status information for last SESAM call
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>sesam_diagnostic</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an associative array of status and return codes for the
     last SQL query/statement/command.  Elements of the array are:
     <table>
      <title>
       Status information returned by <function>sesam_diagnostic</function>
      </title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>Element</entry>
         <entry>Contents</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>$array["sqlstate"]</entry>
         <entry>
          5 digit SQL return code (see the SESAM manual for the
          description of the possible values of SQLSTATE)
         </entry>
        </row>
        <row>
         <entry>$array["rowcount"]</entry>
         <entry>
          number of affected rows in last update/insert/delete (set
          after "immediate" statements only)
         </entry>
        </row>
        <row>
         <entry>$array["errmsg"]</entry>
         <entry>
          "human readable" error message string (set after errors
          only)
         </entry>
        </row>
        <row>
         <entry>$array["errcol"]</entry>
         <entry>
          error column number of previous error (0-based; or -1 if
          undefined. Set after errors only)
         </entry>
        </row>
        <row>
         <entry>$array["errlin"]</entry>
         <entry>
          error line number of previous error (0-based; or -1 if
          undefined. Set after errors only)
         </entry>
        </row>
       </tbody>
      </tgroup>
     </table>
    </para>
    <para>
     In the following example, a syntax error (E SEW42AE ILLEGAL
     CHARACTER) is displayed by including the offending SQL statement
     and pointing to the error location:
     <example>
      <title>Displaying SESAM error messages with error position</title>
      <programlisting role="php">
&lt;?php
// Function which prints a formatted error message,
// displaying a pointer to the syntax error in the
// SQL statement
function PrintReturncode ($exec_str) {
    $err = Sesam_Diagnostic();
    $colspan=4; // 4 cols for: sqlstate, errlin, errcol, rowcount
    if ($err["errlin"] == -1)
        --$colspan;
    if ($err["errcol"] == -1)
        --$colspan;
    if ($err["rowcount"] == 0)
        --$colspan;
    echo "&lt;TABLE BORDER&gt;\n";
    echo "&lt;TR&gt;&lt;TH COLSPAN=".$colspan."&gt;&lt;FONT 
COLOR=red&gt;ERROR:&lt;/FONT&gt; ".
                htmlspecialchars($err["errmsg"])."&lt;/TH&gt;&lt;/TR&gt;\n";
    if ($err["errcol"] &gt;= 0) {
        echo "&lt;TR&gt;&lt;TD COLSPAN=".$colspan."&gt;&lt;PRE&gt;\n";
        $errstmt = $exec_str."\n";
        for ($lin=0; $errstmt != ""; ++$lin) {
            if ($lin != $err["errlin"]) { // $lin is less or greater than errlin
                if (!($i = strchr ($errstmt, "\n")))
                    $i = "";
                $line = substr ($errstmt, 0, strlen($errstmt)-strlen($i)+1);
                $errstmt = substr($i, 1);
                if ($line != "\n")
                    print htmlspecialchars ($line);
            } else {
                if (! ($i = strchr ($errstmt, "\n")))
                    $i = "";
                $line = substr ($errstmt, 0, strlen ($errstmt)-strlen($i)+1);
                $errstmt = substr($i, 1);
                for ($col=0; $col &lt; $err["errcol"]; ++$col)
                    echo (substr($line, $col, 1) == "\t") ? "\t" : ".";
                echo "&lt;FONT 
COLOR=RED&gt;&lt;BLINK&gt;\\&lt;/BLINK&gt;&lt;/FONT&gt;\n";
                print "&lt;FONT 
COLOR=\"#880000\"&gt;".htmlspecialchars($line)."&lt;/FONT&gt;";
                for ($col=0; $col &lt; $err["errcol"]; ++$col)
                    echo (substr ($line, $col, 1) == "\t") ? "\t" : ".";
                echo "&lt;FONT 
COLOR=RED&gt;&lt;BLINK&gt;/&lt;/BLINK&gt;&lt;/FONT&gt;\n";
            }
        }
        echo "&lt;/PRE&gt;&lt;/TD&gt;&lt;/TR&gt;\n";
    }
    echo "&lt;TR&gt;\n";
    echo " &lt;TD&gt;sqlstate=" . $err["sqlstate"] . "&lt;/TD&gt;\n";
    if ($err["errlin"] != -1)
        echo " &lt;TD&gt;errlin=" . $err["errlin"] . "&lt;/TD&gt;\n";
    if ($err["errcol"] != -1)
        echo " &lt;TD&gt;errcol=" . $err["errcol"] . "&lt;/TD&gt;\n";
    if ($err["rowcount"] != 0)
         echo " &lt;TD&gt;rowcount=" . $err["rowcount"] . "&lt;/TD&gt;\n";
    echo "&lt;/TR&gt;\n";
    echo "&lt;/TABLE&gt;\n";
}

if (!sesam_connect ("mycatalog", "phoneno", "otto"))
  die ("cannot connect");

$stmt = "SELECT * FROM phone\n".
        " WHERE@ LASTNAME='KRAEMER'\n".
        " ORDER BY FIRSTNAME";
if (!($result = sesam_query ($stmt)))
    PrintReturncode ($stmt);
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     See also: <function>sesam_errormsg</function> for simple access
     to the error string only
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sesam-fetch-result">
   <refnamediv>
    <refname>sesam_fetch_result</refname>
    <refpurpose>Return all or part of a query result</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>sesam_fetch_result</function></funcdef>
      <paramdef>string
       <parameter>result_id</parameter>
      </paramdef>
      <paramdef>int
       <parameter><optional>max_rows</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a mixed array with the query result entries, optionally
     limited to a maximum of <parameter>max_rows</parameter> rows.
     Note that both row and column indexes are zero-based.
     <table>
      <title>
       Mixed result set returned by <function>sesam_fetch_result</function>
      </title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>Array Element</entry>
         <entry>Contents</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>int $arr["count"]</entry>
         <entry>
          number of columns in result set (or zero if this was an
          "immediate" query)
         </entry>
        </row>
        <row>
         <entry>int $arr["rows"]</entry>
         <entry>
          number of rows in result set (between zero and
          <parameter>max_rows</parameter>)
         </entry>
        </row>
        <row>
         <entry>boolean $arr["truncated"]</entry>
         <entry>
          <literal>TRUE</literal> if the number of rows was at least
          <parameter>max_rows</parameter>, <literal>FALSE</literal>
          otherwise. Note that even when this is
          <literal>TRUE</literal>, the next
          <function>sesam_fetch_result</function> call may return zero
          rows because there are no more result entries.
         </entry>
        </row>
        <row>
        <entry>mixed $arr[col][row]</entry>
         <entry>
          result data for all the fields at
          row(<literal>row</literal>) and
          column(<literal>col</literal>), (where the integer index
          <literal>row</literal> is between 0 and
          <literal>$arr["rows"]-1</literal>, and
          <literal>col</literal> is between 0 and
          <literal>$arr["count"]-1</literal>). Fields may be empty, so
          you must check for the existence of a field by using the php
          <function>isset</function> function. The type of the
          returned fields depend on the respective SQL type declared
          for its column (see <link linkend="ref.sesam">SESAM
          overview</link> for the conversions applied). SESAM
          "multiple fields" are "inlined" and treated like a sequence
          of columns.
         </entry>
        </row>
       </tbody>
      </tgroup>
     </table>
     Note that the amount of memory used up by a large query may be
     gigantic. Use the <parameter>max_rows</parameter> parameter to
     limit the maximum number of rows returned, unless you are
     absolutely sure that your result will not use up all available
     memory.
    </para>
    <para>
     See also: <function>sesam_fetch_row</function>, and
     <function>sesam_field_array</function> to check for "multiple
     fields". See the description of the
     <function>sesam_query</function> function for a complete example
     using <function>sesam_fetch_result</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sesam-affected-rows">
   <refnamediv>
    <refname>sesam_affected_rows</refname>
    <refpurpose>
     Get number of rows affected by an immediate query
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>sesam_affected_rows</function></funcdef>
      <paramdef>string
       <parameter>result_id</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <parameter>result_id</parameter> is a valid result id returned by
     <function>sesam_query</function>.
    </para>
    <para>
     Returns the number of rows affected by a query associated with
     <parameter>result_id</parameter>.
    </para>
    <para>
     The <function>sesam_affected_rows</function> function can only
     return useful values when used in combination with "immediate"
     SQL statements (updating operations like
     <literal>INSERT</literal>, <literal>UPDATE</literal> and
     <literal>DELETE</literal>) because SESAM does not deliver any
     "affected rows" information for "select type" queries.  The
     number returned is the number of affected rows.
    </para>
    <para>
     See also: <function>sesam_query</function> and
     <function>sesam_execimm</function>
    </para>
    <informalexample>
     <programlisting role="php">
$result = sesam_execimm ("DELETE FROM PHONE WHERE LASTNAME = '".strtoupper 
($name)."'");
if (!$result) {
    ... error ...
}
print sesam_affected_rows ($result).
    " entries with last name ".$name." deleted.\n"
     </programlisting>
    </informalexample>
   </refsect1>
  </refentry>

  <refentry id="function.sesam-errormsg">
   <refnamediv>
    <refname>sesam_errormsg</refname>
    <refpurpose>Returns error message of last SESAM call</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>sesam_errormsg</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the SESAM error message associated with the most recent
     SESAM error.
    </para>
    <informalexample>
     <programlisting role="php">
if (!sesam_execimm ($stmt))
  printf ("%s&lt;br&gt;\n", sesam_errormsg());
     </programlisting>
    </informalexample>
    <para>
     See also: <function>sesam_diagnostic</function> for the full set
     of SESAM SQL status information
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sesam-field-array">
   <refnamediv>
    <refname>sesam_field_array</refname>
    <refpurpose>
     Return meta information about individual columns in a result
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>sesam_field_array</function></funcdef>
      <paramdef>string <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <parameter>result_id</parameter> is a valid result id returned by
     <function>sesam_query</function>.
    </para>
    <para>
     Returns a mixed associative/indexed array with meta information
     (column name, type, precision, ...) about individual columns of
     the result after the query associated with
     <parameter>result_id</parameter>.
    </para>
    <para>
     <table>
      <title>
       Mixed result set returned by <function>sesam_field_array</function>
      </title>
      <tgroup cols="2">
       <thead>
        <row>
         <entry>Array Element</entry>
         <entry>Contents</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>int $arr["count"]</entry>
         <entry>
          Total number of columns in result set (or zero if this was
          an "immediate" query).  SESAM "multiple fields" are
          "inlined" and treated like the respective number of columns.
         </entry>
        </row>
        <row>
         <entry>string $arr[col]["name"]</entry>
         <entry>
          column name for column(<literal>col</literal>), where
          <literal>col</literal> is between 0 and
          <literal>$arr["count"]-1</literal>. The returned value can
          be the empty string (for dynamically computed
          columns). SESAM "multiple fields" are "inlined" and treated
          like the respective number of columns, each with the same
          column name.
         </entry>
        </row>
        <row>
        <entry>string $arr[col]["count"]</entry>
        <entry>
          The "count" attribute describes the repetition factor when
          the column has been declared as a "multiple field". Usually,
          the "count" attribute is 1. The first column of a "multiple
          field" column however contains the number of repetitions
          (the second and following column of the "multiple field"
          contain a "count" attribute of 1). This can be used to
          detect "multiple fields" in the result set. See the example
          shown in the <function>sesam_query</function> description
          for a sample use of the "count" attribute.
         </entry>
        </row>
        <row>
         <entry>string $arr[col]["type"]</entry>
         <entry>
          php variable type of the data for
          column(<literal>col</literal>), where <literal>col</literal>
          is between 0 and <literal>$arr["count"]-1</literal>. The
          returned value can be one of
     <itemizedlist>
      <listitem>
       <simpara>"integer"</simpara>
      </listitem>
      <listitem>
       <simpara>"double"</simpara>
      </listitem>
      <listitem>
       <simpara>"string"</simpara>
      </listitem>
     </itemizedlist>
     depending on the SQL type of the result.  SESAM "multiple fields"
     are "inlined" and treated like the respective number of columns,
     each with the same php type.
    </entry>
    </row>
     <row>
      <entry>string $arr[col]["sqltype"]</entry>
      <entry>
       SQL variable type of the column data for
       column(<literal>col</literal>), where <literal>col</literal> is
       between 0 and <literal>$arr["count"]-1</literal>. The returned
       value can be one of
     <itemizedlist>
      <listitem>
       <simpara>"CHARACTER"</simpara>
      </listitem>
      <listitem>
       <simpara>"VARCHAR"</simpara>
      </listitem>
      <listitem>
       <simpara>"NUMERIC"</simpara>
      </listitem>
      <listitem>
       <simpara>"DECIMAL"</simpara>
      </listitem>
      <listitem>
       <simpara>"INTEGER"</simpara>
      </listitem>
      <listitem>
       <simpara>"SMALLINT"</simpara>
      </listitem>
      <listitem>
       <simpara>"FLOAT"</simpara>
      </listitem>
      <listitem>
       <simpara>"REAL"</simpara>
      </listitem>
      <listitem>
       <simpara>"DOUBLE"</simpara>
      </listitem>
      <listitem>
       <simpara>"DATE"</simpara>
      </listitem>
      <listitem>
       <simpara>"TIME"</simpara>
      </listitem>
      <listitem>
       <simpara>"TIMESTAMP"</simpara>
      </listitem>
     </itemizedlist>
     describing the SQL type of the result.  SESAM "multiple fields"
     are "inlined" and treated like the respective number of columns,
     each with the same SQL type.
    </entry>
    </row>
     <row>
      <entry>string $arr[col]["length"]</entry>
      <entry>
       The SQL "length" attribute of the SQL variable in
       column(<literal>col</literal>), where <literal>col</literal> is
       between 0 and <literal>$arr["count"]-1</literal>. The "length"
       attribute is used with "CHARACTER" and "VARCHAR" SQL types to
       specify the (maximum) length of the string variable.  SESAM
       "multiple fields" are "inlined" and treated like the respective
       number of columns, each with the same length attribute.
      </entry>
     </row>
     <row>
      <entry>string $arr[col]["precision"]</entry>
      <entry>
       The "precision" attribute of the SQL variable in
       column(<literal>col</literal>), where <literal>col</literal> is
       between 0 and <literal>$arr["count"]-1</literal>. The
       "precision" attribute is used with numeric and time data types.
       SESAM "multiple fields" are "inlined" and treated like the
       respective number of columns, each with the same precision
       attribute.
      </entry>
     </row>
     <row>
      <entry>string $arr[col]["scale"]</entry>
      <entry>
       The "scale" attribute of the SQL variable in
       column(<literal>col</literal>), where <literal>col</literal> is
       between 0 and <literal>$arr["count"]-1</literal>. The "scale"
       attribute is used with numeric data types.  SESAM "multiple
       fields" are "inlined" and treated like the respective number of
       columns, each with the same scale attribute.
      </entry>
     </row>
    </tbody>
    </tgroup>
    </table>
    </para>
    <para>
     See the <function>sesam_query</function> function for an example
     of the <function>sesam_field_array</function> use.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sesam-fetch-row">
   <refnamediv>
    <refname>sesam_fetch_row</refname>
    <refpurpose>Fetch one row as an array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>sesam_fetch_row</function></funcdef>
      <paramdef>string <parameter>result_id</parameter></paramdef>
      <paramdef>int
       <parameter><optional>whence</optional></parameter>
      </paramdef>
      <paramdef>int
       <parameter><optional>offset</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array that corresponds to the fetched row, or
     <literal>FALSE</literal> if there are no more rows.
    </para>
    <para>
     The number of columns in the result set is returned in an
     associative array element $array["count"]. Because some of the
     result columns may be empty, the <function>count</function>
     function can not be used on the result row returned by
     <function>sesam_fetch_row</function>.
    </para>
    <para>
     <parameter>result_id</parameter> is a valid result id returned by
     <function>sesam_query</function> (select type queries only!).
    </para>
    <para>
     <parameter><optional>whence</optional></parameter> is an optional
     parameter for a fetch operation on "scrollable" cursors, which
     can be set to the following predefined constants:
     <table>
      <title>Valid values for <parameter>"whence"</parameter> parameter</title>
      <tgroup cols="3">
       <thead>
        <row>
         <entry>Value</entry>
         <entry>Constant</entry>
         <entry>Meaning</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>0</entry>
         <entry><literal>SESAM_SEEK_NEXT</literal></entry>
         <entry>
          read sequentially (after fetch, the internal default is set
          to <literal>SESAM_SEEK_NEXT</literal>)
         </entry>
        </row>
        <row>
         <entry>1</entry>
         <entry><literal>SESAM_SEEK_PRIOR</literal></entry>
         <entry>
          read sequentially backwards (after fetch, the internal
          default is set to <literal>SESAM_SEEK_PRIOR</literal>)
         </entry>
        </row>
        <row>
         <entry>2</entry>
         <entry><literal>SESAM_SEEK_FIRST</literal></entry>
         <entry>
          rewind to first row (after fetch, the default is set to
          <literal>SESAM_SEEK_NEXT</literal>)
         </entry>
        </row>
        <row>
         <entry>3</entry>
         <entry><literal>SESAM_SEEK_LAST</literal></entry>
         <entry>
          seek to last row (after fetch, the default is set to
          <literal>SESAM_SEEK_PRIOR</literal>)
         </entry>
        </row>
        <row>
         <entry>4</entry>
         <entry><literal>SESAM_SEEK_ABSOLUTE</literal></entry>
         <entry>
          seek to absolute row number given as
          <parameter>offset</parameter> (Zero-based. After fetch, the
          internal default is set to
          <literal>SESAM_SEEK_ABSOLUTE</literal>, and the internal
          offset value is auto-incremented)
         </entry>
        </row>
        <row>
         <entry>5</entry>
         <entry><literal>SESAM_SEEK_RELATIVE</literal></entry>
        <entry>
          seek relative to current scroll position, where
          <parameter>offset</parameter> can be a positive or negative
          offset value.
         </entry>
        </row>
       </tbody>
      </tgroup>
     </table>
     This parameter is only valid for "scrollable" cursors.
    </para>
    <para>
     When using "scrollable" cursors, the cursor can be freely
     positioned on the result set. If the
     <parameter><optional>whence</optional></parameter> parameter is
     omitted, the global default values for the scrolling type
     (initialized to: <literal>SESAM_SEEK_NEXT</literal>, and settable
     by <function>sesam_seek_row</function>) are used. If
     <parameter><optional>whence</optional></parameter> is supplied,
     its value replaces the global default.
    </para>
    <para>
     <parameter><optional>offset</optional></parameter> is an optional
     parameter which is only evaluated (and required) if
     <parameter><optional>whence</optional></parameter> is either
     <literal>SESAM_SEEK_RELATIVE</literal> or
     <literal>SESAM_SEEK_ABSOLUTE</literal>. This parameter is only
     valid for "scrollable" cursors.
    </para>
    <para>
     <function>sesam_fetch_row</function> fetches one row of data from
     the result associated with the specified result identifier.  The
     row is returned as an array (indexed by values between
     <literal>0</literal> and <literal>$array["count"]-1</literal>).
     Fields may be empty, so you must check for the existence of a
     field by using the php <function>isset</function> function. The
     type of the returned fields depend on the respective SQL type
     declared for its column (see <link linkend="ref.sesam">SESAM
     overview</link> for the conversions applied). SESAM "multiple
     fields" are "inlined" and treated like a sequence of columns.
    </para>
    <para>
     Subsequent calls to <function>sesam_fetch_row</function> would
     return the next (or prior, or n'th next/prior, depending on the
     scroll attributes) row in the result set, or
     <literal>FALSE</literal> if there are no more rows.
    </para>
    <example>
     <title>SESAM fetch rows</title>
     <programlisting role="php">
&lt;?php
$result = sesam_query (&quot;SELECT * FROM phone\n&quot;.
                       &quot;  WHERE 
LASTNAME='&quot;.strtoupper($name).&quot;'\n&quot;.
                       &quot;  ORDER BY FIRSTNAME&quot;, 1);
if (!$result) {
    ... error ...
}
// print the table in backward order
print &quot;&lt;TABLE BORDER&gt;\n&quot;;
$row = sesam_fetch_row ($result, SESAM_SEEK_LAST);
while (is_array ($row)) {
    print &quot; &lt;TR&gt;\n&quot;;
    for ($col = 0; $col &lt; $row[&quot;count&quot;]; ++$col) {
        print &quot;  &lt;TD&gt;&quot;.htmlspecialchars 
($row[$col]).&quot;&lt;/TD&gt;\n&quot;;
    }
    print &quot; &lt;/TR&gt;\n&quot;;
    // use implied SESAM_SEEK_PRIOR
    $row = sesam_fetch_row ($result);
}
print &quot;&lt;/TABLE&gt;\n&quot;;
sesam_free_result ($result);
?&gt;
     </programlisting>
    </example>
    <para>
     See also: <function>sesam_fetch_array</function> which returns an
     associative array, and <function>sesam_fetch_result</function>
     which returns many rows per invocation.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sesam-fetch-array">
   <refnamediv>
    <refname>sesam_fetch_array</refname>
    <refpurpose>Fetch one row as an associative array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>sesam_fetch_array</function></funcdef>
      <paramdef>string <parameter>result_id</parameter></paramdef>
      <paramdef>int
       <parameter><optional>whence</optional></parameter>
      </paramdef>
      <paramdef>int
       <parameter><optional>offset</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array that corresponds to the fetched row, or
     <literal>FALSE</literal> if there are no more rows.
    </para>
    <para>
     <function>sesam_fetch_array</function> is an alternative version
     of <function>sesam_fetch_row</function>.  Instead of storing the
     data in the numeric indices of the result array, it stores the
     data in associative indices, using the field names as keys.
    </para>
    <para>
     <parameter>result_id</parameter> is a valid result id returned by
     <function>sesam_query</function> (select type queries only!).
    </para>
    <para>
     For the valid values of the optional
     <parameter><optional>whence</optional></parameter>and
     <parameter><optional>offset</optional></parameter> parameters,
     see the <function>sesam_fetch_row</function> function for
     details.
    </para>
    <para>
     <function>sesam_fetch_array</function> fetches one row of data
     from the result associated with the specified result identifier.
     The row is returned as an associative array.  Each result column
     is stored with an associative index equal to its column
     (aka. field) name. The column names are converted to lower case.
    </para>
    <para>
     Columns without a field name (e.g., results of arithmetic
     operations) and empty fields are not stored in the array.  Also,
     if two or more columns of the result have the same column names,
     the later column will take precedence.  In this situation, either
     call <function>sesam_fetch_row</function> or make an alias for
     the column.
     <informalexample>
      <programlisting>
SELECT TBL1.COL AS FOO, TBL2.COL AS BAR FROM TBL1, TBL2</programlisting>
     </informalexample>
    </para>
    <para>
     A special handling allows fetching "multiple field" columns
     (which would otherwise all have the same column names).  For each
     column of a "multiple field", the index name is constructed by
     appending the string "(n)" where n is the sub-index of the
     multiple field column, ranging from 1 to its declared repetition
     factor. The indices are NOT zero based, in order to match the
     nomenclature used in the respective query syntax.  For a column
     declared as:
     <informalexample>
      <programlisting role="sesam">
CREATE TABLE ... ( ... MULTI(3) INT )
      </programlisting>
     </informalexample>
     the associative indices used for the individual "multiple field"
     columns would be <literal>"multi(1)"</literal>,
     <literal>"multi(2)"</literal>, and <literal>"multi(3)"</literal>
     respectively.
    </para>
    <para>
     Subsequent calls to <function>sesam_fetch_array</function> would
     return the next (or prior, or n'th next/prior, depending on the
     scroll attributes) row in the result set, or
     <literal>FALSE</literal> if there are no more rows.
    </para>
    <example>
     <title>SESAM fetch array</title>
     <programlisting role="php">
&lt;?php
$result = sesam_query (&quot;SELECT * FROM phone\n&quot;.
                       &quot;  WHERE 
LASTNAME='&quot;.strtoupper($name).&quot;'\n&quot;.
                       &quot;  ORDER BY FIRSTNAME&quot;, 1);
if (!$result) {
    ... error ...
}
// print the table:
print &quot;&lt;TABLE BORDER&gt;\n&quot;;
while (($row = sesam_fetch_array ($result)) && count ($row) &gt; 0) {
    print &quot; &lt;TR&gt;\n&quot;;
    print &quot; &lt;TD&gt;&quot;.htmlspecialchars 
($row[&quot;firstname&quot;]).&quot;&lt;/TD&gt;\n&quot;;
    print &quot; &lt;TD&gt;&quot;.htmlspecialchars 
($row[&quot;lastname&quot;]).&quot;&lt;/TD&gt;\n&quot;;
    print &quot; &lt;TD&gt;&quot;.htmlspecialchars 
($row[&quot;phoneno&quot;]).&quot;&lt;/TD&gt;\n&quot;;
    print &quot; &lt;/TR&gt;\n&quot;;
}
print &quot;&lt;/TABLE&gt;\n&quot;;
sesam_free_result ($result);
?&gt;
     </programlisting>
    </example>
    <para>
     See also: <function>sesam_fetch_row</function> which returns an
     indexed array.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sesam-seek-row">
   <refnamediv>
    <refname>sesam_seek_row</refname>
    <refpurpose>
     Set scrollable cursor mode for subsequent fetches
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>sesam_seek_row</function></funcdef>
      <paramdef>string <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter>whence</parameter></paramdef>
      <paramdef>int
       <parameter><optional>offset</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <parameter>result_id</parameter> is a valid result id (select
     type queries only, and only if a "scrollable" cursor was
     requested when calling <function>sesam_query</function>).
    </para>
    <para>
     <parameter>whence</parameter> sets the global default value for
     the scrolling type, it specifies the scroll type to use in
     subsequent fetch operations on "scrollable" cursors, which can be
     set to the following predefined constants:
     <table>
      <title>Valid values for <parameter>"whence"</parameter> parameter</title>
      <tgroup cols="3">
       <thead>
        <row>
         <entry>Value</entry>
         <entry>Constant</entry>
         <entry>Meaning</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>0</entry>
         <entry><literal>SESAM_SEEK_NEXT</literal></entry>
         <entry>read sequentially
        </entry>
        </row>
        <row>
         <entry>1</entry>
         <entry><literal>SESAM_SEEK_PRIOR</literal></entry>
         <entry>read sequentially backwards
         </entry>
        </row>
        <row>
         <entry>2</entry>
         <entry><literal>SESAM_SEEK_FIRST</literal></entry>
         <entry>
          fetch first row (after fetch, the default is set to
          <literal>SESAM_SEEK_NEXT</literal>)
         </entry>
        </row>
        <row>
         <entry>3</entry>
         <entry><literal>SESAM_SEEK_LAST</literal></entry>
         <entry>
          fetch last row (after fetch, the default is set to
          <literal>SESAM_SEEK_PRIOR</literal>)
         </entry>
        </row>
        <row>
         <entry>4</entry>
         <entry><literal>SESAM_SEEK_ABSOLUTE</literal></entry>
         <entry>
          fetch absolute row number given as
          <parameter>offset</parameter> (Zero-based. After fetch, the
          default is set to <literal>SESAM_SEEK_ABSOLUTE</literal>,
          and the offset value is auto-incremented)
         </entry>
        </row>
        <row>
         <entry>5</entry>
         <entry><literal>SESAM_SEEK_RELATIVE</literal></entry>
         <entry>
          fetch relative to current scroll position, where
          <parameter>offset</parameter> can be a positive or negative
          offset value (this also sets the default "offset" value for
          subsequent fetches).
         </entry>
        </row>
       </tbody>
      </tgroup>
     </table>
    </para>
    <para>
     <parameter><optional>offset</optional></parameter> is an optional
     parameter which is only evaluated (and required) if
     <parameter>whence</parameter> is either
     <literal>SESAM_SEEK_RELATIVE</literal> or
     <literal>SESAM_SEEK_ABSOLUTE</literal>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sesam-free-result">
   <refnamediv>
    <refname>sesam_free_result</refname>
    <refpurpose>Releases resources for the query</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>sesam_free_result</function></funcdef>
      <paramdef>string <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Releases resources for the query associated with
     <parameter>result_id</parameter>.  Returns
     <literal>FALSE</literal> on error.
    </para>
   </refsect1>
  </refentry>
 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/session.xml
+++ phpdoc/kr/functions/session.xml
 <reference id="ref.session">
  <title>Session handling functions</title>
  <titleabbrev>Sessions</titleabbrev>

  <partintro>
   <para>
    Session support in PHP consists of a way to preserve certain data
    across subsequent accesses. This enables you to build more
    customized applications and increase the appeal of your web site.
   </para>
   <para>
    If you are familiar with the session management of PHPLIB, you
    will notice that some concepts are similar to PHP's session
    support.
   </para>
   <para>
    A visitor accessing your web site is assigned an unique id, the
    so-called session id. This is either stored in a cookie on the
    user side or is propagated in the URL.
   </para>
   <para>
    The session support allows you to register arbitrary numbers of
    variables to be preserved across requests. When a visitor accesses
    your site, PHP will check automatically (if session.auto_start is
    set to 1) or on your request (explicitly through
    <function>session_start</function> or implicitly through
    <function>session_register</function>) whether a specific session
    id has been sent with the request. If this is the case, the prior
    saved environment is recreated.
   </para>
   <para>
    All registered variables are serialized after the request
    finishes.  Registered variables which are undefined are marked as
    being not defined.  On subsequent accesses, these are not defined
    by the session module unless the user defines them later.
   </para>
   <para>
    The <link
    linkend="ini.track-vars"><literal>track_vars</literal></link> and
    <link
    linkend="ini.register-globals"><literal>register_globals</literal></link>
    configuration settings influence how the session variables get
    stored and restored.
   </para>

   <note>
    <para>
     As of PHP 4.0.3, <link
     linkend="ini.track-vars"><literal>track_vars</literal></link> is
     always turned on.
    </para>
   </note>

   <para>
    If <link
    linkend="ini.track-vars"><literal>track_vars</literal></link> is
    enabled and <link
    linkend="ini.register-globals"><literal>register_globals</literal></link>
    is disabled, only members of the global associative array
    $HTTP_SESSION_VARS can be registered as session variables. The
    restored session variables will only be available in the array
    $HTTP_SESSION_VARS.
  <example>
     <title>
      Registering a variable with <link
      linkend="ini.track-vars"><literal>track_vars</literal></link>
      enabled
     </title>
     <programlisting role="php">
&lt;?php
session_register("count");
$HTTP_SESSION_VARS["count"]++;
?&gt;
     </programlisting>
    </example>
   </para>
   <para>
    If <link
    linkend="ini.register-globals"><literal>register_globals</literal></link>
    is enabled, then all global variables can be registered as session
    variables and the session variables will be restored to
    corresponding global variables.
  <example>
     <title>
      Registering a variable with <link
      linkend="ini.register-globals"><literal>register_globals</literal></link>
      enabled
     </title>
     <programlisting role="php">
&lt;?php
session_register("count");
$count++;
?&gt;
     </programlisting>
    </example>
   </para>
   <para>
    If both <link
    linkend="ini.track-vars"><literal>track_vars</literal></link> and
    <link
    linkend="ini.register-globals"><literal>register_globals</literal></link>
    are enabled, then the globals variables and the $HTTP_SESSION_VARS
    entries will reference the same value.
   </para>
   <para>
    There are two methods to propagate a session id:
    <itemizedlist>
     <listitem>
      <simpara>
       Cookies
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       URL parameter
      </simpara>
     </listitem>
    </itemizedlist>
   </para>
   <para>
    The session module supports both methods. Cookies are optimal, but
    since they are not reliable (clients are not bound to accept
    them), we cannot rely on them. The second method embeds the
    session id directly into URLs.
   </para>
   <para>
    PHP is capable of doing this transparently when compiled with
    <literal>--enable-trans-sid</literal>. If you enable this option,
    relative URIs will be changed to contain the session id
    automatically.  Alternatively, you can use the constant
    <literal>SID</literal> which is defined, if the client did not
    send the appropriate cookie.  <literal>SID</literal> is either of
    the form <literal>session_name=session_id</literal> or is an empty
    string.
   </para>
   <para>
    The following example demonstrates how to register a variable, and
    how to link correctly to another page using SID.
    <example>
     <title>Counting the number of hits of a single user</title>
     <programlisting role="php">
&lt;?php
session_register ("count");
$count++;
?&gt;

Hello visitor, you have seen this page &lt;?php echo $count; ?&gt; times.&lt;p&gt;

&lt;php?
# the &lt;?=SID?&gt; is necessary to preserve the session id
# in the case that the user has disabled cookies
?&gt;

To continue, &lt;A HREF="nextpage.php?&lt;?=SID?&gt;"&gt;click here&lt;/A&gt;
     </programlisting>
    </example>
   </para>
   <para>
    The <literal>&lt;?=SID?&gt;</literal> is not necessary, if
    <literal>--enable-trans-sid</literal> was used to compile PHP.
   </para>
   <para>
    To implement database storage, or any other storage method, you
    will need to use <function>session_set_save_handler</function> to
    create a set of user-level storage functions.
   </para>
   <para>
    The session management system supports a number of configuration
    options which you can place in your php.ini file. We will give a
    short overview.
    <itemizedlist>
     <listitem>
      <simpara>
       <literal>session.save_handler</literal> defines the name of the
       handler which is used for storing and retrieving data
       associated with a session.  Defaults to
       <literal>files</literal>.
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       <literal>session.save_path</literal> defines the argument which
       is passed to the save handler. If you choose the default files
       handler, this is the path where the files are created.
       Defaults to <literal>/tmp</literal>.
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       <literal>session.name</literal> specifies the name of the
       session which is used as cookie name. It should only contain
       alphanumeric characters.  Defaults to
       <literal>PHPSESSID</literal>.
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       <literal>session.auto_start</literal> specifies whether the
       session module starts a session automatically on request
       startup. Defaults to <literal>0</literal> (disabled).
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       <literal>session.cookie_lifetime</literal> specifies the lifetime of
       the cookie in seconds which is sent to the browser. The value 0
       means "until the browser is closed." Defaults to
       <literal>0</literal>.
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       <literal>session.serialize_handler</literal> defines the name
       of the handler which is used to serialize/deserialize
       data. Currently, a PHP internal format (name
       <literal>php</literal>) and WDDX is supported (name
       <literal>wddx</literal>). WDDX is only available, if PHP is
       compiled with <link linkend="ref.wddx">WDDX
       support</link>. Defaults to <literal>php</literal>.
       </simpara>
     </listitem>
     <listitem>
      <simpara>
       <literal>session.gc_probability</literal> specifies the
       probability that the gc (garbage collection) routine is started
       on each request in percent. Defaults to <literal>1</literal>.
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       <literal>session.gc_maxlifetime</literal> specifies the number
       of seconds after which data will be seen as 'garbage' and
       cleaned up.  
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       <literal>session.referer_check</literal> contains the substring you
       want to check each HTTP Referer for. If the Referer was sent by the
       client and the substring was not found, the embedded session id will 
       be marked as invalid. Defaults to the empty string.
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       <literal>session.entropy_file</literal> gives a path to an
       external resource (file) which will be used as an additional
       entropy source in the session id creation process. Examples are
       <literal>/dev/random</literal> or
       <literal>/dev/urandom</literal> which are available on many
       Unix systems.
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       <literal>session.entropy_length</literal> specifies the number
       of bytes which will be read from the file specified
       above. Defaults to <literal>0</literal> (disabled).
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       <literal>session.use_cookies</literal> specifies whether the
       module will use cookies to store the session id on the client
       side. Defaults to <literal>1</literal> (enabled).
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       <literal>session.cookie_path</literal> specifies path to set 
                                in session_cookie. Defaults to <literal>/</literal>.
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       <literal>session.cookie_domain</literal> specifies domain to 
                                set in session_cookie. Default is none at all. 
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       <literal>session.cache_limiter</literal> specifies cache control
                          method to use for session pages (nocache/private/public). 
                          Defaults to <literal>nocache</literal>.
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       <literal>session.cache_expire</literal> specifies time-to-live
        for cached session pages in minutes, this has no effect for
        nocache limiter. Defaults to <literal>180</literal>.
      </simpara>
     </listitem>
    </itemizedlist>
    <note>
     <para>
      Session handling was added in PHP 4.0.
     </para>
    </note>
   </para>
  </partintro>

  <refentry id="function.session-start">
   <refnamediv>
    <refname>session_start</refname>
    <refpurpose>Initialize session data</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>session_start</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>session_start</function> creates a session (or resumes
     the current one based on the session id being passed via a GET
     variable or a cookie).</simpara>
    <simpara>
     This function always returns true.
    </simpara>
    <note>
     <para>
      This function was added in PHP 4.0.
     </para>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.session-destroy">
   <refnamediv>
    <refname>session_destroy</refname>
    <refpurpose>Destroys all data registered to a session</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>session_destroy</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>session_destroy</function> destroys all of the data
     associated with the current session.
    </simpara>
    <simpara>
     This function returns true on success and false on failure to destroy
     the session data.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.session-name">
   <refnamediv>
    <refname>session_name</refname>
    <refpurpose>Get and/or set the current session name</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>session_name</function></funcdef>
      <paramdef>string 
       <parameter><optional>name</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>session_name</function> returns the name of the current
     session. If <parameter>name</parameter> is specified, the name of
     the current session is changed to its value.
    </para>
    <para>
     The session name references the session id in cookies and
     URLs. It should contain only alphanumeric characters; it should
     be short and descriptive (i.e. for users with enabled cookie
     warnings). The session name is reset to the default value
     stored in <literal>session.name</literal> at request startup
     time. Thus, you need to call <function>session_name</function>
     for every request (and before <function>session_start</function>
     or <function>session_register</function> are called).
    </para>
    <example>
     <title><function>session_name</function> examples</title>
     <programlisting role="php">
&lt;?php

# set the session name to WebsiteID

$previous_name = session_name ("WebsiteID");

echo "The previous session name was $previous_name&lt;p&gt;";
?&gt;
     </programlisting>
    </example>
    <note>
     <para>
      This function was added in PHP 4.0.
     </para>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.session-module-name">
   <refnamediv>
    <refname>session_module_name</refname>
    <refpurpose>Get and/or set the current session module</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>session_module_name</function></funcdef>
      <paramdef>string 
       <parameter><optional>module</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>session_module_name</function> returns the name of the
     current session module. If <parameter>module</parameter> is
     specified, that module will be used instead.
     <note>
      <para>
       This function was added in PHP 4.0.
      </para>
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.session-save-path">
   <refnamediv>
    <refname>session_save_path</refname>
    <refpurpose>Get and/or set the current session save path</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>session_save_path</function></funcdef>
      <paramdef>string 
       <parameter><optional>path</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>session_save_path</function> returns the path of the current
     directory used to save session data. If <parameter>path</parameter>
     is specified, the path to which data is saved will be changed.
     <note>
      <para>
       On some operating systems, you may want to specify a path on a
       filesystem that handles lots of small files efficiently. For
       example, on Linux, reiserfs may provide better performance than
       ext2fs.
      </para>
     </note>
     <note>
      <para>
       This function was added in PHP 4.0.
      </para>
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.session-id">
   <refnamediv>
    <refname>session_id</refname>
    <refpurpose>Get and/or set the current session id</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>session_id</function></funcdef>
      <paramdef>string <parameter><optional>id</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>session_id</function> returns the session id for the
     current session. If <parameter>id</parameter> is specified, it
     will replace the current session id.
    </para>
    <para>
     The constant <systemitem>SID</systemitem> can also be used to
     retrieve the current name and session id as a string suitable for
     adding to URLs.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.session-register">
   <refnamediv>
    <refname>session_register</refname>
    <refpurpose>
     Register one or more variables with the current session
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>session_register</function></funcdef>
      <paramdef>mixed <parameter>name</parameter></paramdef>
      <paramdef>mixed
       <parameter><optional>...</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>session_register</function> variable number of
     arguments, any of which can be either a string holding the
     variable name or an array consisting of such variable names or
     other arrays. For each encountered variable name,
     <function>session_register</function> registers the global
     variable named by it with the current session.
    </para>
    <para>
     This function returns true when the variable is successfully
     registered with the session.
     <note>
      <para>
       This function was added in PHP 4.0.
      </para>
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.session-unregister">
   <refnamediv>
    <refname>session_unregister</refname>
    <refpurpose>
     Unregister a variable from the current session
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>session_unregister</function></funcdef>
      <paramdef>string <parameter>name</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>session_unregister</function> unregisters (forgets)
     the global variable named <parameter>name</parameter> from the
     current session.
    </para>
    <para>
     This function returns true when the variable is successfully
     unregistered from the session.
     <note>
      <para>
       This function was added in PHP 4.0.
      </para>
     </note>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.session-unset">
   <refnamediv>
    <refname>session_unset</refname>
    <refpurpose>
     Free all session variables
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>session_unset</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>session_unset</function> function free's all session variables
     currently registered.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.session-is-registered">
   <refnamediv>
    <refname>session_is_registered</refname>
    <refpurpose>
     Find out if a variable is registered in a session
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>session_is_registered</function></funcdef>
      <paramdef>string <parameter>name</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>session_is_registered</function> returns true if there
     is a variable with the name <parameter>name</parameter>
     registered in the current session.
     <note>
      <para>
       This function was added in PHP 4.0.
      </para>
     </note>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.session-get-cookie-params">
   <refnamediv>
    <refname>session_get_cookie_params</refname>
    <refpurpose>
     Get the session cookie parameters
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>
       array <function>session_get_cookie_params</function>
      </funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>session_get_cookie_params</function> function returns an
     array with the current session cookie information, the array contains
     the following items:
     <itemizedlist>
      <listitem>
       <simpara>
        "lifetime" -  The lifetime of the cookie.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "path" -  The path where information is stored.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "domain" -  The domain of the cookie.
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.session-set-cookie-params">
   <refnamediv>
    <refname>session_set_cookie_params</refname>
    <refpurpose>
     Set the session cookie parameters
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>session_set_cookie_params</function></funcdef>
      <paramdef>
       int <parameter>lifetime</parameter>
      </paramdef>
      <paramdef>
       string <parameter><optional>path</optional></parameter>
      </paramdef>
      <paramdef>
       string <parameter><optional>domain</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Set cookie parameters defined in the php.ini file.  The effect of this
     function only lasts for the duration of the script.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.session-decode">
   <refnamediv>
    <refname>session_decode</refname>
    <refpurpose>Decodes session data from a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>session_decode</function></funcdef>
      <paramdef>string <parameter>data</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>session_decode</function> decodes the session data in
     <parameter>data</parameter>, setting variables stored in the
     session.
     <note>
      <para>
       This function was added in PHP 4.0.
      </para>
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.session-encode">
   <refnamediv>
    <refname>session_encode</refname>
    <refpurpose>
     Encodes the current session data as a string
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>session_encode</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>session_encode</function> returns a string with the
     contents of the current session encoded within.
     <note>
      <para>
       This function was added in PHP 4.0.
      </para>
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.session-set-save-handler">
   <refnamediv>
    <refname>session_set_save_handler</refname>
    <refpurpose>
     Sets user-level session storage functions
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>session_set_save_handler</function>
      </funcdef>
      <paramdef>string
      <parameter>open</parameter></paramdef><paramdef>string
      <parameter>close</parameter></paramdef><paramdef>string
      <parameter>read</parameter></paramdef><paramdef>string
      <parameter>write</parameter></paramdef><paramdef>string
      <parameter>destroy</parameter></paramdef><paramdef>string
      <parameter>gc</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>session_set_save_handler</function> sets the user-level
     session storage functions which are used for storing and
     retrieving data associated with a session.  This is most useful
     when a storage method other than those supplied by PHP sessions
     is preferred.  i.e. Storing the session data in a local database.
    </para>
    <note>
     <para>
      You must set the configuration option
      <parameter>session.save_handler</parameter> to
      <parameter>user</parameter> in your php.ini file for
      <function>session_set_save_handler</function> to take effect.
     </para>
    </note>
    <para>
     The following example provides file based session
     storage similar to the PHP sessions default save handler
     <parameter>files</parameter>.  This example could easily be
     extended to cover database storage using your favorite PHP
     supported database engine.
    </para>
    <para>
     <example>
      <title>
       <function>session_set_save_handler</function> example
      </title>
      <programlisting role="php">
&lt;?php

function open ($save_path, $session_name) {
  global $sess_save_path, $sess_session_name;
       
  $sess_save_path = $save_path;
  $sess_session_name = $session_name;
  return(true);
}

function close() {
  return(true);
}

function read ($id) {
  global $sess_save_path, $sess_session_name;

  $sess_file = "$sess_save_path/sess_$id";
  if ($fp = @fopen($sess_file, "r")) {
    $sess_data = fread($fp, filesize($sess_file));
    return($sess_data);
  } else {
    return("");
  }

}

function write ($id, $sess_data) {
  global $sess_save_path, $sess_session_name;

  $sess_file = "$sess_save_path/sess_$id";
  if ($fp = @fopen($sess_file, "w")) {
    return(fwrite($fp, $sess_data));
  } else {
    return(false);
  }

}

function destroy ($id) {
  global $sess_save_path, $sess_session_name;
       
  $sess_file = "$sess_save_path/sess_$id";
  return(@unlink($sess_file));
}

/*********************************************
 * WARNING - You will need to implement some *
 * sort of garbage collection routine here.  *
 *********************************************/
function gc ($maxlifetime) {
  return true;
}

session_set_save_handler ("open", "close", "read", "write", "destroy", "gc");

session_start();

// proceed to use sessions normally

?&gt;
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.session-cache-limiter">
   <refnamediv>
    <refname>session_cache_limiter</refname>
    <refpurpose>Get and/or set the current cache limiter</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>session_cache_limiter</function></funcdef>
      <paramdef>string 
       <parameter><optional>cache_limiter</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>session_cache_limiter</function> returns the name of the
     current cache limiter. If <parameter>cache_limiter</parameter> is
     specified, the name of the current cache limiter is changed to the
     new value.
    </para>
    <para>
     The cache limiter controls the cache control HTTP headers sent to the
     client.  These headers determine the rules by which the page content
     may be cached.  Setting the cache limiter to <literal>nocache</literal>,
     for example, would disallow any client-side caching.  A value of
     <literal>public</literal>, however, would permit caching.  It can also
     be set to <literal>private</literal>, which is slightly more restrictive
     than <literal>public</literal>.
    </para>
    <para>
     The cache limiter is reset to the default value stored in
     <literal>session.cache_limiter</literal> at request startup time. Thus,
     you need to call <function>session_cache_limiter</function> for every
     request (and before <function>session_start</function> is called).
    </para>
    <example>
     <title><function>session_cache_limiter</function> examples</title>
     <programlisting role="php">
&lt;?php

# set the cache limiter to 'private'

session_cache_limiter('private');
$cache_limiter = session_cache_limiter();

echo "The cache limiter is now set to $cache_limiter&lt;p&gt;";
?&gt;
     </programlisting>
    </example>
    <note>
     <para>
      This function was added in PHP 4.0.3.
     </para>
    </note>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/shmop.xml
+++ phpdoc/kr/functions/shmop.xml
<reference id="ref.shmop">
  <title>Shared Memory Functions</title>
  <titleabbrev>shmop</titleabbrev>
  
  <partintro>
   <para>
    Shmop is an easy to use set of functions that allows php to read,
    write, create and delete UNIX shared memory segments. The functions
    will not work on windows, as it does not support shared memory. To
    use shmop you will need to compile php with the --enable-shmop parameter
    in your configure line.
   </para>
   <note>
    <simpara>
     The functions explained in the chapter begin all with
     <function>shm_</function> in PHP 4.0.3, but in PHP 4.0.4 and later
     versions these names are changed to begin with
     <function>shmop_</function>.
    </simpara>
   </note>
   <para>
    <example>
     <title>Shared Memory Operations Overview</title> 
     <programlisting role="php">
&lt;?php
   
// Create 100 byte shared memory block with system id if 0xff3
$shm_id = shmop_open(0xff3, "c", 0644, 100);
if(!$shm_id) {
        echo "Couldn't create shared memory segment\n";
}

// Get shared memory block's size
$shm_size = shmop_size($shm_id);
echo "SHM Block Size: ".$shm_size. " has been created.\n";

// Lets write a test string into shared memory
$shm_bytes_written = shmop_write($shm_id, "my shared memory block", 0);
if($shm_bytes_written != strlen("my shared memory block")) {
        echo "Couldn't write the entire length of data\n";
}

// Now lets read the string back
$my_string = shmop_read($shm_id, 0, $shm_size);
if(!$my_string) {
        echo "Couldn't read from shared memory block\n";
}
echo "The data inside shared memory was: ".$my_string."\n";

//Now lets delete the block and close the shared memory segment
if(!shmop_delete($shm_id)) {
        echo "Couldn't mark shared memory block for deletion.";
}
shmop_close($shm_id);
   
?&gt;
     </programlisting>
    </example>
   </para>
  </partintro>  

  <refentry id="function.shmop_open">
   <refnamediv>
    <refname>shmop_open</refname>
    <refpurpose>Create or open shared memory block</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>shmop_open</function></funcdef>
      <paramdef>int <parameter>key</parameter></paramdef>
      <paramdef>string <parameter>flags</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
      <paramdef>int <parameter>size</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>shmop_open</function> can create or open a shared memory block.
    </para>
    <para>
     <function>shmop_open</function> takes 4 parameters: key, which is the
     system's id for the shared memory block, this parameter can be passed
     as a decimal or hex. The second parameter are the flags that you can use:
     <itemizedlist>
      <listitem>
       <simpara>
        "a" for access (sets IPC_EXCL)
        use this flag when you need to open an existing shared memory segment
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "c" for create (sets IPC_CREATE)
        use this flag when you need to create a new shared memory segment.
       </simpara>
      </listitem>
     </itemizedlist>
     The third parameter is the mode, which are the permissions that you
     wish to assign to your memory segment, those are the same as permission
     for a file. Permissions need to be passed in octal form ex. 0644.
     The last parameter is size of the shared memory block you wish to create
     in bytes.
     <note><simpara>
      Note: the 3rd and 4th should be entered as 0 if you are opening an
      existing memory segment. On success <function>shmop_open</function> will
      return an id that you can use to access the shared memory segment 
      you've created.
     </simpara></note>
    </para> 
    <para>
     <example>
      <title>Create a new shared memory block</title>
      <programlisting role="php">
&lt;?php
$shm_id = shmop_open(0x0fff, "c", 0644, 100);
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     This example opened a shared memory block with a system id of 0x0fff.
    </para>
   </refsect1>
  </refentry>  
  
  <refentry id="function.shmop_read">
   <refnamediv>
    <refname>shmop_read</refname>
    <refpurpose>Read data from shared memory block</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>shmop_read</function></funcdef>
      <paramdef>int <parameter>shmid</parameter></paramdef>
      <paramdef>int <parameter>start</parameter></paramdef>
      <paramdef>int <parameter>count</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>shmop_read</function> will read a string from shared memory block.
    </para>
    <para>
     <function>shmop_read</function> takes 3 parameters: shmid, which is the shared
     memory block identifier created by <function>shmop_open</function>, offset from
     which to start reading and count on the number of bytes to read.
    </para> 
    <para>
     <example>
      <title>Reading shared memory block</title>
      <programlisting role="php">
&lt;?php
$shm_data = shmop_read($shm_id, 0, 50);
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     This example will read 50 bytes from shared memory block and place the data
     inside <literal>$shm_data</literal>.
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.shmop_write">
   <refnamediv>
    <refname>shmop_write</refname>
     <refpurpose>Write data into shared memory block</refpurpose>
    </refnamediv>
    <refsect1>
     <title>Description</title>
     <funcsynopsis>
      <funcprototype>
       <funcdef>int <function>shmop_write</function></funcdef>
       <paramdef>int <parameter>shmid</parameter></paramdef>
       <paramdef>string <parameter>data</parameter></paramdef>
       <paramdef>int <parameter>offset</parameter></paramdef>
      </funcprototype>
     </funcsynopsis>
     <para>
      <function>shmop_write</function> will write a string into shared memory block.
     </para>
     <para>
      <function>shmop_write</function> takes 3 parameters: shmid, which is the
      shared memory block identifier created by <function>shmop_open</function>,
      data, a string that you want to write into shared memory block and offset,
      which specifies where to start writing data inside the shared memory segment.
     </para> 
     <para>
      <example>
      <title>Writing to shared memory block</title>
      <programlisting role="php">
&lt;?php
$shm_bytes_written = shmop_write($shm_id, $my_string, 0);
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     This example will write data inside <literal>$my_string</literal> into
     shared memory block, <literal>$shm_bytes_written</literal> will contain
     the number of bytes written.
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.size">
  <refnamediv>
   <refname>shmop_size</refname>
   <refpurpose>Get size of shared memory block</refpurpose>
  </refnamediv>
  <refsect1>
   <title>Description</title>
   <funcsynopsis>
    <funcprototype>
     <funcdef>int <function>shmop_size</function></funcdef>
     <paramdef>int <parameter>shmid</parameter></paramdef>
    </funcprototype>
    </funcsynopsis>
    <para>
     <function>shmop_size</function> is used to get the size, in bytes of the
     shared memory block.
    </para>
    <para>
     <function>shmop_size</function> takes the shmid, which is the shared memory
     block identifier created by <function>shmop_open</function>, the function
     will return and int, which represents the number of bytes the shared memory
     block occupies.
    </para> 
    <para>
     <example>
      <title>Getting the size of the shared memory block</title>
      <programlisting role="php">
&lt;?php
$shm_size = shmop_size($shm_id);
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     This example will put the size of shared memory block identified by
     <literal>$shm_id</literal> into <literal>$shm_size</literal>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.shmop_delete">
   <refnamediv>
    <refname>shmop_delete</refname>
    <refpurpose>Delete shared memory block</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>shmop_delete</function></funcdef>
      <paramdef>int <parameter>shmid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>shmop_delete</function> is used to delete a shared memory block.
    </para>
    <para>
     <function>shmop_delete</function> takes the shmid, which is the shared memory
     block identifier created by <function>shmop_open</function>. On success 1 is
     returned, on failure 0 is returned.
    </para> 
    <para>
     <example>
      <title>Deleting shared memory block</title>
      <programlisting role="php">
&lt;?php
shmop_delete($shm_id);
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     This example will delete shared memory block identified by
     <literal>$shm_id</literal>.
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.shmop_close">
   <refnamediv>
    <refname>shmop_close</refname>
    <refpurpose>Close shared memory block</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>shmop_close</function></funcdef>
      <paramdef>int <parameter>shmid</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>shmop_close</function> is used to close a shared memory block.
    </para>
    <para>
     <function>shmop_close</function> takes the shmid, which is the shared memory
     block identifier created by <function>shmop_open</function>.
    </para> 
    <para>
     <example>
      <title>Closing shared memory block</title>
      <programlisting role="php">
&lt;?php
shmop_close($shm_id);
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     This example will close shared memory block identified by 
<literal>$shm_id</literal>.
    </para>
   </refsect1>
  </refentry>
 </reference> 

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/snmp.xml
+++ phpdoc/kr/functions/snmp.xml
 <reference id="ref.snmp">
  <title>SNMP functions</title>
  <titleabbrev>SNMP</titleabbrev>

  <partintro>
   <simpara>
    In order to use the SNMP functions on Unix you need to install the <ulink 
url="&url.ucd-snmp;">UCD SNMP</ulink> package. On Windows these functions
    are only available on NT and not on Win95/98.</simpara>  

   <simpara>
    Important: In order to use the UCD SNMP package, you need to define
    NO_ZEROLENGTH_COMMUNITY to 1 before compiling it. After configuring UCD
    SNMP, edit config.h and search for NO_ZEROLENGTH_COMMUNITY. Uncomment the
    #define line. It should look like this afterwards:</simpara>

   <para>
    <programlisting>
#define NO_ZEROLENGTH_COMMUNITY 1
    </programlisting>
   </para>

   <simpara>
    If you see strange segmentation faults in combination with SNMP commands,
    you did not follow the above instructions. If you do not want to recompile
    UCD SNMP, you can compile PHP with the --enable-ucd-snmp-hack switch which
    will work around the misfeature.</simpara>
    
  </partintro>

  <refentry id="function.snmpget">
   <refnamediv>
    <refname>snmpget</refname>
    <refpurpose>Fetch an SNMP object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>snmpget</function></funcdef>
      <paramdef>string <parameter>hostname</parameter></paramdef>
      <paramdef>string <parameter>community</parameter></paramdef>
      <paramdef>string <parameter>object_id</parameter></paramdef>
      <paramdef>int <parameter><optional>timeout</optional></parameter></paramdef>
      <paramdef>int <parameter><optional>retries</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>

    <para>
     Returns SNMP object value on success and false on error.</para>  

    <para>
     The <function>snmpget</function> function is used to read the
     value of an SNMP object specified by the
     <parameter>object_id</parameter>. SNMP agent is specified by the
     <parameter>hostname</parameter> and the read community is
     specified by the <parameter>community</parameter> parameter.</para>

    <para>
     <informalexample>
      <programlisting role="php">
$syscontact = snmpget("127.0.0.1", "public", "system.SysContact.0");
      </programlisting>
     </informalexample>
    </para>

   </refsect1>
  </refentry>

  <refentry id="function.snmpset">
   <refnamediv>
    <refname>snmpset</refname>
    <refpurpose>Set an SNMP object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>snmpset</function></funcdef>
      <paramdef>string <parameter>hostname</parameter></paramdef>
      <paramdef>string <parameter>community</parameter></paramdef>
      <paramdef>string <parameter>object_id</parameter></paramdef>
      <paramdef>string <parameter>type</parameter></paramdef>
      <paramdef>mixed <parameter>value</parameter></paramdef>
      <paramdef>int <parameter><optional>timeout</optional></parameter></paramdef>
      <paramdef>int <parameter><optional>retries</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>

    <para>
     Sets the specified SNMP object value, returning true on success
     and false on error.</para>

    <para>
     The <function>snmpset</function> function is used
     to set the value of an SNMP object specified by the
     <parameter>object_id</parameter>. SNMP agent is specified by the
     <parameter>hostname</parameter> and the read community is specified
     by the <parameter>community</parameter> parameter.</para>

   </refsect1>
  </refentry>

  <refentry id="function.snmpwalk">
   <refnamediv>
    <refname>snmpwalk</refname>
    <refpurpose>Fetch all the SNMP objects from an agent</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>snmpwalk</function></funcdef>
      <paramdef>string <parameter>hostname</parameter></paramdef>
      <paramdef>string <parameter>community</parameter></paramdef>
      <paramdef>string <parameter>object_id</parameter></paramdef>
      <paramdef>int <parameter><optional>timeout</optional></parameter>
      </paramdef>
      <paramdef>int <parameter><optional>retries</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>

    <para>
     Returns an array of SNMP object values starting from the
     <function>object_id</function> as root and false on error.</para>

    <para> 
     <function>snmpwalk</function> function is used to read all the
     values from an SNMP agent specified by the
     <parameter>hostname</parameter>. <parameter>Community</parameter>
     specifies the read community for that agent. A null
     <parameter>object_id</parameter> is taken as the root of the SNMP
     objects tree and all objects under that tree are returned as an
     array. If <parameter>object_id</parameter> is specified, all the
     SNMP objects below that <parameter>object_id</parameter> are
     returned.

     <informalexample>
      <programlisting role="php"> 
$a = snmpwalk("127.0.0.1", "public", ""); 
      </programlisting>
     </informalexample></para> 

    <para>
     Above function call would return all the SNMP objects from the
     SNMP agent running on localhost. One can step through the values
     with a loop

     <informalexample>
      <programlisting role="php">
for ($i=0; $i&lt;count($a); $i++) {
    echo $a[$i];
}
      </programlisting>
     </informalexample></para>
        
   </refsect1>
  </refentry>


  <refentry id="function.snmpwalkoid">
   <refnamediv>
    <refname>snmpwalkoid</refname>
    <refpurpose>Query for a tree of information about a network entity
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>snmpwalkoid</function></funcdef>
      <paramdef>string <parameter>hostname</parameter></paramdef>
      <paramdef>string <parameter>community</parameter></paramdef>
      <paramdef>string <parameter>object_id</parameter></paramdef>
      <paramdef>int <parameter><optional>timeout</optional></parameter>
      </paramdef>
      <paramdef>int <parameter><optional>retries</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>

    <para>
     Returns an associative array with object ids and their respective
     object value starting from the <parameter>object_id</parameter>
     as root and false on error.</para>

    <para>
     <function>snmpwalkoid</function> function is used to read all
     object ids and their respective values from an SNMP agent
     specified by the hostname. Community specifies the read
     <parameter>community</parameter> for that agent. A null
     <parameter>object_id</parameter> is taken as the root of the SNMP
     objects tree and all objects under that tree are returned as an
     array. If <parameter>object_id</parameter> is specified, all the
     SNMP objects below that <parameter>object_id</parameter> are
     returned.</para>

    <para>
     The existence of <function>snmpwalkoid</function> and
     <function>snmpwalk</function> has historical reasons.  Both
     functions are provided for backward compatibility.

     <informalexample>
      <programlisting role="php"> 
$a = snmpwalkoid("127.0.0.1", "public", ""); 
      </programlisting>
     </informalexample></para> 

    <para>
     Above function call would return all the SNMP objects from the
     SNMP agent running on localhost. One can step through the values
     with a loop

     <informalexample>
      <programlisting role="php">
for (reset($a); $i = key($a); next($a)) {
    echo "$i: $a[$i]&lt;br>\n";
}
      </programlisting>
     </informalexample></para>
        
   </refsect1>
  </refentry>


  <refentry id="function.snmp-get-quick-print">
   <refnamediv>
    <refname>snmp_get_quick_print</refname>
    <refpurpose>Fetch the current value of the UCD library's quick_print setting
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>boolean <function>snmp_get_quick_print</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>

    <para>
     Returns the current value stored in the UCD Library for quick_print.  
     quick_print is off by default.

     <informalexample>
      <programlisting role="php"> 
$quickprint = snmp_get_quick_print();
      </programlisting>
     </informalexample></para> 

    <para>
     Above function call would return <systemitem>false</systemitem> if
     quick_print is on, and <systemitem>true</systemitem> if quick_print
     is on.</para>

    <para>
     <function>snmp_get_quick_print</function> is only available when using
     the UCD SNMP library.  This function is not available when using the
     Windows SNMP library.</para>

    <para>
     See: <function>snmp_set_quick_print</function> for a full description
     of what quick_print does.</para>
        
   </refsect1>
  </refentry>

  <refentry id="function.snmp-set-quick-print">
   <refnamediv>
    <refname>snmp_set_quick_print</refname>
    <refpurpose>Set the value of quick_print within the UCD SNMP library.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>snmp_set_quick_print</function></funcdef>
      <paramdef>boolean <parameter>quick_print</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>

    <para>
     Sets the value of quick_print within the UCD SNMP library.  When this
     is set (1), the SNMP library will return 'quick printed' values.  This
     means that just the value will be printed.  When quick_print is not
     enabled (default) the UCD SNMP library prints extra information
     including the type of the value (i.e. IpAddress or OID).  Additionally, 
     if quick_print is not enabled, the library prints additional hex values 
     for all strings of three characters or less.</para>

    <para>
     Setting quick_print is often used when using the information returned
     rather then displaying it.  

     <informalexample>
      <programlisting role="php"> 
snmp_set_quick_print(0);
$a = snmpget("127.0.0.1", "public", ".1.3.6.1.2.1.2.2.1.9.1");
echo "$a&lt;BR>\n";
snmp_set_quick_print(1);
$a = snmpget("127.0.0.1", "public", ".1.3.6.1.2.1.2.2.1.9.1");
echo "$a&lt;BR>\n";
      </programlisting>
     </informalexample></para> 

    <para>
     The first value printed might be: 'Timeticks: (0) 0:00:00.00', whereas
     with quick_print enabled, just '0:00:00.00' would be printed.</para>

    <para>
     By default the UCD SNMP library returns verbose values, quick_print is
     used to return only the value.</para>

    <para>
     Currently strings are still returned with extra quotes, this will be
     corrected in a later release.</para>

    <para>
     <function>snmp_set_quick_print</function> is only available when using
     the UCD SNMP library.  This function is not available when using
     the Windows SNMP library.</para>

   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/sockets.xml
+++ phpdoc/kr/functions/sockets.xml
 <reference id="ref.sockets">
  <title>Socket functions</title>
  <titleabbrev>Sockets</titleabbrev>

  <partintro>
   <simpara>
    The socket extension implements a low-level interface to the
    socket communication functions, providing the possibility to act
    as a socket server as well as a client.
   </simpara>
   <para>
    The socket functions described here are part of an extension to
    PHP which must be enabled at compile time by giving the <option
    role="configure">--enable-sockets</option> option to
    <command>configure</command>.
   </para>
   <para>
    For a more generic client-side socket interface, see
    <function>fsockopen</function> and
    <function>pfsockopen</function>.
   </para>
   <para>
    When using these functions, it is important to remember that while
    many of them have identical names to their C counterparts, they
    often have different declarations. Please be sure to read the
    descriptions to avoid confusion.
   </para>
   <para>
    That said, those unfamiliar with socket programming can still find
    a lot of useful material in the appropriate Unix man pages, and
    there is a great deal of tutorial information on socket
    programming in C on the web, much of which can be applied, with
    slight modifications, to socket programming in PHP.
   </para>
   <para>
    <example>
     <title>Socket example: Simple TCP/IP server</title>
     <para>
      This example shows a simple talkback server. Change the
      <varname>address</varname> and <varname>port</varname> variables
      to suit your setup and execute. You may then connect to the
      server with a command similar to: <command>telnet 192.168.1.53
      10000</command> (where the address and port match your
      setup). Anything you type will then be output on the server
      side, and echoed back to you. To disconnect, enter 'quit'.
     </para>
     <programlisting role="php">
&lt;?php
error_reporting (E_ALL);

/* Allow the script to hang around waiting for connections. */
set_time_limit (0);

$address = '192.168.1.53';
$port = 10000;

if (($sock = socket (AF_INET, SOCK_STREAM, 0)) &lt; 0) {
    echo "socket() failed: reason: " . strerror ($sock) . "\n";
}

if (($ret = bind ($sock, $address, $port)) &lt; 0) {
    echo "bind() failed: reason: " . strerror ($ret) . "\n";
}

if (($ret = listen ($sock, 5)) &lt; 0) {
    echo "listen() failed: reason: " . strerror ($ret) . "\n";
}

do {
    if (($msgsock = accept_connect($sock)) &lt; 0) {
        echo "accept_connect() failed: reason: " . strerror ($msgsock) . "\n";
        break;
    }
    do {
        $buf = '';
        $ret = read ($msgsock, $buf, 2048);
        if ($ret &lt; 0) {
            echo "read() failed: reason: " . strerror ($ret) . "\n";
            break 2;
        }
        if ($ret == 0) {
            break 2;
        }
        $buf = trim ($buf);
        if ($buf == 'quit') {
            close ($msgsock);
            break 2;
        }
        $talkback = "PHP: You said '$buf'.\n";
        write ($msgsock, $talkback, strlen ($talkback));
        echo "$buf\n";
    } while (true);
    close ($msgsock);
} while (true);

close ($sock);
?>
     </programlisting>
    </example>
   </para>
   <para>
    <example>
     <title>Socket example: Simple TCP/IP client</title>
     <para>
      This example shows a simple, one-shot HTTP client. It simply
      connects to a page, submits a HEAD request, echoes the reply,
      and exits.
     </para>
     <programlisting>
&lt;?php
error_reporting (E_ALL);

echo "&lt;h2>TCP/IP Connection&lt;/h2>\n";

/* Get the port for the WWW service. */
$service_port = getservbyname ('www', 'tcp');

/* Get the IP address for the target host. */
$address = gethostbyname ('www.php.net');

/* Create a TCP/IP socket. */
$socket = socket (AF_INET, SOCK_STREAM, 0);
if ($socket &lt; 0) {
    echo "socket() failed: reason: " . strerror ($socket) . "\n";
} else {
    "socket() successful: " . strerror ($socket) . "\n";
}

echo "Attempting to connect to '$address' on port '$service_port'...";
$result = connect ($socket, $address, $service_port);
if ($result &lt; 0) {
    echo "connect() failed.\nReason: ($result) " . strerror($result) . "\n";
} else {
    echo "OK.\n";
}

$in = "HEAD / HTTP/1.0\r\n\r\n";
$out = '';

echo "Sending HTTP HEAD request...";
write ($socket, $in, strlen ($in));
echo "OK.\n";

echo "Reading response:\n\n";
while (read ($socket, $out, 2048)) {
    echo $out;
}

echo "Closing socket...";
close ($socket);
echo "OK.\n\n";
?>
      </programlisting>
     </example>
    </para>
  </partintro>

  <refentry id="function.accept-connect">
   <refnamediv>
    <refname>accept_connect</refname>
    <refpurpose>Accepts a connection on a socket</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>accept_connect</function></funcdef>
      <paramdef>int <parameter>socket</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     After the socket <parameter>socket</parameter> has been created
     using <function>socket</function>, bound to a name with
     <function>bind</function>, and told to listen for connections
     with <function>listen</function>, this function will accept
     incoming connections on that socket. Once a successful connection
     is made, a new socket descriptor is returned, which may be used
     for communication. If there are multiple connections queued on
     the socket, the first will be used. If there are no pending
     connections, <function>accept_connect</function> will block until
     a connection becomes present. If <parameter>socket</parameter>
     has been made non-blocking using
     <function>socket_set_blocking</function> or
     <function>set_nonblock</function>, an error code will be
     returned.
    </para>
    <para>
     The socket descriptor returned by
     <function>accept_connect</function> may not be used to accept new
     connections. The original listening socket
     <parameter>socket</parameter>, however, remains open and may be
     reused.
    </para>
    <para>
     Returns a new socket descriptor on success, or a negative error
     code on failure. This code may be passed to
     <function>strerror</function> to get a textual explanation of the
     error.
    </para>
    <para>
     See also 
     <function>bind</function>,
     <function>connect</function>,
     <function>listen</function>,
     <function>socket</function>,
     <function>socket_get_status</function>, and
     <function>strerror</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.bind">
   <refnamediv>
    <refname>bind</refname>
    <refpurpose>Binds a name to a socket</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>bind</function></funcdef>
      <paramdef>int <parameter>socket</parameter></paramdef>
      <paramdef>string <parameter>address</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>port</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>bind</function> binds the name given in
     <parameter>address</parameter> to the socket described by
     <parameter>socket</parameter>, which must be a valid socket
     descriptor created with <function>socket</function>.
    </para>
    <para>
     The <parameter>address</parameter> parameter is either an IP
     address in dotted-quad notation
     (e.g. <literal>127.0.0.1</literal>), if the socket is of the
     <constant>AF_INET</constant> family; or the pathname of a
     Unix-domain socket, if the socket family is
     <constant>AF_UNIX</constant>.
    </para>
    <para>
     The <parameter>port</parameter> parameter is only used when
     connecting to an <constant>AF_INET</constant> socket, and
     designates the port on the remote host to which a connection
     should be made.
    </para>
    <para>
     Returns zero on success, or a negative error code on
     failure. This code may be passed to <function>strerror</function>
     to get a textual explanation of the error.
    </para>
    <para>
     See also 
     <function>accept_connect</function>,
     <function>connect</function>,
     <function>listen</function>,
     <function>socket</function>,
     <function>socket_get_status</function>, and
     <function>strerror</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.close">
   <refnamediv>
    <refname>close</refname>
    <refpurpose>Closes a file descriptor</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>close</function></funcdef>
      <paramdef>int <parameter>socket</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>close</function> closes the file (or socket) descriptor
     given by <parameter>socket</parameter>.
    </para>
    <para>
     Note that <function>close</function> should not be used on PHP
     file descriptors created with <function>fopen</function>,
     <function>popen</function>, <function>fsockopen</function>, or
     <function>psockopen</function>; it is meant for sockets created
     with <function>socket</function> or
     <function>accept_connect</function>.
    </para>
    <para>
     Returns true on success, or false if an error occurs (i.e.,
     <parameter>socket</parameter> is invalid).
    </para>
    <para>
     See also <function>bind</function>, <function>listen</function>,
     <function>socket</function>,
     <function>socket_get_status</function>, and
     <function>strerror</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.connect">
   <refnamediv>
    <refname>connect</refname>
    <refpurpose>Initiates a connection on a socket</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>connect</function></funcdef>
      <paramdef>int <parameter>socket</parameter></paramdef>
      <paramdef>string <parameter>address</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>port</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Initiates a connection using the socket descriptor
     <parameter>socket</parameter>, which must be a valid socket
     descriptor created with <function>socket</function>.
    </para>
    <para>
     The <parameter>address</parameter> parameter is either an IP
     address in dotted-quad notation
     (e.g. <literal>127.0.0.1</literal>), if the socket is of the
     <constant>AF_INET</constant> family; or the pathname of a
     Unix-domain socket, if the socket family is
     <constant>AF_UNIX</constant>.
    </para>
    <para>
     The <parameter>port</parameter> parameter is only used when
     connecting to an <constant>AF_INET</constant> socket, and
     designates the port on the remote host to which a connection
     should be made.
    </para>
    <para>
     Returns zero on success, or a negative error code on
     failure. This code may be passed to <function>strerror</function>
     to get a textual explanation of the error.
    </para>
    <para>
     See also 
     <function>bind</function>,
     <function>listen</function>,
     <function>socket</function>,
     <function>socket_get_status</function>, and
     <function>strerror</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.listen">
   <refnamediv>
    <refname>listen</refname>
    <refpurpose>Listens for a connection on a socket</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>listen</function></funcdef>
      <paramdef>int <parameter>socket</parameter></paramdef>
      <paramdef>int <parameter>backlog</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     After the socket <parameter>socket</parameter> has been created
     using <function>socket</function> and bound to a name with
     <function>bind</function>, it may be told to listen for incoming
     connections on <parameter>socket</parameter>. A maximum of
     <parameter>backlog</parameter> incoming connections will be
     queued for processing.
    </para>
    <para>
     <function>listen</function> is applicable only to sockets with
     type <literal>SOCK_STREAM</literal> or
     <literal>SOCK_SEQPACKET</literal>.
    </para>
    <para>
     Returns zero on success, or a negative error code on
     failure. This code may be passed to <function>strerror</function>
     to get a textual explanation of the error.
    </para>
    <para>
     See also 
     <function>accept_connect</function>,
     <function>bind</function>,
     <function>connect</function>,
     <function>socket</function>,
     <function>socket_get_status</function>, and
     <function>strerror</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.read">
   <refnamediv>
    <refname>read</refname>
    <refpurpose>Read from a socket</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>read</function></funcdef>
      <paramdef>int <parameter>socket_des</parameter></paramdef>
      <paramdef>string <parameter>&amp;buffer</parameter></paramdef>
      <paramdef>int <parameter>length</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The function <function>read</function> reads from socket 
     <parameter>socket_des</parameter>created by the
     <function>accept_connect</function> function into
     <parameter>&amp;buffer</parameter> the number of bytes set by
     <parameter>length</parameter>. Otherwise you can use \n, \t or \0 to
      end reading. Returns number of bytes that have been read.
    </para>
    <para>
     See also 
     <function>accept_connect</function>,
     <function>bind</function>,
     <function>connect</function>,
     <function>listen</function>,
     <function>strerror</function>,
     <function>socket_get_status</function>. and
     <function>write</function>.     
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.socket">
   <refnamediv>
    <refname>socket</refname>
    <refpurpose>Create a socket (endpoint for communication)</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>socket</function></funcdef>
      <paramdef>int <parameter>domain</parameter></paramdef>
      <paramdef>int <parameter>type</parameter></paramdef>
      <paramdef>int <parameter>protocol</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Creates a communication endpoint (a socket), and returns a
     descriptor to the socket.
    </para>
    <para>
     The <parameter>domain</parameter> parameter sets the
     domain. Currently, <constant>AF_INET</constant> and
     <constant>AF_UNIX</constant> are understood.
    </para>
    <para>
     The <parameter>type</parameter> parameter selects the socket
     type. This is one of <constant>SOCK_STREAM</constant>,
     <constant>SOCK_DGRAM</constant>,
     <constant>SOCK_SEQPACKET</constant>,
     <constant>SOCK_RAW</constant>, <constant>SOCK_RDM</constant>, or
     <constant>SOCK_PACKET</constant>.
    </para>
    <para>
     <parameter>protocol</parameter> sets the protocol.
    </para>
    <para>
     Returns a valid socket descriptor on success, or a negative error
     code on failure. This code may be passed to
     <function>strerror</function> to get a textual explanation of the
     error.
    </para>
    <para>
     For more information on the usage of <function>socket</function>,
     as well as on the meanings of the various parameters, see the
     Unix man page socket (2).
    </para>
    <para>
     See also 
     <function>accept_connect</function>,
     <function>bind</function>,
     <function>connect</function>,
     <function>listen</function>,
     <function>strerror</function>, and
     <function>socket_get_status</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.strerror">
   <refnamediv>
    <refname>strerror</refname>
    <refpurpose>Return a string describing a socket error</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>strerror</function></funcdef>
      <paramdef>int <parameter>errno</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>strerror</function> takes as its
     <parameter>errno</parameter> parameter the return value of one of
     the socket functions, and returns the corresponding explanatory
     text. This makes it a bit more pleasant to figure out why
     something didn't work; for instance, instead of having to track
     down a system include file to find out what '-111' means, you
     just pass it to <function>strerror</function>, and it tells you
     what happened.
    </para>
    <para>
     <example>
      <title><function>strerror</function> example</title>
      <programlisting role="php">
&lt;?php
if (($socket = socket (AF_INET, SOCK_STREAM, 0)) &lt; 0) {
   echo "socket() failed: reason: " . strerror ($socket) . "\n";
} 

if (($ret = bind ($socket, '127.0.0.1', 80)) &lt; 0) {
   echo "bind() failed: reason: " . strerror ($ret) . "\n";
}
?>
      </programlisting>
      <para>
       The expected output from the above example (assuming the script
       is not run with root privileges):
       <screen>
        bind() failed: reason: Permission denied
       </screen>
      </para>
     </example>
    </para>
    <para>
     See also 
     <function>accept_connect</function>,
     <function>bind</function>,
     <function>connect</function>,
     <function>listen</function>,
     <function>socket</function>, and
     <function>socket_get_status</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.write">
   <refnamediv>
    <refname>write</refname>
    <refpurpose>Write to a socket</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>write</function></funcdef>
      <paramdef>int <parameter>socket_des</parameter></paramdef>
      <paramdef>string <parameter>&amp;buffer</parameter></paramdef>
      <paramdef>int <parameter>length</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The function <function>write</function> writes to the socket 
     <parameter>socket_des</parameter> from
     <parameter>&amp;buffer</parameter> the number of bytes set by
     <parameter>length</parameter>.
    </para>
    <para>
     See also 
     <function>accept_connect</function>,
     <function>bind</function>,
     <function>connect</function>,
     <function>listen</function>,
     <function>read</function>,
     <function>strerror</function>, and
     <function>socket_get_status</function>.
    </para>
   </refsect1>
  </refentry>

 </reference>

 <!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
 
Index: phpdoc/kr/functions/strings.xml
+++ phpdoc/kr/functions/strings.xml
 <reference id="ref.strings">
  <title>String functions</title>
  <titleabbrev>Strings</titleabbrev>

  <partintro>
   <simpara>
    These functions all manipulate strings in various ways. Some more
    specialized sections can be found in the regular expression and
    URL handling sections.
   </simpara>

   <para>
    For information on how strings behave, especially with regard to
    usage of single quotes, double quotes, and escape sequences, see
    the <link linkend="language.types.string">Strings</link> entry in
    the <link linkend="language.types">Types</link> section of the
    manual. 
   </para>
  </partintro>

  <refentry id="function.addcslashes">
   <refnamediv>
    <refname>AddCSlashes</refname>
    <refpurpose>Quote string with slashes in a C style</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>addcslashes</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
      <paramdef>string <parameter>charlist</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string with backslashes before characters that are
     listed in <parameter>charlist</parameter> parameter. It escapes
     <literal>\n</literal>, <literal>\r</literal> etc. in C-like
     style, characters with ASCII code lower than 32 and higher than
     126 are converted to octal representation. Be carefull when
     escaping alphanumeric characters. You can specify a range in
     <parameter>charlist</parameter> like "\0..\37", which would
     escape all characters with ASCII code between 0 and 31.
     <example>
      <title><function>Addcslashes</function> example</title>
      <programlisting role="php">
$escaped = addcslashes ($not_escaped, "\0..\37!@\177..\377");
      </programlisting>
     </example>
     <note>
      <simpara>
       Added in PHP4b3-dev.</simpara>
     </note>
    </para>
    <para>
     See also <function>stripcslashes</function>, 
     <function>stripslashes</function>, 
     <function>htmlspecialchars</function>,
     <function>htmlspecialchars</function>, and 
     <function>quotemeta</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.addslashes">
   <refnamediv>
    <refname>AddSlashes</refname>
    <refpurpose>Quote string with slashes</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>addslashes</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string with backslashes before characters that need
     to be quoted in database queries etc.  These characters are
     single quote (<literal>'</literal>), double quote
     (<literal>"</literal>), backslash (<literal>\</literal>)
     and NUL (the null byte).
    </para>
    <para>
     See also <function>stripslashes</function>, 
     <function>htmlspecialchars</function>, and
     <function>quotemeta</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.bin2hex">
   <refnamediv>
    <refname>bin2hex</refname>
    <refpurpose>
     Convert binary data into hexadecimal representation
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>bin2hex</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an ASCII string containing the hexadecimal representation
     of <parameter>str</parameter>. The conversion is done byte-wise
     with the high-nibble first.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.chop">
   <refnamediv>
    <refname>Chop</refname>
    <refpurpose>Remove trailing whitespace</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>chop</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the argument string without trailing whitespace,
     including newlines.
     <example>
      <title><function>Chop</function> example</title>
      <programlisting role="php">
$trimmed = chop ($line);
      </programlisting>
     </example>
    </para>
    <note>
     <para>
      <function>chop</function> is different than the Perl
      <parameter>chop()</parameter> function, which removes the last
      character in the string.
     </para>
    </note>
    <para>
     See also <function>trim</function>, <function>ltrim</function>,
     <function>rtrim</function>, and <function>chop</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.chr">
   <refnamediv>
    <refname>Chr</refname>
    <refpurpose>Return a specific character</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>chr</function></funcdef>
      <paramdef>int <parameter>ascii</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a one-character string containing the character specified
     by <parameter>ascii</parameter>.
     <example>
      <title><function>Chr</function> example</title>
      <programlisting role="php">
$str .= chr (27); /* add an escape character at the end of $str */

/* Often this is more useful */

$str = sprintf ("The string ends in escape: %c", 27);
      </programlisting>
     </example>
     This function complements <function>ord</function>. See also
     <function>sprintf</function> with a format string of
     <literal>%c</literal>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.chunk-split">
   <refnamediv>
    <refname>chunk_split</refname>
    <refpurpose>Split a string into smaller chunks</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>chunk_split</function></funcdef>
      <paramdef>string <parameter>string</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>chunklen</optional></parameter>
      </paramdef>
      <paramdef>string 
       <parameter><optional>end</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Can be used to split a string into smaller chunks which is useful
     for e.g. converting <link
     linkend="function.base64-encode">base64_encode</link> output to
     match RFC 2045 semantics. It inserts every
     <parameter>chunklen</parameter> (defaults to 76) chars the string
     <parameter>end</parameter> (defaults to "\r\n").  It returns the
     new string leaving the original string untouched.
     <example>
      <title><function>Chunk_split</function> example</title>
      <programlisting role="php">
# format $data using RFC 2045 semantics

$new_string = chunk_split (base64_encode($data));
      </programlisting>
     </example>
     This function is significantly faster than
     <function>ereg_replace</function>.
     <note>
      <para>
       This function was added in 3.0.6.
      </para>
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.convert-cyr-string">
   <refnamediv>
    <refname>convert_cyr_string</refname>
    <refpurpose>
     Convert from one Cyrillic character set to another
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>convert_cyr_string</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
      <paramdef>string <parameter>from</parameter></paramdef>
      <paramdef>string <parameter>to</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function converts the given string from one Cyrillic
     character set to another.  The <parameter>from</parameter> and
     <parameter>to</parameter> arguments are single characters that
     represent the source and target Cyrillic character sets.  The
     supported types are:
     <itemizedlist>
      <listitem>
       <simpara>
        k - koi8-r
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        w - windows-1251
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        i - iso8859-5
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        a - x-cp866
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        d - x-cp866
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        m - x-mac-cyrillic
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.count-chars">
   <refnamediv>
    <refname>count_chars</refname>
    <refpurpose>
     Return information abouts characters used in a string
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>count_chars</function></funcdef>
      <paramdef>string <parameter>string</parameter></paramdef>
      <paramdef>
       <parameter>
        <optional>mode</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Counts the number of occurances of every byte-value (0..255) in
     <parameter>string</parameter> and returns it in various ways.
     The optional parameter <parameter>Mode</parameter> default to
     0. Depending on <parameter>mode</parameter>
     <function>count_chars</function> returns one of the following:
     <itemizedlist>
      <listitem>
       <simpara>
        0 - an array with the byte-value as key and the freqency of
        every byte as value.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        1 - same as 0 but only byte-values with a frequency greater
        than zero are listed.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        2 - same as 0 but only byte-values with a frequency equal to
        zero are listed.  
       </simpara>
      </listitem> 
      <listitem>
       <simpara> 
        3 - a string containing all used byte-values is returned.
       </simpara>
      </listitem> 
      <listitem>
       <simpara> 
        4 - a string containing all not used byte-values is returned.
       </simpara>
      </listitem> 
     </itemizedlist>
    </para>
    <note>
     <para>
      This function was added in PHP 4.0.
     </para> 
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.crc32">
   <refnamediv>
    <refname>crc32</refname>
    <refpurpose>Calculates the crc32 polynomial of a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>crc32</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
         Generates the cyclic redundancy checksum polynomial of 32-bit lengths of
         the <parameter>str</parameter>. This is usually used to validate the
         integrity of data being trasmited.
    </para>
        <para>
        See also: <function>md5</function>
        </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.crypt">
   <refnamediv>
    <refname>crypt</refname>
    <refpurpose>DES-encrypt a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>crypt</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>salt</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>crypt</function> will encrypt a string using the
     standard Unix <abbrev>DES</abbrev> encryption method.  Arguments
     are a string to be encrypted and an optional two-character salt
     string to base the encryption on.  See the Unix man page for your
     crypt function for more information.
    </para>
    <simpara>
     If the salt argument is not provided, one will be randomly
     generated by PHP.
    </simpara>
    <simpara>
     Some operating systems support more than one type of encryption.
     In fact, sometimes the standard DES encryption is replaced by an
     MD5 based encryption algorithm.  The encryption type is triggered
     by the salt argument.  At install time, PHP determines the
     capabilities of the crypt function and will accept salts for
     other encryption types.  If no salt is provided, PHP will
     auto-generate a standard 2-character DES salt by default, unless
     the default encryption type on the system is MD5, in which case a
     random MD5-compatible salt is generated.  PHP sets a constant
     named CRYPT_SALT_LENGTH which tells you whether a regular
     2-character salt applies to your system or the longer 12-char MD5
     salt is applicable.
    </simpara>
    <simpara>
     If you are using the supplied salt, you should be aware that the
     salt is generated once. If you are calling this function
     recursively, this may impact both appearance and, to a certain
     extent, security.
    </simpara>  
    <simpara>
     The standard DES encryption <function>crypt</function> contains
     the salt as the first two characters of the output.
    </simpara>
    <simpara>
     On systems where the crypt() function supports multiple
     encryption types, the following constants are set to 0 or 1
     depending on whether the given type is available:
    </simpara>
    <itemizedlist>
     <listitem>
      <simpara>
       CRYPT_STD_DES - Standard DES encryption with a 2-char SALT
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       CRYPT_EXT_DES - Extended DES encryption with a 9-char SALT
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       CRYPT_MD5 - MD5 encryption with a 12-char SALT starting with
       $1$
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       CRYPT_BLOWFISH - Extended DES encryption with a 16-char SALT
       starting with $2$
      </simpara>
     </listitem>
    </itemizedlist>
    <simpara>
     There is no decrypt function, since <function>crypt</function>
     uses a one-way algorithm.
    </simpara>
    <simpara>
        See also: <function>md5</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.echo">
   <refnamediv>
    <refname>echo</refname>
    <refpurpose>Output one or more strings</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef><function>echo</function></funcdef>
      <paramdef>string <parameter>arg1</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>argn</optional>...</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Outputs all parameters.
    </simpara>
    <para>
     <function>Echo</function> is not actually a function (it is a
     language construct) so you are not required to use parantheses
     with it.  
     <example>
      <title><function>Echo</function> example</title>
      <programlisting role="php">
echo "Hello World";

echo "This spans
multiple lines. The newlines will be 
output as well";

echo "This spans\nmultiple lines. The newlines will be\noutput as well.";
      </programlisting>
     </example>
    </para>      
    <note>
     <para>
      In fact, if you want to pass more than one parameter to echo,
      you must not enclose the parameters within parentheses.
     </para>
    </note>
    <simpara>
     See also:
     <function>print</function>,
     <function>printf</function>, and
     <function>flush</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.explode">
   <refnamediv>
    <refname>explode</refname>
    <refpurpose>Split a string by string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>explode</function></funcdef>
      <paramdef>string <parameter>separator</parameter></paramdef>
      <paramdef>string <parameter>string</parameter></paramdef>
      <paramdef>int    
       <parameter><optional>limit</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an array of strings, each of which is a substring of
     <parameter>string</parameter> formed by splitting it on boundaries formed 
     by the string <parameter>delim</parameter>. 
     If <parameter>limit</parameter> is set, the returned array will contaion 
     a maximum of <parameter>limit</parameter> elements with the last element
     containing the whole rest of <parameter>string</parameter>.
    </para>
    <note>
     <para>
      The <parameter>limit</parameter> parameter was added in PHP 4.0.1
     </para> 
    </note>
    <para>
     <example>
      <title><function>Explode</function> example</title>
      <programlisting role="php">
$pizza = "piece1 piece2 piece3 piece4 piece5 piece6";
$pieces = explode (" ", $pizza);
      </programlisting>
     </example>
    </para>
    <note>
     <para>
      Although <function>implode</function> can for historical reasons
      accept its parameters in either order,
      <function>explode</function> cannot. You must ensure that the
      <parameter>separator</parameter> argument comes before the
      <parameter>string</parameter> argument.
     </para>
    </note>
    <para>
     See also <function>split</function> and
     <function>implode</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.get-html-translation-table">
   <refnamediv>
    <refname>get_html_translation_table</refname>
    <refpurpose>
     Returns the translation table used by
     <function>htmlspecialchars</function> and
     <function>htmlentities</function>
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string 
       <function>get_html_translation_table</function>
      </funcdef>
      <paramdef>int <parameter>table</parameter></paramdef>
      <paramdef>int <parameter><optional>quote_style</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>get_html_translation_table</function> will return the
     translation table that is used internally for
     <function>htmlspecialchars</function> and
     <function>htmlentities</function>. There are two new defines
     (<parameter>HTML_ENTITIES</parameter>,
     <parameter>HTML_SPECIALCHARS</parameter>) that allow you to
     specify the table you want.  And as in the
         <function>htmlspecialchars</function> and
         <function>htmlentities</function> functions you can optionally specify the 
         quote_style you are working with.  The default is ENT_COMPAT mode.  See
         the description of these modes in <function>htmlspecialchars</function>.
     <example>
      <title>Translation Table Example</title>
      <programlisting role="php">
$trans = get_html_translation_table (HTML_ENTITIES);
$str = "Hallo &amp; &lt;Frau> &amp; Kr&auml;mer";
$encoded = strtr ($str, $trans);
      </programlisting>
     </example>
     The <literal>$encoded</literal> variable will now contain: "Hallo
     &amp;<sgmltag>amp</sgmltag>;
     &amp;<sgmltag>lt</sgmltag>;Frau&amp;<sgmltag>gt</sgmltag>;
     &amp;<sgmltag>amp</sgmltag>; Kr&amp;<sgmltag>auml</sgmltag>;mer".
    </para>
    <para>
     The cool thing is using <function>array_flip</function> to change
     the direction of the translation.
     <informalexample>
      <programlisting role="php">
$trans = array_flip ($trans);
$original = strtr ($str, $trans);
      </programlisting>
     </informalexample>
      The content of <literal>$original</literal> would be: "Hallo &amp;
      &lt;Frau> &amp; Kr&auml;mer".
     <note>
      <para>
       This function was added in PHP 4.0.
      </para> 
     </note>
    </para>
    <para>
     See also: <function>htmlspecialchars</function>,
     <function>htmlentities</function>, <function>strtr</function>,
     and <function>array_flip</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.get-meta-tags">
   <refnamediv>
    <refname>get_meta_tags</refname>
    <refpurpose>
     Extracts all meta tag content attributes from a file and returns
     an array
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>get_meta_tags</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
      <paramdef>int
       <parameter><optional>use_include_path</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Opens <parameter>filename</parameter> and parses it line by line
     for &lt;meta> tags of the form
     <example>
      <title>Meta Tags Example</title>
      <programlisting role="html">
&lt;meta name="author" content="name">
&lt;meta name="tags" content="php3 documentation">
&lt;/head> &lt;!-- parsing stops here -->
      </programlisting>
     </example>
     (pay attention to line endings - PHP uses a native function to
     parse the input, so a Mac file won't work on Unix).
    </para>
    <para> 
     The value of the name property becomes the key, the value of the
     content property becomes the value of the returned array, so you
     can easily use standard array functions to traverse it or access
     single values. Special characters in the value of the name
     property are substituted with '_', the rest is converted to lower
     case.
    </para>
    <para>
     Setting <parameter>use_include_path</parameter> to 1 will result
     in PHP trying to open the file along the standard include path.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hebrev">
   <refnamediv>
    <refname>hebrev</refname>
    <refpurpose>
     Convert logical Hebrew text to visual text
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>hebrev</function></funcdef>
      <paramdef>string <parameter>hebrew_text</parameter></paramdef>
      <paramdef>int 
            <parameter><optional>max_chars_per_line</optional></parameter>
          </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
          The optional parameter <parameter>max_chars_per_line</parameter>
          indicates maximum number of characters per line will be output. The
          function tries to avoid breaking words.
    </para>
        <para>
     See also <function>hebrevc</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.hebrevc">
   <refnamediv>
    <refname>hebrevc</refname>
    <refpurpose>
     Convert logical Hebrew text to visual text with newline conversion
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>hebrevc</function></funcdef>
      <paramdef>string <parameter>hebrew_text</parameter></paramdef>
      <paramdef>int 
            <parameter><optional>max_chars_per_line</optional></parameter>
          </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
          This function is similar to <function>hebrev</function> with the
          difference that it converts newlines (\n) to "&lt;br&gt;\n".
          The optional parameter <parameter>max_chars_per_line</parameter>
          indicates maximum number of characters per line will be output. The
          function tries to avoid breaking words.
    </para>
        <para>
     See also <function>hebrev</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.htmlentities">
   <refnamediv>
    <refname>htmlentities</refname>
    <refpurpose>
     Convert all applicable characters to HTML entities
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>htmlentities</function></funcdef>
      <paramdef>string <parameter>string</parameter></paramdef>
      <paramdef>int <parameter><optional>quote_style</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function is identical to
     <function>htmlspecialchars</function> in all ways, except that
     all characters which have HTML character entity equivalents are
     translated into these entities.  Like
     <function>htmlspecialchars</function>, it takes an optional
     second argument which indicates what should be done with single
     and double quotes.  <constant>ENT_COMPAT</constant> (the default)
     will only convert double-quotes and leave single-quotes alone.
     <constant>ENT_QUOTES</constant> will convert both double and
     single quotes, and <constant>ENT_NOQUOTES</constant> will leave
     both double and single quotes unconverted.
    </para>
    <para>
     At present, the ISO-8859-1 character set is used.  Note that the optional
         second argument was added in PHP 3.0.17 and PHP 4.0.3.
    </para>
    <para>
     See also <function>htmlspecialchars</function> and
     <function>nl2br</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.htmlspecialchars">
   <refnamediv>
    <refname>htmlspecialchars</refname> 
    <refpurpose>
     Convert special characters to HTML entities
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>htmlspecialchars</function></funcdef>
      <paramdef>string <parameter>string</parameter></paramdef>
      <paramdef>int <parameter><optional>quote_style</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Certain characters have special significance in HTML, and should
     be represented by HTML entities if they are to preserve their
     meanings. This function returns a string with some of these
     conversions made; the translations made are those most
     useful for everyday web programming. If you require all HTML
     character entities to be translated, use
     <function>htmlentities</function> instead.
    </para>
    <simpara>
     This function is useful in preventing user-supplied text from
     containing HTML markup, such as in a message board or guest book
     application.  The optional second argument, quote_style, tells the
         function what to do with single and double quote characters.  The
         default mode, ENT_COMPAT, is the backwards compatible mode which only
         translates the double-quote character and leaves the single-quote
         untranslated.  If ENT_QUOTES is set, both single and double quotes
         are translated and if ENT_NOQUOTES is set neither single nor double quotes
         are translated.
    </simpara>
    <para>
     The translations performed are:
     <itemizedlist>
      <listitem>
       <simpara>
        '&amp;' (ampersand) becomes '&amp;amp;'
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        '&quot;' (double quote) becomes '&amp;quot;' when ENT_NOQUOTES is not set.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        '&#039;' (single quote) becomes '&amp;#039;' only when ENT_QUOTES is set.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        '&lt;' (less than) becomes '&amp;lt;'
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        '&gt;' (greater than) becomes '&amp;gt;'
       </simpara>
      </listitem>
     </itemizedlist>
     <example>
      <title><function>htmlspecialchars</function> example</title>
      <programlisting role="php">
$new = htmlspecialchars("&lt;a href='test'&gt;Test&lt;/a&gt;", ENT_QUOTES);
      </programlisting>
     </example>
    </para>
    <para>
     Note that this function does not translate anything beyond what
     is listed above. For full entity translation, see
     <function>htmlentities</function>.  Also note that the optional second
         argument was added in PHP 3.0.17 and PHP 4.0.3.
    </para>
    <para>
     See also <function>htmlentities</function> and
     <function>nl2br</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.implode">
   <refnamediv>
    <refname>implode</refname>
    <refpurpose>Join array elements with a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>implode</function></funcdef>
      <paramdef>string <parameter>glue</parameter></paramdef>
      <paramdef>array <parameter>pieces</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string containing a string representation of all the
     array elements in the same order, with the glue string between
     each element.
     <example>
      <title><function>Implode</function> example</title>
      <programlisting role="php">
$colon_separated = implode (":", $array);
      </programlisting>
     </example>
    </para>
    <note>
     <para>
      <function>implode</function> can, for historical reasons, accept
      its parameters in either order. For consistency with
      <function>explode</function>, however, it may be less confusing
      to use the documented order of arguments.
     </para>
    </note>
    <simpara>
     See also <function>explode</function>, <function>join</function>,
     and <function>split</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.join">
   <refnamediv>
    <refname>join</refname>
    <refpurpose>Join array elements with a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>join</function></funcdef>
      <paramdef>string <parameter>glue</parameter></paramdef>
      <paramdef>array <parameter>pieces</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>join</function> is an alias to
     <function>implode</function>, and is identical in every way.
    </simpara>
    <simpara>
     See also <function>explode</function>, <function>implode</function>,
     and <function>split</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.levenshtein">
   <refnamediv>
    <refname>levenshtein</refname> 
    <refpurpose>
     Calculate Levenshtein distance between two strings         
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
                        <funcdef>int <function>levenshtein</function></funcdef>
                        <paramdef>string <parameter>str1</parameter></paramdef>
                        <paramdef>string <parameter>str2</parameter></paramdef>
                 </funcprototype>
                 <funcprototype>
                        <funcdef>int <function>levenshtein</function></funcdef>
                        <paramdef>string <parameter>str1</parameter></paramdef>
                        <paramdef>string <parameter>str2</parameter></paramdef>
                        <paramdef>int <parameter>cost_ins</parameter></paramdef>
                        <paramdef>int <parameter>cost_rep</parameter></paramdef>
                        <paramdef>int <parameter>cost_del</parameter></paramdef>
                 </funcprototype>
                 <funcprototype>
                        <funcdef>int <function>levenshtein</function></funcdef>
                        <paramdef>string <parameter>str1</parameter></paramdef>
                        <paramdef>string <parameter>str2</parameter></paramdef>
                        <paramdef>function <parameter>cost</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
                 This function returns the Levenshtein-Distance between the
     two argument strings or -1, if one of the argument strings
     is longer than the limit of 255 characters (255 should be
                 more than enough for name or dictionary comparison, and 
     nobody serious would be doing genetic analysis with PHP).
    </para>
    <para>
     The Levenshtein distance is defined as the minimal number of
     characters you have to replace, insert or delete to transform
     <parameter>str1</parameter> into <parameter>str2</parameter>.
     The complexity of the algorithm is <literal>O(m*n)</literal>,
     where <literal>n</literal> and <literal>m</literal> are the
     length of <parameter>str1</parameter> and
     <parameter>str2</parameter> (rather good when compared to
     <function>similar_text</function>, which is O(max(n,m)**3),
     but still expensive).  
    </para>
          <para>
                 In its simpelest form the function will take only the two
     strings as parameter and will calculate just the number of
     insert, replace and delete operations needed to transform
     <parameter>str1</parameter> into <parameter>str2</parameter>.
    </para>
          <para> 
                 A second variant will take three additional parameters that
                 define the cost of insert, replace and delete operations.
     This is more general and adaptive than variant one, but not
     as efficient.
                </para>
          <para>  
                 The third variant (which is not implemented yet) will be
                 the  most general and adaptive, but also the slowest alternative.
                 It will call a user-supplied function that will determine the
                 cost for every possible operation.
                </para>
          <para>
                 The user-supplied function will be called with the following 
     arguments:
     <itemizedlist>
      <listitem>
       <simpara>
                          operation to apply: 'I', 'R' or 'D'
       </simpara>
      </listitem>
      <listitem>
       <simpara>
                          actual character in string 1
       </simpara>
      </listitem>
      <listitem>
       <simpara>
                          actual character in string 2
       </simpara>
      </listitem>
      <listitem>
       <simpara>
                          position in string 1
       </simpara>
      </listitem>
      <listitem>
       <simpara>
                          position in string 2
       </simpara>
      </listitem>
      <listitem>
       <simpara>
                          remaining characters in string 1
       </simpara>
      </listitem>
      <listitem>
       <simpara>
                          remaining characters in string 2
       </simpara>
      </listitem>
     </itemizedlist>
                 The user-supplied function has to return a positive integer
                 describing the cost for this particular operation, but it
                 may decide to use only some of the supplied arguments.
                </para>
                <para> 
                 The user-supplied function approach offers the possibility to
                 take into account the relevance of and/or difference between 
     certain symbols (characters) or even the context those symbols
     appear in to determine the cost of insert, replace and delete 
     operations, but at the cost of loosing all optimizations done
     regarding cpu register utilization and cache misses that have
     been worked into the other two variants. 
                </para>
    <para>
     See also <function>soundex</function>, 
     <function>similar_text</function>
                 and <function>metaphone</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ltrim">
   <refnamediv>
    <refname>ltrim</refname> 
    <refpurpose>
     Strip whitespace from the beginning of a string
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ltrim</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function strips whitespace from the start of a string and
     returns the stripped string.  The whitespace
     characters it currently strips are: "\n", "\r", "\t", "\v", "\0",
     and a plain space.
    </para>
    <para>
     See also <function>chop</function>, <function>rtrim</function>, and
     <function>trim</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.md5">
   <refnamediv>
    <refname>md5</refname>
    <refpurpose>Calculate the md5 hash of a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>md5</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Calculates the MD5 hash of <parameter>str</parameter> using the
     <ulink url="&url.rfc;rfc1321.html">RSA Data Security, Inc. 
     MD5 Message-Digest Algorithm</ulink>.
    </para>
        <para>
        See also: <function>crc32</function>
        </para>
   </refsect1>
  </refentry>

  <refentry id="function.metaphone">
   <refnamediv>
    <refname>Metaphone</refname>
    <refpurpose>Calculate the metaphone key of a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>metaphone</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Calculates the metaphone key of <parameter>str</parameter>.
    </para>
    <para>
     Similar to <function>soundex</function> metaphone creates the
     same key for similar sounding words. It's more accurate than
     <function>soundex</function> as it knows the basic rules of
     English pronunciation.  The metaphone generated keys are of
     variable length.
    </para>
    <para>
     Metaphone was developed by Lawrence Philips
     &lt;[EMAIL PROTECTED]>. It is described in ["Practical
     Algorithms for Programmers", Binstock &amp; Rex, Addison Wesley,
     1995].
     <note>
      <para>
       This function was added in PHP 4.0.
      </para>
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.nl2br">
   <refnamediv>
    <refname>nl2br</refname>
    <refpurpose>Converts newlines to HTML line breaks</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>nl2br</function></funcdef>
      <paramdef>string <parameter>string</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns <parameter>string</parameter> with '&lt;BR&gt;' inserted
     before all newlines.
    </para>
    <para>
     See also <function>htmlspecialchars</function>,
     <function>htmlentities</function> and
     <function>wordwrap</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ord">
   <refnamediv>
    <refname>Ord</refname>
    <refpurpose>Return ASCII value of character</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>ord</function></funcdef>
      <paramdef>string <parameter>string</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the ASCII value of the first character of
     <parameter>string</parameter>.  This function complements
     <function>chr</function>.
     <example>
      <title><function>Ord</function> example</title>
      <programlisting role="php">
if (ord ($str) == 10) {
    echo "The first character of \$str is a line feed.\n";
}
      </programlisting>
     </example>
    </para>
    <simpara>
     See also <function>chr</function>.
    </simpara> 
   </refsect1>
  </refentry>

  <refentry id="function.parse-str">
   <refnamediv>
    <refname>parse_str</refname>
    <refpurpose>Parses the string into variables</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>parse_str</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
      <paramdef>array <parameter><optional>arr</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Parses <parameter>str</parameter> as if it were the query string
     passed via an URL and sets variables in the current scope. If 
     the second parameter <parameter>arr</parameter> is present, 
     variables are stored in this variable as an array elements instead. 
    </para>
    <para>
     <example>
      <title>Using <function>parse_str</function></title>
      <programlisting role="php">
$str = "first=value&amp;second[]=this+works&amp;second[]=another";
parse_str($str);
echo $first;     /* prints "value" */
echo $second[0]; /* prints "this works" */
echo $second[1]; /* prints "another" */
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.print">
   <refnamediv>
    <refname>print</refname>
    <refpurpose>Output a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef><function>print</function></funcdef>
      <paramdef>string <parameter>arg</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Outputs <parameter>arg</parameter>.
    </simpara>
    <simpara>
     See also: <function>echo</function>, <function>printf</function>,
     and <function>flush</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.printf">
   <refnamediv>
    <refname>printf</refname>
    <refpurpose>Output a formatted string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>printf</function></funcdef>
      <paramdef>string <parameter>format</parameter></paramdef>
      <paramdef>mixed 
       <parameter><optional>args</optional></parameter>...
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Produces output according to <parameter>format</parameter>, which
     is described in the documentation for <function>sprintf</function>.
    </simpara>
    <simpara>
     See also: <function>print</function>, <function>sprintf</function>, 
         <function>sscanf</function>, <function>fscanf</function>,
         and <function>flush</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.quoted-printable-decode">
   <refnamediv>
    <refname>quoted_printable_decode</refname>
    <refpurpose>
     Convert a quoted-printable string to an 8 bit string
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string
       <function>quoted_printable_decode</function>
      </funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     This function returns an 8-bit binary string corresponding to the
     decoded quoted printable string.  This function is similar to
     <function>imap_qprint</function>, except this one does not
     require the IMAP module to work.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.quotemeta">
   <refnamediv>
    <refname>quotemeta</refname>
    <refpurpose>Quote meta characters</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>quotemeta</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a version of str with a backslash character
     (<literal>\</literal>) before every character that is among
     these: <screen>. \\ + * ? [ ^ ] ( $ )</screen>
    </para>
    <simpara>
     See also <function>addslashes</function>,
     <function>htmlentities</function>, 
     <function>htmlspecialchars</function>, 
     <function>nl2br</function>, and 
     <function>stripslashes</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.rtrim">
   <refnamediv>
    <refname>rtrim</refname>
    <refpurpose>Remove trailing whitespace.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcdef>string <function>rtrim</function></funcdef>
     <paramdef>string <parameter>str</parameter></paramdef>
    </funcsynopsis>
    <para>
     Returns the argument string without trailing whitespace,
     including newlines.  This is an alias for <function>chop</function>.
     <example>
      <title><function>rtrim</function> example</title>
      <programlisting role="php">
$trimmed = rtrim ($line);
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>trim</function>, <function>ltrim</function>, and
     <function>rtrim</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sscanf">
   <refnamediv>
    <refname>sscanf</refname>
    <refpurpose>Parses input from a string according to a format</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>sscanf</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
      <paramdef>string <parameter>format</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>var1</optional></parameter>...
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
         The function <function>sscanf</function> is the input analog of
         <function>printf</function>. <function>Sscanf</function> reads from
         the string <parameter>str</parameter> and interprets it according to
         the specified <parameter>format</parameter>. If only two parameters were
         passed to this function, the values parsed will be returned as an array.
         <example>
         <title><function>Sscanf</function> Example</title>
         <programlisting role="php">
// getting the serial number
$serial = sscanf("SN/2350001","SN/%d");
// and the date of manufacturing
$mandate = "January 01 2000";
list($month, $day, $year) = sscanf($mandate,"%s %d %d");
echo "Item $serial was manufactured on: $year-".substr($month,0,3)."-$day\n";
         </programlisting>
         </example>
         If optional parameters are passed, the function will return the number of
         assigned values. The optional parameters must be passed by reference.
 <example>
         <title><function>Sscanf</function> - using optional parameters</title>
         <programlisting role="php">
// get author info and generate DocBook entry
$auth = "24\tLewis Carroll";
$n = sscanf($auth,"%d\t%s %s", &amp;$id, &amp;$first, &amp;$last);
echo "&lt;author id='$id'&gt;
        &lt;firstname&gt;$first&lt;/firstname&gt;
        &lt;surname&gt;$last&lt;/surname&gt;
&lt;/author&gt;\n";
         </programlisting>
         </example>
    </para>
    <para>
     See also: <function>fscanf</function>, <function>printf</function>,
     and <function>sprintf</function>. 
    </para>
   </refsect1>
  </refentry>
 
  <refentry id="function.setlocale">
   <refnamediv>
    <refname>setlocale</refname>
    <refpurpose>Set locale information</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>setlocale</function></funcdef>
      <paramdef>string <parameter>category</parameter></paramdef>
      <paramdef>string <parameter>locale</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <parameter>Category</parameter> is a string specifying the
     category of the functions affected by the locale setting:
     <itemizedlist>
      <listitem>
       <simpara>
        LC_ALL for all of the below
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        LC_COLLATE for string comparison - not currently implemented in PHP
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        LC_CTYPE for character classification and conversion, for
        example <function>strtoupper</function>
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        LC_MONETARY for localeconv() - not currently implemented in
        PHP
       </simpara>
      </listitem>
      <listitem>
       <simpara> 
        LC_NUMERIC for decimal separator
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        LC_TIME for date and time formatting with
        <function>strftime</function>
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     If <parameter>locale</parameter> is the empty string
     <literal>""</literal>, the locale names will be set from the
     values of environment variables with the same names as the above
     categories, or from "LANG".
    </para>
    <para>
     If locale is zero or <literal>"0"</literal>, the locale setting
     is not affected, only the current setting is returned.
    </para>
    <para>
     Setlocale returns the new current locale, or false if the locale
     functionality is not implemented in the plattform, the specified
     locale does not exist or the category name is invalid.
     An invalid category name also causes a warning message.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.similar-text">
   <refnamediv>
    <refname>similar_text</refname>
    <refpurpose>
     Calculate the similarity between two strings
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>similar_text</function></funcdef>
      <paramdef>string <parameter>first</parameter></paramdef>
      <paramdef>string <parameter>second</parameter></paramdef>
      <paramdef>double 
       <parameter><optional>percent</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This calculates the similarity between two strings as described
     in Oliver [1993]. Note that this implementation does not use a
     stack as in Oliver's pseudo code, but recursive calls which may
     or may not speed up the whole process. Note also that the
     complexity of this algorithm is O(N**3) where N is the length of
     the longest string.
    </para>
    <para>
     By passing a reference as third argument,
     <function>similar_text</function> will calculate the similarity
     in percent for you. It returns the number of matching chars in
     both strings.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.soundex">
   <refnamediv>
    <refname>soundex</refname>
    <refpurpose>Calculate the soundex key of a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>soundex</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Calculates the soundex key of <parameter>str</parameter>.
    </para>
    <para>
     Soundex keys have the property that words pronounced similarly
     produce the same soundex key, and can thus be used to simplify
     searches in databases where you know the pronunciation but not
     the spelling. This soundex function returns a string 4 characters
     long, starting with a letter.
    </para>
    <para>
     This particular soundex function is one described by Donald Knuth
     in "The Art Of Computer Programming, vol. 3: Sorting And
     Searching", Addison-Wesley (1973), pp. 391-392.
    </para>
    <para>
     <example>
      <title>Soundex Examples</title>
      <programlisting role="php">
soundex ("Euler") == soundex ("Ellery") == 'E460';
soundex ("Gauss") == soundex ("Ghosh") == 'G200';
soundex ("Hilbert") == soundex ("Heilbronn") == 'H416';
soundex ("Knuth") == soundex ("Kant") == 'K530';
soundex ("Lloyd") == soundex ("Ladd") == 'L300';
soundex ("Lukasiewicz") == soundex ("Lissajous") == 'L222';
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sprintf">
   <refnamediv>
    <refname>sprintf</refname>
    <refpurpose>Return a formatted string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>sprintf</function></funcdef>
      <paramdef>string <parameter>format</parameter></paramdef>
      <paramdef>mixed 
       <parameter><optional>args</optional></parameter>...
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns a string produced according to the formatting string
     <parameter>format</parameter>.
    </simpara>
    <simpara>
     The format string is composed of zero or more directives:
     ordinary characters (excluding <literal>%</literal>) that are
     copied directly to the result, and <emphasis>conversion
     specifications</emphasis>, each of which results in fetching its
     own parameter.  This applies to both <function>sprintf</function>
     and <function>printf</function>.
    </simpara>
    <para>
     Each conversion specification consists of a percent sign
     (<literal>%</literal>), followed by one or more of these
     elements, in order:
     <orderedlist>
      <listitem>
       <simpara>
        An optional <emphasis>padding specifier</emphasis> that says
        what character will be used for padding the results to the
        right string size.  This may be a space character or a
        <literal>0</literal> (zero character).  The default is to pad
        with spaces.  An alternate padding character can be specified
        by prefixing it with a single quote (<literal>'</literal>).
        See the examples below.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        An optional <emphasis>alignment specifier</emphasis> that says
        if the result should be left-justified or right-justified.
        The default is right-justified; a <literal>-</literal>
        character here will make it left-justified.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        An optional number, a <emphasis>width specifier</emphasis>
        that says how many characters (minimum) this conversion should
        result in.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        An optional <emphasis>precision specifier</emphasis> that says
        how many decimal digits should be displayed for floating-point
        numbers.  This option has no effect for other types than
        double. (Another function useful for formatting numbers is
        <function>number_format</function>.)
       </simpara>
      </listitem>
      <listitem>
       <para>
        A <emphasis>type specifier</emphasis> that says what type the
        argument data should be treated as.  Possible types:
        <simplelist>
         <member>
          <literal>%</literal> - a literal percent character. No
          argument is required.
         </member>
         <member>
          <literal>b</literal> - the argument is treated as an
          integer, and presented as a binary number.
         </member>
         <member>
          <literal>c</literal> - the argument is treated as an
          integer, and presented as the character with that ASCII
          value.
         </member>
         <member>
          <literal>d</literal> - the argument is treated as an
          integer, and presented as a decimal number.
         </member>
         <member>
          <literal>f</literal> - the argument is treated as a double,
          and presented as a floating-point number.
         </member>
         <member>
          <literal>o</literal> - the argument is treated as an
          integer, and presented as an octal number.
         </member>
         <member>
          <literal>s</literal> - the argument is treated as and
          presented as a string.
         </member>
         <member>
          <literal>x</literal> - the argument is treated as an integer
          and presented as a hexadecimal number (with lowercase
          letters).
         </member>
         <member>
          <literal>X</literal> - the argument is treated as an integer
          and presented as a hexadecimal number (with uppercase
          letters).
         </member>
        </simplelist>
       </para>
      </listitem>
     </orderedlist>
    </para>
    <simpara>
     See also: <function>printf</function>, <function>sscanf</function>,
         <function>fscanf</function>, and <function>number_format</function>.
    </simpara>
   </refsect1>
   <refsect1>
    <title>Examples</title>
    <para>
     <example>
      <title><function>Sprintf</function>: zero-padded integers</title>
      <programlisting role="php">
$isodate = sprintf ("%04d-%02d-%02d", $year, $month, $day);
      </programlisting>
     </example>
     <example>
      <title><function>Sprintf</function>: formatting currency</title>
      <programlisting role="php">
$money1 = 68.75;
$money2 = 54.35;
$money = $money1 + $money2;
// echo $money will output "123.1";
$formatted = sprintf ("%01.2f", $money);
// echo $formatted will output "123.10"
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.strncasecmp">
   <refnamediv>
    <refname>strncasecmp</refname>
    <refpurpose>
     Binary safe case-insensitive string comparison of the first n characters
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>strncasecmp</function></funcdef>
      <paramdef>string <parameter>str1</parameter></paramdef>
      <paramdef>string <parameter>str2</parameter></paramdef>
      <paramdef>int <parameter>len</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function is similar to <function>strcasecmp</function>, with the
     difference that you can specify the (upper limit of the) number of
     characters (<parameter>len</parameter>) from each string to be
     used in the comparison. If any of the strings is shorter than
     <parameter>len</parameter>, then the length of that string will be
     used for the comparison.
    </para>
    <simpara> 
     Returns &lt; 0 if <parameter>str1</parameter> is less than
     <parameter>str2</parameter>; &gt; 0 if <parameter>str1</parameter>
     is greater than <parameter>str2</parameter>, and 0 if they are
     equal.
    </simpara>
    <simpara>
     See also <function>ereg</function>, <function>strcasecmp</function>,
     <function>strcmp</function>, <function>substr</function>, 
     <function>stristr</function>, and <function>strstr</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.strcasecmp">
   <refnamediv>
    <refname>strcasecmp</refname>
    <refpurpose>
     Binary safe case-insensitive string comparison
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>strcasecmp</function></funcdef>
      <paramdef>string <parameter>str1</parameter></paramdef>
      <paramdef>string <parameter>str2</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns &lt; 0 if <parameter>str1</parameter> is less than
     <parameter>str2</parameter>; &gt; 0 if <parameter>str1</parameter>
     is greater than <parameter>str2</parameter>, and 0 if they are
     equal.
    <example>
      <title><function>strcasecmp</function> example</title>
      <programlisting role="php">
$var1 = "Hello";
$var2 = "hello";
if (!strcasecmp ($var1, $var2)) {
    echo '$var1 is equal to $var2 in a case-insensitive string comparison';
}
      </programlisting>
    </example>
    </para>
    <simpara>
     See also <function>ereg</function>, <function>strcmp</function>,
     <function>substr</function>, <function>stristr</function>,
     <function>strncasecmp</function>, and <function>strstr</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.strchr">
   <refnamediv>
    <refname>strchr</refname> 
    <refpurpose>
     Find the first occurrence of a character
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>strchr</function></funcdef>
      <paramdef>string <parameter>haystack</parameter></paramdef>
      <paramdef>string <parameter>needle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function is an alias for <function>strstr</function>, and is
     identical in every way.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.strcmp">
   <refnamediv>
    <refname>strcmp</refname>
    <refpurpose>Binary safe string comparison</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>strcmp</function></funcdef>
      <paramdef>string <parameter>str1</parameter></paramdef>
      <paramdef>string <parameter>str2</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns &lt; 0 if <parameter>str1</parameter> is less than
     <parameter>str2</parameter>; &gt; 0 if <parameter>str1</parameter>
     is greater than <parameter>str2</parameter>, and 0 if they are
     equal.
    </simpara>
    <simpara>
     Note that this comparison is case sensitive.
    </simpara>
    <simpara>
     See also <function>ereg</function>,
     <function>strcasecmp</function>, <function>substr</function>,
     <function>stristr</function>, <function>strncasecmp</function>,
     <function>strncmp</function>, and <function>strstr</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.strcspn">
   <refnamediv>
    <refname>strcspn</refname>
    <refpurpose>
     Find length of initial segment not matching mask
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>strcspn</function></funcdef>
      <paramdef>string <parameter>str1</parameter></paramdef>
      <paramdef>string <parameter>str2</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns the length of the initial segment of
     <parameter>str1</parameter> which does <emphasis>not</emphasis>
     contain any of the characters in <parameter>str2</parameter>.
    </simpara>
    <simpara>
     See also <function>strspn</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.strip-tags">
   <refnamediv>
    <refname>strip_tags</refname>
    <refpurpose>Strip HTML and PHP tags from a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>strip_tags</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>allowable_tags</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function tries to strip all HTML and PHP tags from the given
     string.  It errors on the side of caution in case of incomplete
     or bogus tags.  It uses the same tag stripping state machine as
     the <function>fgetss</function> function.
    </para>
    <para>
     You can use the optional second parameter to specify tags which
     should not be stripped.
     <note>
      <para>
       <parameter>Allowable_tags</parameter> was added in PHP 3.0.13,
       PHP4B3.
      </para> 
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.stripcslashes">
   <refnamediv>
    <refname>stripcslashes</refname>
    <refpurpose>
     Un-quote string quoted with <function>addcslashes</function>
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>stripcslashes</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string with backslashes stripped off. Recognizes
     C-like <literal>\n</literal>, <literal>\r</literal> ..., octal
     and hexadecimal representation.
     <note>
      <simpara>
       Added in PHP4b3-dev.
      </simpara>
     </note>
    </para>
    <simpara>
     See also <function>addcslashes</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.stripslashes">
   <refnamediv>
    <refname>stripslashes</refname>
    <refpurpose>
     Un-quote string quoted with <function>addslashes</function>
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>stripslashes</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string with backslashes stripped off.
     (<literal>\'</literal> becomes <literal>'</literal> and so on.)
     Double backslashes are made into a single backslash.
    </para>
    <simpara>
     See also <function>addslashes</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.stristr">
   <refnamediv>
    <refname>stristr</refname>
    <refpurpose>
     Case-insensitive <function>strstr</function>
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>stristr</function></funcdef>
      <paramdef>string <parameter>haystack</parameter></paramdef>
      <paramdef>string <parameter>needle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns all of <parameter>haystack</parameter> from the first
     occurrence of <parameter>needle</parameter> to the end.
     <parameter>needle</parameter> and <parameter>haystack</parameter>
     are examined in a case-insensitive manner.
    </para>
    <para>
     If <parameter>needle</parameter> is not found, returns false.
    </para>
    <para>
     If <parameter>needle</parameter> is not a string, it is converted
     to an integer and applied as the ordinal value of a character.
    </para>
    <para>
     See also <function>strchr</function>,
     <function>strrchr</function>, <function>substr</function>, and
     <function>ereg</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.strlen">
   <refnamediv>
    <refname>strlen</refname>
    <refpurpose>Get string length</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>strlen</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the length of <parameter>string</parameter>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.strnatcmp">
   <refnamediv>
    <refname>strnatcmp</refname>
    <refpurpose>
         String comparisons using a "natural order" algorithm
        </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>strnatcmp</function></funcdef>
      <paramdef>string <parameter>str1</parameter></paramdef>
      <paramdef>string <parameter>str2</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
         This function implements a comparison algorithm that orders
         alphanumeric strings in the way a human being would, this is
         described as a "natural ordering".  An example of the difference
         between this algorithm and the regular computer string sorting
         algorithms (used in <function>strcmp</function>) can be seen
         below:
         <informalexample>
          <programlisting>
$arr1 = $arr2 = array ("img12.png","img10.png","img2.png","img1.png");
echo "Standard string comparison\n";
usort($arr1,"strcmp");
print_r($arr1);
echo "\nNatural order string comparison\n";
usort($arr2,"strnatcmp");
print_r($arr2);
          </programlisting>
         </informalexample>
         The code above will generate the following output:
         <informalexample>
          <programlisting>
Standard string comparison
Array
(
    [0] =&gt; img1.png
    [1] =&gt; img10.png
    [2] =&gt; img12.png
    [3] =&gt; img2.png
)

Natural order string comparison
Array
(
    [0] =&gt; img1.png
    [1] =&gt; img2.png
    [2] =&gt; img10.png
    [3] =&gt; img12.png
)
          </programlisting>
         </informalexample>
         For more infomation see: Martin Pool's <ulink
         url="&url.strnatcmp;">Natural Order String Comparison</ulink>
         page.
        </para>
        <simpara>
         Similar to other string comparison functions, this one returns
         &lt; 0 if <parameter>str1</parameter> is less than
         <parameter>str2</parameter>; &gt; 0 if <parameter>str1</parameter>
         is greater than <parameter>str2</parameter>, and 0 if they are
         equal.
    </simpara>
    <simpara>
     Note that this comparison is case sensitive.
    </simpara>
    <simpara>
     See also <function>ereg</function>,
     <function>strcasecmp</function>, <function>substr</function>,
     <function>stristr</function>, <function>strcmp</function>,
     <function>strncmp</function>, <function>strncasecmp</function>,
     <function>strnatcasecmp</function>, <function>strstr</function>, 
     <function>natsort</function> and <function>natcasesort</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.strnatcasecmp">
   <refnamediv>
    <refname>strnatcasecmp</refname>
    <refpurpose>
         Case insensitive string comparisons using a "natural order" algorithm
        </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>strnatcasecmp</function></funcdef>
      <paramdef>string <parameter>str1</parameter></paramdef>
      <paramdef>string <parameter>str2</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
         This function implements a comparison algorithm that orders
         alphanumeric strings in the way a human being would.  The
         behavior of this function is similar to
         <function>strnatcmp</function>, except that the comparison is
         not case sensitive.  For more infomation see: Martin Pool's
         <ulink url="&url.strnatcmp;">Natural Order String
         Comparison</ulink> page.
        </para>
        <simpara>
         Similar to other string comparison functions, this one returns
         &lt; 0 if <parameter>str1</parameter> is less than
         <parameter>str2</parameter>; &gt; 0 if <parameter>str1</parameter>
         is greater than <parameter>str2</parameter>, and 0 if they are
         equal.
    </simpara>
    <simpara>
     See also <function>ereg</function>,
     <function>strcasecmp</function>, <function>substr</function>,
     <function>stristr</function>, <function>strcmp</function>,
     <function>strncmp</function>, <function>strncasecmp</function>,
     <function>strnatcmp</function>, and <function>strstr</function>.
    </simpara>
   </refsect1>
  </refentry>
 
  <refentry id="function.strncmp">
   <refnamediv>
    <refname>strncmp</refname>
    <refpurpose>
         Binary safe string comparison of the first n characters
        </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>strncmp</function></funcdef>
      <paramdef>string <parameter>str1</parameter></paramdef>
      <paramdef>string <parameter>str2</parameter></paramdef>
      <paramdef>int <parameter>len</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
         This function is similar to <function>strcmp</function>, with the
         difference that you can specify the (upper limit of the) number of 
         characters (<parameter>len</parameter>) from each string to be
         used in the comparison. If any of the strings is shorter than
         <parameter>len</parameter>, then the length of that string will be
         used for the comparison.
        </para>
        <simpara>
     Returns &lt; 0 if <parameter>str1</parameter> is less than
     <parameter>str2</parameter>; &gt; 0 if <parameter>str1</parameter>
     is greater than <parameter>str2</parameter>, and 0 if they are
     equal.
    </simpara>
    <simpara>
     Note that this comparison is case sensitive.
    </simpara>
    <simpara>
     See also <function>ereg</function>, <function>strncasecmp</function>,
     <function>strcasecmp</function>, <function>substr</function>,
     <function>stristr</function>, <function>strcmp</function>,
         and <function>strstr</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.str-pad">
   <refnamediv>
    <refname>str_pad</refname>
    <refpurpose>Pad a string to a certain length with another string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>str_pad</function></funcdef>
      <paramdef>string <parameter>input</parameter></paramdef>
      <paramdef>int <parameter>pad_length</parameter></paramdef>
      <paramdef>string
       <parameter><optional>pad_string</optional></parameter></paramdef>
      <paramdef>int
       <parameter><optional>pad_type</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This functions pads the <parameter>input</parameter> string on
     the left, the right, or both sides to the specifed padding
     length. If the optional argument
     <parameter>pad_string</parameter> is not supplied, the
     <parameter>input</parameter> is padded with spaces, otherwise it
     is padded with characters from <parameter>pad_string</parameter>
     up to the limit.
    </para>

    <para>
     Optional argument <parameter>pad_type</parameter> can be
     STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTH.  If
     <parameter>pad_type</parameter> is not specified it is assumed to
     be STR_PAD_RIGHT.
    </para>
    
    <para>
      If the value of <parameter>pad_length</parameter> is negative or
      less than the length of the input string, no padding takes
      place.
    </para>

    <para>
     <example>
      <title><function>str_pad</function> example</title>
      <programlisting role="php">
$input = "Alien";
print str_pad($input, 10);                      // produces "Alien     "
print str_pad($input, 10, "-=", STR_PAD_LEFT);  // produces "-=-=-Alien"
print str_pad($input, 10, "_", STR_PAD_BOTH);   // produces "__Alien___"
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.strpos">
   <refnamediv>
    <refname>strpos</refname>
    <refpurpose>
     Find position of first occurrence of a string
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>strpos</function></funcdef>
      <paramdef>string <parameter>haystack</parameter></paramdef>
      <paramdef>string <parameter>needle</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>offset</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the numeric position of the first occurrence of
     <parameter>needle</parameter> in the
     <parameter>haystack</parameter> string.  Unlike the
     <function>strrpos</function>, this function can take a full
     string as the <parameter>needle</parameter> parameter and the
     entire string will be used.
    </para>
    <para>
     If <parameter>needle</parameter> is not found, returns false.
     <note>
      <para>
       It is easy to mistake the return values for "character found at
       position 0" and "character not found".  Here's how to detect
       the difference:
       <informalexample>
        <programlisting role="php">
// in PHP 4.0b3 and newer:
$pos = strpos ($mystring, "b");
if ($pos === false) { // note: three equal signs
    // not found...
}

// in versions older than 4.0b3:
$pos = strpos ($mystring, "b");
if (is_string ($pos) &amp;&amp; !$pos) {
    // not found...
}
        </programlisting>
       </informalexample>
      </para>
     </note>
    </para>
    <para>
     If <parameter>needle</parameter> is not a string, it is converted
     to an integer and applied as the ordinal value of a character.
    </para>
    <para>
     The optional <parameter>offset</parameter> parameter allows you
     to specify which character in <parameter>haystack</parameter> to
     start searching. The position returned is still relative to the
     the beginning of <parameter>haystack</parameter>.
    </para>
    <para>
     See also <function>strrpos</function>,
     <function>strrchr</function>, <function>substr</function>,
     <function>stristr</function>, and <function>strstr</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.strrchr">
   <refnamediv>
    <refname>strrchr</refname>
    <refpurpose>
     Find the last occurrence of a character in a string
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>strrchr</function></funcdef>
      <paramdef>string <parameter>haystack</parameter></paramdef>
      <paramdef>string <parameter>needle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns the portion of
     <parameter>haystack</parameter> which starts at the last
     occurrence of <parameter>needle</parameter> and goes until the
     end of <parameter>haystack</parameter>.
    </para>
    <para>
     Returns false if <parameter>needle</parameter> is not found.
    </para>
    <para>
     If <parameter>needle</parameter> contains more than one
     character, the first is used.
    </para>
    <para>
     If <parameter>needle</parameter> is not a string, it is converted
     to an integer and applied as the ordinal value of a character.
     <example>
      <title><function>Strrchr</function> example</title>
      <programlisting role="php">
// get last directory in $PATH
$dir = substr (strrchr ($PATH, ":"), 1);

// get everything after last newline
$text = "Line 1\nLine 2\nLine 3";
$last = substr (strrchr ($text, 10), 1 );
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>substr</function>,
     <function>stristr</function>, and <function>strstr</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.str-repeat">
   <refnamediv>
    <refname>str_repeat</refname>
    <refpurpose>Repeat a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>str_repeat</function></funcdef>
      <paramdef>string <parameter>input</parameter></paramdef>
      <paramdef>int <parameter>multiplier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns <parameter>input_str</parameter> repeated
     <parameter>multiplier</parameter> times.
     <parameter>multiplier</parameter> has to be greater than 0.
    </para>
    <example>
     <title><function>Str_repeat</function> example</title>
     <programlisting role="php">
echo str_repeat ("-=", 10);
     </programlisting>
    </example>
    <para>
     This will output "-=-=-=-=-=-=-=-=-=-=".
    </para>
    <note>
     <para>
      This function was added in PHP 4.0.
     </para> 
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.strrev">
   <refnamediv>
    <refname>strrev</refname>
    <refpurpose>Reverse a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>strrev</function></funcdef>
      <paramdef>string <parameter>string</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns <parameter>string</parameter>, reversed.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.strrpos">
   <refnamediv>
    <refname>strrpos</refname>
    <refpurpose>
     Find position of last occurrence of a char in a string
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>strrpos</function></funcdef>
      <paramdef>string <parameter>haystack</parameter></paramdef>
      <paramdef>char <parameter>needle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the numeric position of the last occurrence of
     <parameter>needle</parameter> in the
     <parameter>haystack</parameter> string.  Note that the needle in
     this case can only be a single character.  If a string is passed
     as the needle, then only the first character of that string will
     be used.
    </para>
    <para>
     If <parameter>needle</parameter> is not found, returns false.
     <note>
      <para>
       It is easy to mistake the return values for "character found at
       position 0" and "character not found".  Here's how to detect
       the difference:
       <informalexample>
        <programlisting role="php">
// in PHP 4.0b3 and newer:
$pos = strrpos ($mystring, "b");
if ($pos === false) { // note: three equal signs
    // not found...
}

// in versions older than 4.0b3:
$pos = strrpos ($mystring, "b");
if (is_string ($pos) &amp;&amp; !$pos) {
    // not found...
}
        </programlisting>
       </informalexample>
      </para>
     </note>
    </para>
    <para>
     If <parameter>needle</parameter> is not a string, it is converted
     to an integer and applied as the ordinal value of a character.
    </para>
    <para>
     See also <function>strpos</function>,
     <function>strrchr</function>, <function>substr</function>,
     <function>stristr</function>, and <function>strstr</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.strspn">
   <refnamediv>
    <refname>strspn</refname>
    <refpurpose>
     Find length of initial segment matching mask
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>strspn</function></funcdef>
      <paramdef>string <parameter>str1</parameter></paramdef>
      <paramdef>string <parameter>str2</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns the length of the initial segment of
     <parameter>str1</parameter> which consists entirely of characters
     in <parameter>str2</parameter>.
    </simpara>
    <para>         
     <informalexample>
      <programlisting role="php">
strspn ("42 is the answer, what is the question ...", "1234567890");
      </programlisting>
      <para>
       will return 2 as result. 
      </para>
     </informalexample>
    </para>
    <simpara>
     See also <function>strcspn</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.strstr">
   <refnamediv>
    <refname>strstr</refname>
    <refpurpose>Find first occurrence of a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>strstr</function></funcdef>
      <paramdef>string <parameter>haystack</parameter></paramdef>
      <paramdef>string <parameter>needle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns all of <parameter>haystack</parameter> from the first
     occurrence of <parameter>needle</parameter> to the end.
    </para>
    <para>
     If <parameter>needle</parameter> is not found, returns false.
    </para>
    <para>
     If <parameter>needle</parameter> is not a string, it is converted
     to an integer and applied as the ordinal value of a character.
    </para>
    <para>
     <note>
      <para>
       Note that this function is case-sensitive.  For
       case-insensitive searches, use <function>stristr</function>.
      </para>
     </note>
    </para>
    <para>
     <example>
      <title><function>Strstr</function> example</title>
      <programlisting role="php">
$email = '[EMAIL PROTECTED]';
$domain = strstr ($email, '@');
print $domain; // prints @designmultimedia.com
      </programlisting>
     </example> 
    </para>
    <para>
     See also <function>stristr</function>,
     <function>strrchr</function>, <function>substr</function>, and
     <function>ereg</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.strtok">
   <refnamediv>
    <refname>strtok</refname>
    <refpurpose>Tokenize string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>strtok</function></funcdef>
      <paramdef>string <parameter>arg1</parameter></paramdef>
      <paramdef>string <parameter>arg2</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>strtok</function> is used to tokenize a string.  That
     is, if you have a string like "This is an example string" you
     could tokenize this string into its individual words by using the
     space character as the token.
     <example>
      <title><function>Strtok</function> example</title>
      <programlisting role="php">
$string = "This is an example string";
$tok = strtok ($string," ");
while ($tok) {
    echo "Word=$tok&lt;br>";
    $tok = strtok (" ");
}
      </programlisting>
     </example>
    </para>
    <para>
     Note that only the first call to strtok uses the string argument.
     Every subsequent call to strtok only needs the token to use, as
     it keeps track of where it is in the current string.  To start
     over, or to tokenize a new string you simply call strtok with the
     string argument again to initialize it.  Note that you may put
     multiple tokens in the token parameter.  The string will be
     tokenized when any one of the characters in the argument are
     found.
    </para>
    <para>
     Also be careful that your tokens may be equal to "0". This
     evaluates to false in conditional expressions.
    </para>
    <para>
     See also <function>split</function> and
     <function>explode</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.strtolower">
   <refnamediv>
    <refname>strtolower</refname>
    <refpurpose>Make a string lowercase</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>strtolower</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns <parameter>string</parameter> with all alphabetic
     characters converted to lowercase.
    </para>
    <para>
     Note that 'alphabetic' is determined by the current locale. This
     means that in i.e. the default "C" locale, characters such as
     umlaut-A (? will not be converted.
    </para>
    <example>
     <title><function>Strtolower</function> example</title>
     <programlisting role="php">
$str = "Mary Had A Little Lamb and She LOVED It So";
$str = strtolower($str);        
print $str; # Prints mary had a little lamb and she loved it so
     </programlisting>
    </example>
    <para>
     See also <function>strtoupper</function>
     and <function>ucfirst</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.strtoupper">
   <refnamediv>
    <refname>strtoupper</refname>
    <refpurpose>Make a string uppercase</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>strtoupper</function></funcdef>
      <paramdef>string <parameter>string</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns <parameter>string</parameter> with all alphabetic
     characters converted to uppercase.
    </para>
    <para>
     Note that 'alphabetic' is determined by the current locale. For
     instance, in the default "C" locale characters such as umlaut-a
     (? will not be converted.
    </para>
    <example>
     <title><function>Strtoupper</function> example</title>
     <programlisting role="php">
$str = "Mary Had A Little Lamb and She LOVED It So";
$str = strtoupper ($str);       
print $str; # Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO
     </programlisting>
    </example>
    <para>
     See also <function>strtolower</function>
     and <function>ucfirst</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.str-replace">
   <refnamediv>
    <refname>str_replace</refname>
    <refpurpose>
     Replace all occurrences of needle in haystack with str
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>str_replace</function></funcdef>
      <paramdef>string <parameter>needle</parameter></paramdef>
      <paramdef>string <parameter>str</parameter></paramdef>
      <paramdef>string <parameter>haystack</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function replaces all occurences of
     <parameter>needle</parameter> in <parameter>haystack</parameter>
     with the given <parameter>str</parameter>. If you don't need
     fancy replacing rules, you should always use this function
     instead of <function>ereg_replace</function>.</para>
    <para>
     <example>
      <title><function>Str_replace</function> example</title>
      <programlisting role="php">
$bodytag = str_replace ("%body%", "black", "&lt;body text=%body%>");
      </programlisting>
     </example>
    </para>
    <para>
     This function is binary safe.
    </para>
    <note>
     <para>
      <function>Str_replace</function> was added in PHP 3.0.6, but was
      buggy up until PHP 3.0.8.
     </para>
    </note>
    <para>
     See also <function>ereg_replace</function> and
     <function>strtr</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.strtr">
   <refnamediv>
    <refname>strtr</refname>
    <refpurpose>Translate certain characters</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>strtr</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
      <paramdef>string <parameter>from</parameter></paramdef>
      <paramdef>string <parameter>to</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function operates on <parameter>str</parameter>, translating
     all occurrences of each character in <parameter>from</parameter>
     to the corresponding character in <parameter>to</parameter> and
     returning the result.
    </para>
    <para>
     If <parameter>from</parameter> and <parameter>to</parameter> are
     different lengths, the extra characters in the longer of the two
     are ignored.
     <example>
      <title><function>Strtr</function> example</title>
      <programlisting role="php">
$addr = strtr($addr, "é´¨?, "aao");
      </programlisting>
     </example>
    </para>
    <para>
     <function>strtr</function> can be called with only two
     arguments. If called with two arguments it behaves in a new way:
     <parameter>from</parameter> then has to be an array that contains
     string -> string pairs that will be replaced in the source
     string. <function>strtr</function> will always look for the
     longest possible match first and will *NOT* try to replace stuff
     that it has already worked on.
    </para>
    <para>
     Examples:
     <informalexample>
      <programlisting role="php">
$trans = array ("hello" =&gt; "hi", "hi" =&gt; "hello");
echo strtr("hi all, I said hello", $trans) . "\n";
      </programlisting>
     </informalexample>
     This will show: "hello all, I said hi",
    </para>
    <note>
     <simpara>
      This feature (two arguments) was added in PHP 4.0.
     </simpara>
    </note>
    <para>
     See also <function>ereg_replace</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.substr">
   <refnamediv>
    <refname>substr</refname>
    <refpurpose>Return part of a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>substr</function></funcdef>
      <paramdef>string <parameter>string</parameter></paramdef>
      <paramdef>int <parameter>start</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>length</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Substr returns the portion of <parameter>string</parameter>
     specified by the <parameter>start</parameter> and
     <parameter>length</parameter> parameters.
    </para>
    <para>
     If <parameter>start</parameter> is positive, the returned string
     will start at the <parameter>start</parameter>'th position in
     <parameter>string</parameter>, counting from zero. For instance,
     in the string '<literal>abcdef</literal>', the character at
     position <literal>0</literal> is '<literal>a</literal>', the
     character at position <literal>2</literal> is
     '<literal>c</literal>', and so forth.
    </para>
    <para>
     Examples:
     <informalexample>
      <programlisting role="php">
$rest = substr ("abcdef", 1);    // returns "bcdef"
$rest = substr ("abcdef", 1, 3); // returns "bcd"
      </programlisting>
     </informalexample>
    </para>
    <para>
     If <parameter>start</parameter> is negative, the returned string
     will start at the <parameter>start</parameter>'th character
     from the end of <parameter>string</parameter>.</para>  
    <para>
     Examples:
     <informalexample>
      <programlisting role="php">
$rest = substr ("abcdef", -1);    // returns "f"
$rest = substr ("abcdef", -2);    // returns "ef"
$rest = substr ("abcdef", -3, 1); // returns "d"
      </programlisting>
     </informalexample>
    </para>
    <para>
     If <parameter>length</parameter> is given and is positive, the
     string returned will end <parameter>length</parameter> characters
     from <parameter>start</parameter>. If this would result in a
     string with negative length (because the start is past the end of
     the string), then the returned string will contain the single
     character at <parameter>start</parameter>.
    </para>
    <para>
     If <parameter>length</parameter> is given and is negative, the
     string returned will end <parameter>length</parameter> characters
     from the end of <parameter>string</parameter>. If this would
     result in a string with negative length, then the returned string
     will contain the single character at
     <parameter>start</parameter>.
    </para>
    <para>
     Examples:
     <informalexample>
      <programlisting role="php">
$rest = substr ("abcdef", 1, -1); // returns "bcde"
      </programlisting>
     </informalexample>
    </para>
    <para>
     See also <function>strrchr</function> and
     <function>ereg</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.substr-count">
   <refnamediv>
    <refname>substr_count</refname>
    <refpurpose>Count the number of substring occurrences</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>substr_count</function></funcdef>
      <paramdef>string <parameter>haystrack</parameter></paramdef>
      <paramdef>string <parameter>needle</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>substr_count</function> returns the number of times the
     <parameter>needle</parameter> substring occurs in the
     <parameter>haystack</parameter> string.
    </para>

    <para>
     <example>
      <title><function>substr_count</function> example</title>
      <programlisting>
print substr_count("This is a test", "is"); // prints out 2
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.substr-replace">
   <refnamediv>
    <refname>substr_replace</refname>
    <refpurpose>Replace text within a portion of a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>substr_replace</function></funcdef>
      <paramdef>string <parameter>string</parameter></paramdef>
      <paramdef>string <parameter>replacement</parameter></paramdef>
      <paramdef>int <parameter>start</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>length</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>substr_replace</function> replaces the part of
     <parameter>string</parameter> delimited by the
     <parameter>start</parameter> and (optionally)
     <parameter>length</parameter> parameters with the string given in
     <parameter>replacement</parameter>. The result is returned.
    </para>
    <para>
     If <parameter>start</parameter> is positive, the replacing will
     begin at the <parameter>start</parameter>'th offset into
     <parameter>string</parameter>.  
    </para>
    <para>
     If <parameter>start</parameter> is negative, the replacing will
     begin at the <parameter>start</parameter>'th character from the
     end of <parameter>string</parameter>.  
    </para>
    <para>
     If <parameter>length</parameter> is given and is positive, it
     represents the length of the portion of
     <parameter>string</parameter> which is to be replaced. If it is
     negative, it represents the number of characters from the end of
     <parameter>string</parameter> at which to stop replacing. If it
     is not given, then it will default to strlen(
     <parameter>string</parameter> ); i.e. end the replacing at the
     end of <parameter>string</parameter>.
    </para>
    <para>
     <example>
      <title><function>Substr_replace</function> example</title>
      <programlisting role="php">
&lt;?php
$var = 'ABCDEFGH:/MNRPQR/';
echo "Original: $var&lt;hr&gt;\n";

/* These two examples replace all of $var with 'bob'. */
echo substr_replace ($var, 'bob', 0) . "&lt;br&gt;\n";
echo substr_replace ($var, 'bob', 0, strlen ($var)) . "&lt;br&gt;\n";

/* Insert 'bob' right at the beginning of $var. */
echo substr_replace ($var, 'bob', 0, 0) . "&lt;br&gt;\n";

/* These next two replace 'MNRPQR' in $var with 'bob'. */
echo substr_replace ($var, 'bob', 10, -1) . "&lt;br&gt;\n";
echo substr_replace ($var, 'bob', -7, -1) . "&lt;br&gt;\n";

/* Delete 'MNRPQR' from $var. */
echo substr_replace ($var, '', 10, -1) . "&lt;br&gt;\n";
?&gt;
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>str_replace</function> and
     <function>substr</function>.
    </para>
    <note>
     <simpara>
      <function>Substr_replace</function> was added in PHP 4.0.
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.trim">
   <refnamediv>
    <refname>trim</refname> 
    <refpurpose>
     Strip whitespace from the beginning and end of a string
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>trim</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function strips whitespace from the start and the end of a
     string and returns the stripped string.  The whitespace
     characters it currently strips are: "\n", "\r", "\t", "\v", "\0",
     and a plain space.
    </para>
    <para>
     See also <function>chop</function>, <function>rtrim</function> and
     <function>ltrim</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ucfirst">
   <refnamediv>
    <refname>ucfirst</refname> 
    <refpurpose>Make a string's first character uppercase</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ucfirst</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Capitalizes the first character of <parameter>str</parameter> if
     that character is alphabetic.
    </para>
    <para>
     Note that 'alphabetic' is determined by the current locale. For
     instance, in the default "C" locale characters such as umlaut-a
     (? will not be converted.
     <example>
      <title><function>Ucfirst</function> example</title>
      <programlisting role="php">    
$text = 'mary had a little lamb and she loved it so.';
$text = ucfirst ($text); // $text is now Mary had a little lamb 
                         // and she loved it so.
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>strtoupper</function> and
     <function>strtolower</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.ucwords">
   <refnamediv>
    <refname>ucwords</refname> 
    <refpurpose>
     Uppercase the first character of each word in a string
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>ucwords</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Capitalizes the first character of each word in
     <parameter>str</parameter> if that character is alphabetic.
     <example>
      <title><function>ucwords</function> example</title>
      <programlisting role="php">
$text = "mary had a little lamb and she loved it so.";
$text = ucwords($text); // $text is now: Mary Had A Little 
                        // Lamb And She Loved It So.
      </programlisting>
     </example>
     <note>
      <simpara>
       The definition of a word is any string of characters
       that is immediately after a whitespace (These  are:
       space, form-feed, newline, carriage return, horizontal tab,
       and vertical tab).
      </simpara>
     </note>
    </para>
    <para>
     See also <function>strtoupper</function>,
     <function>strtolower</function> and <function>ucfirst</function>.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.wordwrap">
   <refnamediv>
    <refname>wordwrap</refname>
    <refpurpose>
     Wraps a string to a given number of characters using a string
     break character.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>wordwrap</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
      <paramdef>int
       <parameter><optional>width</optional></parameter>
      </paramdef>
      <paramdef>string
       <parameter><optional>break</optional></parameter>
      </paramdef>
      <paramdef>int
       <parameter><optional>cut</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Wraps the string <parameter>str</parameter> at the column number
     specified by the (optional) <parameter>width</parameter>
     parameter.  The line is broken using the (optional)
     <parameter>break</parameter> parameter.
    </para>
    <para>
     <function>wordwrap</function> will automatically wrap at column
     75 and break using '\n' (newline) if <parameter>width</parameter>
     or <parameter>break</parameter> are not given.
    </para>
    <para>
     If the <parameter>cut</parameter> is set to 1, the string is
         always wrapped at the specified width. So if you have a word
         that is larger than the given width, it is broken appart.
         (See second example).
     <note>
      <para>
       The <parameter>cut</parameter> parameter was added in PHP 4.0.3.
      </para>
     </note>
    </para>
    <para>
     <example>
      <title><function>wordwrap</function> example</title>
      <programlisting role="php">
$text = "The quick brown fox jumped over the lazy dog.";
$newtext = wordwrap( $text, 20 );

echo "$newtext\n";
      </programlisting>
     </example>
    </para>
    <para>
     This example would display:
    </para>
    <para>
     <informalexample>
      <programlisting>
The quick brown fox
jumped over the lazy dog.
      </programlisting>
     </informalexample>
    </para>
    <para>
     <example>
      <title><function>wordwrap</function> example</title>
      <programlisting role="php">
$text = "A very long woooooooooooord.";
$newtext = wordwrap( $text, 8, "\n", 1);

echo "$newtext\n";
      </programlisting>
     </example>
    </para>
    <para>
     This example would display:
    </para>
    <para>
     <informalexample>
      <programlisting>
A very
long
wooooooo
ooooord.
      </programlisting>
     </informalexample>
    </para>
    <para>
     See also <function>nl2br</function>.
    </para>
   </refsect1>
  </refentry>


 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/swf.xml
+++ phpdoc/kr/functions/swf.xml
 <reference id="ref.swf">
  <title>Shockwave Flash functions</title>
  <titleabbrev>SWF</titleabbrev>
  
  <partintro>
   <simpara>
    PHP offers the ability to create Shockwave Flash files via Paul
    Haeberli's libswf module.  You can download libswf at <ulink
    url="&url.swf;">&url.swf;</ulink>.  Once you have libswf all you
    need to do is to configure <option
    role="configure">--with-swf[=DIR]</option> where DIR is a location
    containing the directories include and lib. The include directory
    has to contain the swf.h file and the lib directory has to contain
    the libswf.a file. If you unpack the libswf distribution the two
    files will be in one directory. Consequently you will have to copy
    the files to the proper location manually.
   </simpara>
   <para>
    Once you've successfully installed PHP with Shockwave Flash
    support you can then go about creating Shockwave files from PHP.
    You would be surprised at what you can do, take the following
    code:
    <example>
     <title>SWF example</title>
     <programlisting role="php">
&lt;?php
swf_openfile ("test.swf", 256, 256, 30, 1, 1, 1);
swf_ortho2 (-100, 100, -100, 100);
swf_defineline (1, -70, 0, 70, 0, .2);
swf_definerect (4, 60, -10, 70, 0, 0);
swf_definerect (5, -60, 0, -70, 10, 0);
swf_addcolor (0, 0, 0, 0);

swf_definefont (10, "Mod");
swf_fontsize (5);
swf_fontslant (10);
swf_definetext (11, "This be Flash wit PHP!", 1);

swf_pushmatrix ();
swf_translate (-50, 80, 0);
swf_placeobject (11, 60);
swf_popmatrix ();

for ($i = 0; $i &lt; 30; $i++) {
    $p = $i/(30-1);
    swf_pushmatrix ();
    swf_scale (1-($p*.9), 1, 1);
    swf_rotate (60*$p,  'z');
    swf_translate (20+20*$p, $p/1.5, 0);
    swf_rotate (270*$p,  'z');
    swf_addcolor ($p, 0, $p/1.2, -$p);
    swf_placeobject (1, 50);
    swf_placeobject (4, 50);
    swf_placeobject (5, 50);
    swf_popmatrix ();
    swf_showframe ();
}

for ($i = 0; $i &lt; 30; $i++) {
    swf_removeobject (50);
    if (($i%4) == 0) {
        swf_showframe ();
    }
}

swf_startdoaction ();
swf_actionstop ();
swf_enddoaction ();

swf_closefile ();
?&gt;
     </programlisting>
    </example>
    It will produce the animation found at the following <ulink
    url="&url.swf.test;">url</ulink>.
   </para>
   <note>
    <para>
     SWF support was added in PHP 4 RC2.
    </para>
    <para>
     The libswf does not have support for Windows. The development of
     that library has been stopped, and the source is not available
     to port it to another systems.
    </para>
   </note>
  </partintro>
  
  <refentry id="function.swf-openfile">
   <refnamediv>
    <refname>swf_openfile</refname>
    <refpurpose>Open a new Shockwave Flash file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_openfile</function>
      </funcdef>
      <paramdef>string
       <parameter>filename</parameter>
      </paramdef>
      <paramdef>float
       <parameter>width</parameter>
      </paramdef>
      <paramdef>float
       <parameter>height</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>framerate</parameter>
      </paramdef>
      <paramdef>float
       <parameter>r</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>g</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>b</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_openfile</function> function opens a new file
     named <parameter>filename</parameter> with a width of
     <parameter>width</parameter> and a height of
     <parameter>height</parameter> a frame rate of
     <parameter>framerate</parameter> and background with a red color
     of <parameter>r</parameter> a green color of
     <parameter>g</parameter> and a blue color of
     <parameter>b</parameter>.
    </para>
    <para>
     The <function>swf_openfile</function> must be the first function
     you call, otherwise your script will cause a segfault.  If you
     want to send your output to the screen make the filename:
     "php://stdout" (support for this is in 4.0.1 and up).
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-closefile">
   <refnamediv>
    <refname>swf_closefile</refname>
    <refpurpose>Close the current Shockwave Flash file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_closefile</function>
      </funcdef>
      <paramdef>int
       <parameter>
        <optional>return_file</optional>
       </parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Close a file that was opened by the
     <function>swf_openfile</function> function.  If the 
     <parameter>return_file</parameter> parameter is set then the contents
     of the SWF file are returned from the function.
    </para>
    <para>
     <example>
      <title>
       Creating a simple flash file based on user input and outputting it
       and saving it in a database
      </title>
      <programlisting role="php">
&lt;?php

// The $text variable is submitted by the
// user

// Global variables for database
// access (used in the swf_savedata() function)
$DBHOST = "localhost";
$DBUSER = "sterling";
$DBPASS = "secret";

swf_openfile ("php://stdout", 256, 256, 30, 1, 1, 1);

    swf_definefont (10, "Ligon-Bold");
        swf_fontsize (12);
        swf_fontslant (10);
    
    swf_definetext (11, $text, 1);
    
    swf_pushmatrix ();
        swf_translate (-50, 80, 0);
        swf_placeobject (11, 60);
    swf_popmatrix ();

    swf_showframe ();
  
    swf_startdoaction ();
        swf_actionstop ();
    swf_enddoaction ();

$data = swf_closefile (1);

$data ?
  swf_savedata ($data) :
  die ("Error could not save SWF file");

// void swf_savedata (string data)
// Save the generated file a database
// for later retrieval
function swf_savedata ($data)
{
    global $DBHOST, 
           $DBUSER,
           $DBPASS;
    
    $dbh = @mysql_connect ($DBHOST, $DBUSER, $DBPASS);

    if (!$dbh) {
        die (sprintf ("Error [%d]: %s",
                      mysql_errno (), mysql_error ()));
    }

    $stmt = "INSERT INTO swf_files (file) VALUES ('$data')";

    $sth = @mysql_query ($stmt, $dbh);

    if (!$sth) {
        die (sprintf ("Error [%d]: %s",
                      mysql_errno (), mysql_error ()));
    }

    @mysql_free_result ($sth);
    @mysql_close ($dbh);
}
&gt;
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-labelframe">
   <refnamediv>
    <refname>swf_labelframe</refname>
    <refpurpose>Label the current frame</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_labelframe</function>
      </funcdef>
      <paramdef>string
       <parameter>name</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Label the current frame with the name given by the
     <parameter>name</parameter> parameter.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-showframe">
   <refnamediv>
    <refname>swf_showframe</refname>
    <refpurpose>Display the current frame</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_showframe</function>
      </funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     The swf_showframe function will output the current frame.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-setframe">
   <refnamediv>
    <refname>swf_setframe</refname>
    <refpurpose>Switch to a specified frame</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_setframe</function>
      </funcdef>
      <paramdef>int
       <parameter>framenumber</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_setframe</function> changes the active frame to
     the frame specified by <parameter>framenumber</parameter>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-getframe">
   <refnamediv>
    <refname>swf_getframe</refname>
    <refpurpose>Get the frame number of the current frame</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int
       <function>swf_getframe</function>
      </funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_getframe</function> function gets the number of
     the current frame.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-mulcolor">
   <refnamediv>
    <refname>swf_mulcolor</refname>
    <refpurpose>
     Sets the global multiply color to the rgba value specified
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_mulcolor</function>
      </funcdef>
      <paramdef>float 
       <parameter>r</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>g</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>b</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>a</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_mulcolor</function> function sets the global
     multiply color to the <parameter>rgba</parameter> color
     specified.  This color is then used (implicitly) by the
     <function>swf_placeobject</function>,
     <function>swf_modifyobject</function> and the
     <function>swf_addbuttonrecord</function> functions.  The color of
     the object will be multiplied by the <parameter>rgba</parameter>
     values when the object is written to the screen.
    </para>
    <note>
     <para>
      The <parameter>rgba</parameter> values can be either positive or
      negative.
     </para>
    </note>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-addcolor">
   <refnamediv>
    <refname>swf_addcolor</refname>
    <refpurpose>
     Set the global add color to the rgba value specified
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_addcolor</function>
      </funcdef>
      <paramdef>float 
       <parameter>r</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>g</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>b</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>a</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_addcolor</function> function sets the global
     add color to the <parameter>rgba</parameter> color specified.
     This color is then used (implicitly) by the
     <function>swf_placeobject</function>,
     <function>swf_modifyobject</function> and the
     <function>swf_addbuttonrecord</function> functions.  The color of
     the object will be add by the <parameter>rgba</parameter> values
     when the object is written to the screen.
    </para>
    <note>
     <para>
      The <parameter>rgba</parameter> values can be either positive or
      negative.
     </para>
    </note>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-placeobject">
   <refnamediv>
    <refname>swf_placeobject</refname>
    <refpurpose>Place an object onto the screen</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_placeobject</function>
      </funcdef>
      <paramdef>int 
       <parameter>objid</parameter>
      </paramdef>
      <paramdef>int 
       <parameter>depth</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Places the object specified by <parameter>objid</parameter> in
     the current frame at a depth of <parameter>depth</parameter>.
     The <parameter>objid</parameter> parameter and the
     <parameter>depth</parameter> must be between 1 and 65535.
    </para>
    <para>
     This uses the current mulcolor (specified by
     <function>swf_mulcolor</function>) and the current addcolor
     (specified by <function>swf_addcolor</function>) to color the
     object and it uses the current matrix to position the object.
    </para>
    <note>
     <para>
      Full RGBA colors are supported.
     </para>
    </note>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-modifyobject">
   <refnamediv>
    <refname>swf_modifyobject</refname>
    <refpurpose>Modify an object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_modifyobject</function>
      </funcdef>
      <paramdef>int
       <parameter>depth</parameter>
      </paramdef>
      <paramdef>int
       <parameter>how</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Updates the position and/or color of the object at the specified
     depth, <parameter>depth</parameter>.  The parameter
     <parameter>how</parameter> determines what is updated.
     <parameter>how</parameter> can either be the constant MOD_MATRIX
     or MOD_COLOR or it can be a combination of both
     (MOD_MATRIX|MOD_COLOR).
    </para>
    <para>
     MOD_COLOR uses the current mulcolor (specified by the function
     <function>swf_mulcolor</function>) and addcolor (specified by the
     function <function>swf_addcolor</function>) to color the object.
     MOD_MATRIX uses the current matrix to position the object.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-removeobject">
   <refnamediv>
    <refname>swf_removeobject</refname>
    <refpurpose>Remove an object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_removeobject</function>
      </funcdef>
      <paramdef>int
       <parameter>depth</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Removes the object at the depth specified by
     <parameter>depth</parameter>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-nextid">
   <refnamediv>
    <refname>swf_nextid</refname>
    <refpurpose>Returns the next free object id</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int
       <function>swf_nextid</function>
      </funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_nextid</function> function returns the next
     available object id.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-startdoaction">
   <refnamediv>
    <refname>swf_startdoaction</refname>
    <refpurpose>
     Start a description of an action list for the current frame
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_startdoaction</function>
      </funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_startdoaction</function> function starts the
     description of an action list for the current frame.  This must
     be called before actions are defined for the current frame.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-actiongotoframe">
   <refnamediv>
    <refname>swf_actiongotoframe</refname>
    <refpurpose>Play a frame and then stop</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_actiongotoframe</function>
      </funcdef>
      <paramdef>int 
       <parameter>framenumber</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_actionGotoFrame</function> function will go to
     the frame specified by <parameter>framenumber</parameter>, play
     it, and then stop.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-actiongeturl">
   <refnamediv>
    <refname>swf_actiongeturl</refname>
    <refpurpose>Get a URL from a Shockwave Flash movie</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_actiongeturl</function>
      </funcdef>
      <paramdef>string 
       <parameter>url</parameter>
      </paramdef>
      <paramdef>string
       <parameter>target</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_actionGetUrl</function> function gets the URL
     specified by the parameter <parameter>url</parameter> with the
     target <parameter> target</parameter>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-actionnextframe">
   <refnamediv>
    <refname>swf_actionnextframe</refname>
    <refpurpose>Go foward one frame</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_actionnextframe</function>
      </funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     Go foward one frame.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-actionprevframe">
   <refnamediv>
    <refname>swf_actionprevframe</refname>
    <refpurpose>Go backwards one frame</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_actionprevframe</function>
      </funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-actionplay">
   <refnamediv>
    <refname>swf_actionplay</refname>
    <refpurpose>
     Start playing the flash movie from the current frame
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_actionplay</function>
      </funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     Start playing the flash movie from the current frame.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-actionstop">
   <refnamediv>
    <refname>swf_actionstop</refname>
    <refpurpose>
     Stop playing the flash movie at the current frame
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_actionstop</function>
      </funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     Stop playing the flash movie at the current frame.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-actiontogglequality">
   <refnamediv>
    <refname>swf_actiontogglequality</refname>
    <refpurpose>
     Toggle between low and high quality
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_actiontogglequality</function>
      </funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     Toggle the flash movie between high and low quality.
    </para>
   </refsect1>
  </refentry>
      
  <refentry id="function.swf-actionwaitforframe">
   <refnamediv>
    <refname>swf_actionwaitforframe</refname>
    <refpurpose>
     Skip actions if a frame has not been loaded
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_actionwaitforframe</function>
      </funcdef>
      <paramdef>int
       <parameter>framenumber</parameter>
      </paramdef>
      <paramdef>int
       <parameter>skipcount</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_actionWaitForFrame</function> function will
     check to see if the frame, specified by the
     <parameter>framenumber</parameter> parameter has been loaded, if
     not it will skip the number of actions specified by the
     <parameter>skipcount</parameter> parameter.  This can be useful
     for "Loading..." type animations.
    </para>
   </refsect1>
  </refentry>
      
  <refentry id="function.swf-actionsettarget">
   <refnamediv>
    <refname>swf_actionsettarget</refname>
    <refpurpose>Set the context for actions</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_actionsettarget</function>
      </funcdef>
      <paramdef>string
       <parameter>target</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_actionSetTarget</function> function sets the
     context for all actions.  You can use this to control other flash
     movies that are currently playing.
    </para>
   </refsect1>
  </refentry>
      
  <refentry id="function.swf-actiongotolabel">
   <refnamediv>
    <refname>swf_actiongotolabel</refname>
    <refpurpose>
     Display a frame with the specified label
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_actiongotolabel</function>
      </funcdef>
      <paramdef>string 
       <parameter>label</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_actionGotoLabel</function> function displays
     the frame with the label given by the
     <parameter>label</parameter> parameter and then stops.
    </para>
   </refsect1>
  </refentry>
      
  <refentry id="function.swf-enddoaction">
   <refnamediv>
    <refname>swf_enddoaction</refname>
    <refpurpose>End the current action</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_enddoaction</function>
      </funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     Ends the current action started by the
     <function>swf_startdoaction</function> function.
    </para>
   </refsect1>
  </refentry>
      
  <refentry id="function.swf-defineline">
   <refnamediv>
    <refname>swf_defineline</refname>
    <refpurpose>Define a line</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_defineline</function>
      </funcdef>
      <paramdef>int
       <parameter>objid</parameter>
      </paramdef>
      <paramdef>float
       <parameter>x1</parameter>
      </paramdef>
      <paramdef>float
       <parameter>y1</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>x2</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>y2</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>width</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_defineline</function> defines a line starting
     from the x coordinate given by <parameter>x1</parameter> and the
     y coordinate given by <parameter>y1 </parameter> parameter.  Up
     to the x coordinate given by the <parameter>x2</parameter>
     parameter and the y coordinate given by the
     <parameter>y2</parameter> parameter.  It will have a width
     defined by the <parameter>width</parameter> parameter.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-definerect">
   <refnamediv>
    <refname>swf_definerect</refname>
    <refpurpose>Define a rectangle</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_definerect</function>
      </funcdef>
      <paramdef>int
       <parameter>objid</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>x1</parameter>
      </paramdef>
      <paramdef>float
       <parameter>y1</parameter>
      </paramdef>
      <paramdef>float
       <parameter>x2</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>y2</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>width</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_definerect</function> defines a rectangle with
     an upper left hand coordinate given by the x,
     <parameter>x1</parameter>, and the y, <parameter>y1</parameter>.
     And a lower right hand coordinate given by the x coordinate,
     <parameter>x2</parameter>, and the y coordinate, <parameter>y2
     </parameter>.  Width of the rectangles border is given by the
     <parameter>width</parameter> parameter, if the width is 0.0 then
     the rectangle is filled.
    </para>
   </refsect1>
  </refentry>
      
  <refentry id="function.swf-definepoly">
   <refnamediv>
    <refname>swf_definepoly</refname>
    <refpurpose>
     Define a polygon
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_definepoly</function>
      </funcdef>
      <paramdef>int
       <parameter>objid</parameter>
      </paramdef>
      <paramdef>array
       <parameter>coords</parameter>
      </paramdef>
      <paramdef>int
       <parameter>npoints</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>width</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_definepoly</function> function defines a
     polygon given an array of x, y coordinates (the coordinates are
     defined in the parameter <parameter>coords</parameter>).  The
     parameter <parameter>npoints</parameter> is the number of overall
     points that are contained in the array given by
     <parameter>coords</parameter>.  The <parameter>width</parameter>
     is the width of the polygon's border, if set to 0.0 the polygon
     is filled.
    </para>
   </refsect1>
  </refentry>
      
  <refentry id="function.swf-startshape">
   <refnamediv>
    <refname>swf_startshape</refname>
    <refpurpose>Start a complex shape</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_startshape</function>
      </funcdef>
      <paramdef>int
       <parameter>objid</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_startshape</function> function starts a complex
     shape, with an object id given by the
     <parameter>objid</parameter> parameter.
    </para>
   </refsect1>
  </refentry>
      
  <refentry id="function.swf-shapelinesold">
   <refnamediv>
    <refname>swf_shapelinesolid</refname>
    <refpurpose>Set the current line style</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_shapelinesolid</function>
      </funcdef>
      <paramdef>float
       <parameter>r</parameter>
      </paramdef>
      <paramdef>float
       <parameter>g</parameter>
      </paramdef>
      <paramdef>float
       <parameter>b</parameter>
      </paramdef>
      <paramdef>float
       <parameter>a</parameter>
      </paramdef>
      <paramdef>float
       <parameter>width</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_shapeLineSolid</function> function sets the
     current line style to the color of the
     <parameter>rgba</parameter> parameters and width to the
     <parameter>width</parameter> parameter.  If 0.0 is given as a
     width then no lines are drawn.
    </para>
   </refsect1>
  </refentry>
      
  <refentry id="function.swf-shapefilloff">
   <refnamediv>
    <refname>swf_shapefilloff</refname>
    <refpurpose>Turns off filling</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_shapefilloff</function>
      </funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_shapeFillOff</function> function turns off
     filling for the current shape.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-shapefillsolid">
   <refnamediv>
    <refname>swf_shapefillsolid</refname>
    <refpurpose>
     Set the current fill style to the specified color
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_shapefillsolid</function>
      </funcdef>
      <paramdef>float
       <parameter>r</parameter>
      </paramdef>
      <paramdef>float
       <parameter>g</parameter>
      </paramdef>
      <paramdef>float
       <parameter>b</parameter>
      </paramdef>
      <paramdef>float
       <parameter>a</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_shapeFillSolid</function> function sets the
     current fill style to solid, and then sets the fill color to the
     values of the <parameter>rgba</parameter> parameters.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-shapefillbitmapclip">
   <refnamediv>
    <refname>swf_shapefillbitmapclip</refname>
    <refpurpose>
     Set current fill mode to clipped bitmap
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_shapefillbitmapclip</function>
      </funcdef>
      <paramdef>int 
       <parameter>bitmapid</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets the fill to bitmap clipped, empty spaces will be filled by
     the bitmap given by the <parameter>bitmapid</parameter>
     parameter.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-shapefillbitmaptile">
   <refnamediv>
    <refname>swf_shapefillbitmaptile</refname>
    <refpurpose>
     Set current fill mode to tiled bitmap
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_shapefillbitmaptile</function>
      </funcdef>
      <paramdef>int 
       <parameter>bitmapid</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets the fill to bitmap tile, empty spaces will be filled by the
     bitmap given by the <parameter>bitmapid</parameter> parameter
     (tiled).
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-shapemoveto">
   <refnamediv>
    <refname>swf_shapemoveto</refname>
    <refpurpose>Move the current position</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_shapemoveto</function>
      </funcdef>
      <paramdef>float 
       <parameter>x</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>y</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_shapeMoveTo</function> function moves the
     current position to the x coordinate given by the
     <parameter>x</parameter> parameter and the y position given by
     the <parameter>y</parameter> parameter.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-shapelineto">
   <refnamediv>
    <refname>swf_shapelineto</refname>
    <refpurpose>Draw a line</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_shapelineto</function>
      </funcdef>
      <paramdef>float 
       <parameter>x</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>y</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_shapeLineTo</function> draws a line to the x,y
     coordinates given by the <parameter>x</parameter> parameter &amp; the
     <parameter>y</parameter> parameter.  The current position is then
     set to the x,y parameters.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-shapecurveto">
   <refnamediv>
    <refname>swf_shapecurveto</refname>
    <refpurpose>
     Draw a quadratic bezier curve between two points
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_shapecurveto</function>
      </funcdef>
      <paramdef>float 
       <parameter>x1</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>y1</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>x2</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>y2</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_shapecurveto</function> function draws a
     quadratic bezier curve from the x coordinate given by
     <parameter>x1</parameter> and the y coordinate given by
     <parameter>y1</parameter> to the x coordinate given by
     <parameter>x2</parameter> and the y coordinate given by
     <parameter>y2</parameter>.  The current position is then set to
     the x,y coordinates given by the <parameter>x2</parameter> and
     <parameter>y2</parameter> parameters
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-shapecurveto3">
   <refnamediv>
    <refname>swf_shapecurveto3</refname>
    <refpurpose>Draw a cubic bezier curve</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_shapecurveto3</function>
      </funcdef>
      <paramdef>float 
       <parameter>x1</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>y1</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>x2</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>y2</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>x3</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>y3</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Draw a cubic bezier curve using the x,y coordinate pairs
     <parameter>x1</parameter>, <parameter>y1</parameter> and
     <parameter>x2</parameter>,<parameter>y2</parameter> as off curve
     control points and the x,y coordinate
     <parameter>x3</parameter>,<parameter> y3</parameter> as an
     endpoint.  The current position is then set to the x,y coordinate
     pair given by
     <parameter>x3</parameter>,<parameter>y3</parameter>.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-shapearc">
   <refnamediv>
    <refname>swf_shapearc</refname>
    <refpurpose>Draw a circular arc</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_shapearc</function>
      </funcdef>
      <paramdef>float 
       <parameter>x</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>y</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>r</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>ang1</parameter>
      </paramdef>
      <paramdef>float 
       <parameter>ang2</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_shapeArc</function> function draws a circular
     arc from angle A given by the <parameter>ang1</parameter>
     parameter to angle B given by the <parameter>ang2</parameter>
     parameter.  The center of the circle has an x coordinate given by
     the <parameter>x</parameter> parameter and a y coordinate given
     by the <parameter>y</parameter>, the radius of the circle is
     given by the <parameter>r</parameter> parameter.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-endshape">
   <refnamediv>
    <refname>swf_endshape</refname>
    <refpurpose>
     Completes the definition of the current shape
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_endshape</function>
      </funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_endshape</function> completes the definition of
     the current shape.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-definefont">
   <refnamediv>
    <refname>swf_definefont</refname>
    <refpurpose>
     Defines a font
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_definefont</function>
      </funcdef>
      <paramdef>int 
       <parameter>fontid</parameter>
      </paramdef>
      <paramdef>string 
       <parameter>fontname</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_definefont</function> function defines a font
     given by the <parameter>fontname</parameter> parameter and gives
     it the id specified by the <parameter>fontid</parameter>
     parameter.  It then sets the font given by <parameter>
     fontname</parameter> to the current font.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-setfont">
   <refnamediv>
    <refname>swf_setfont</refname>
    <refpurpose>Change the current font</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_setfont</function>
      </funcdef>
      <paramdef>int 
       <parameter>fontid</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_setfont</function> sets the current font to the
     value given by the <parameter>fontid</parameter> parameter.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-fontsize">
   <refnamediv>
    <refname>swf_fontsize</refname>
    <refpurpose>Change the font size</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_fontsize</function>
      </funcdef>
      <paramdef>float 
       <parameter>size</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_fontsize</function> function changes the font
     size to the value given by the <parameter>size</parameter>
     parameter.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-fontslant">
   <refnamediv>
    <refname>swf_fontslant</refname>
    <refpurpose>Set the font slant</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_fontslant</function>
      </funcdef>
      <paramdef>float 
       <parameter>slant</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Set the current font slant to the angle indicated by the
     <parameter>slant</parameter> parameter.  Positive values create a
     foward slant, negative values create a negative slant.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-fonttracking">
   <refnamediv>
    <refname>swf_fonttracking</refname>
    <refpurpose>Set the current font tracking</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_fonttracking</function>
      </funcdef>
      <paramdef>float 
       <parameter>tracking</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Set the font tracking to the value specified by the
     <parameter>tracking</parameter> parameter.  This function is used
     to increase the spacing between letters and text, positive values
     increase the space and negative values decrease the space between
     letters.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-getfontinfo">
   <refnamediv>
    <refname>swf_getfontinfo</refname>
    <refpurpose>
     The height in pixels of a capital A and a lowercase x
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array 
       <function>swf_getfontinfo</function>
      </funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_getfontinfo</function> function returns an
     associative array with the following parameters:
     <itemizedlist>
      <listitem>
       <simpara>
        Aheight -  The height in pixels of a capital A.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        xheight -  The height in pixels of a lowercase x.
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-definetext">
   <refnamediv>
    <refname>swf_definetext</refname>
    <refpurpose>Define a text string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_definetext</function>
      </funcdef>
      <paramdef>int 
       <parameter>objid</parameter>
      </paramdef>
      <paramdef>string 
       <parameter>str</parameter>
      </paramdef>
      <paramdef>int 
       <parameter>docenter</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Define a text string (the <parameter>str</parameter> parameter)
     using the current font and font size.  The
     <parameter>docenter</parameter> is where the word is centered, if
     <parameter>docenter</parameter> is 1, then the word is centered
     in x.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-textwidth">
   <refnamediv>
    <refname>swf_textwidth</refname>
    <refpurpose>Get the width of a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>float 
       <function>swf_textwidth</function>
      </funcdef>
      <paramdef>string 
       <parameter>str</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_textwidth</function> function gives the width
     of the string, <parameter>str</parameter>, in pixels, using the
     current font and font size.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-definebitmap">
   <refnamediv>
    <refname>swf_definebitmap</refname>
    <refpurpose>Define a bitmap</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_definebitmap</function>
      </funcdef>
      <paramdef>int 
       <parameter>objid</parameter>
      </paramdef>
      <paramdef>string 
       <parameter>image_name</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_definebitmap</function> function defines a
     bitmap given a GIF, JPEG, RGB or FI image.  The image will be
     converted into a Flash JPEG or Flash color map format.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-getbitmapinfo">
   <refnamediv>
    <refname>swf_getbitmapinfo</refname>
    <refpurpose>Get information about a bitmap</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array 
       <function>swf_getbitmapinfo</function>
      </funcdef>
      <paramdef>int 
       <parameter>bitmapid</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_getbitmapinfo</function> function returns an
     array of information about a bitmap given by the
     <parameter>bitmapid</parameter> parameter.  The returned array
     has the following elements:
     <itemizedlist>
      <listitem>
       <simpara>
        "size" -  The size in bytes of the bitmap.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "width" -  The width in pixels of the bitmap.
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        "height" -  The height in pixels of the bitmap.
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-startsymbol">
   <refnamediv>
    <refname>swf_startsymbol</refname>
    <refpurpose>Define a symbol</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_startsymbol</function>
      </funcdef>
      <paramdef>int 
       <parameter>objid</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Define an object id as a symbol.  Symbols are tiny flash movies
     that can be played simultaneously.  The
     <parameter>objid</parameter> parameter is the object id you want
     to define as a symbol.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-endsymbol">
   <refnamediv>
    <refname>swf_endsymbol</refname>
    <refpurpose>End the definition of a symbol</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_endsymbol</function>
      </funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_endsymbol</function> function ends the
     definition of a symbol that was started by the
     <function>swf_startsymbol</function> function.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-startbutton">
   <refnamediv>
    <refname>swf_startbutton</refname>
    <refpurpose>Start the definition of a button</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_startbutton</function>
      </funcdef>
      <paramdef>int 
       <parameter>objid</parameter>
      </paramdef>
      <paramdef>int 
       <parameter>type</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_startbutton</function> function starts off the
     definition of a button.  The <parameter>type</parameter>
     parameter can either be TYPE_MENUBUTTON or TYPE_PUSHBUTTON.  The
     TYPE_MENUBUTTON constant allows the focus to travel from the
     button when the mouse is down, TYPE_PUSHBUTTON does not allow the
     focus to travel when the mouse is down.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-addbuttonrecord">
   <refnamediv>
    <refname>swf_addbuttonrecord</refname>
    <refpurpose>
     Controls location, appearance and active area of the current button
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_addbuttonrecord</function>
      </funcdef>
      <paramdef>int 
       <parameter>states</parameter>
      </paramdef>
      <paramdef>int 
       <parameter>shapeid</parameter>
      </paramdef>
      <paramdef>int 
       <parameter>depth</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_addbuttonrecord</function> function allows you
     to define the specifics of using a button.  The first parameter,
     <parameter>states</parameter>, defines what states the button can
     have, these can be any or all of the following constants:
     BSHitTest, BSDown, BSOver or BSUp.  The second parameter, the
     <parameter>shapeid</parameter> is the look of the button, this is
     usually the object id of the shape of the button.  The
     <parameter>depth</parameter> parameter is the placement of the
     button in the current frame.
     <example>
      <title>
       <function>Swf_addbuttonrecord</function> function example
      </title>
      <programlisting role="php">
swf_startButton ($objid, TYPE_MENUBUTTON);
    swf_addButtonRecord (BSDown|BSOver, $buttonImageId, 340);
    swf_onCondition (MenuEnter);
        swf_actionGetUrl ("http://www.designmultimedia.com", "_level1");
    swf_onCondition (MenuExit);
        swf_actionGetUrl ("", "_level1");
swf_endButton ();
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-oncondition">
   <refnamediv>
    <refname>swf_oncondition</refname>
    <refpurpose>
     Describe a transition used to trigger an action list
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_oncondition</function>
      </funcdef>
      <paramdef>int
       <parameter>transition</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_onCondition</function> function describes a
     transition that will trigger an action list.  There are several
     types of possible transitions, the following are for buttons
     defined as TYPE_MENUBUTTON:
     <itemizedlist>
      <listitem>
       <simpara>
        IdletoOverUp
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        OverUptoIdle
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        OverUptoOverDown
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        OverDowntoOverUp
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        IdletoOverDown
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        OutDowntoIdle
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        MenuEnter (IdletoOverUp|IdletoOverDown)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        MenuExit (OverUptoIdle|OverDowntoIdle)
       </simpara>
      </listitem>
     </itemizedlist>
     For TYPE_PUSHBUTTON there are the following options:
     <itemizedlist>
      <listitem>
       <simpara>
        IdletoOverUp
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        OverUptoIdle
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        OverUptoOverDown
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        OverDowntoOverUp
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        OverDowntoOutDown
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        OutDowntoOverDown
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        OutDowntoIdle
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        ButtonEnter (IdletoOverUp|OutDowntoOverDown)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        ButtonExit  (OverUptoIdle|OverDowntoOutDown)
       </simpara>
      </listitem>
     </itemizedlist>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-endbutton">
   <refnamediv>
    <refname>swf_endbutton</refname>
    <refpurpose>
     End the definition of the current button
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_endbutton</function>
      </funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_endButton</function> function ends the
     definition of the current button.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-viewport">
   <refnamediv>
    <refname>swf_viewport</refname>
    <refpurpose>Select an area for future drawing</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_viewport</function>
      </funcdef>
      <paramdef>double 
       <parameter>xmin</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>xmax</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>ymin</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>ymax</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_viewport</function> function selects an area
     for future drawing for <parameter>xmin</parameter> to
     <parameter>xmax</parameter> and <parameter>ymin</parameter> to
     <parameter>ymax</parameter>, if this function is not called the
     area defaults to the size of the screen.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.swf-ortho">
   <refnamediv>
    <refname>swf_ortho</refname>
    <refpurpose>
     Defines an orthographic mapping of user coordinates onto the
     current viewport
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_ortho</function>
      </funcdef>
      <paramdef>double 
       <parameter>xmin</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>xmax</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>ymin</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>ymax</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>zmin</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>zmax</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_ortho</function> funcion defines a orthographic
     mapping of user coordinates onto the current viewport.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-ortho2">
   <refnamediv>
    <refname>swf_ortho2</refname>
    <refpurpose>
     Defines 2D orthographic mapping of user coordinates onto the
     current viewport
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_ortho2</function>
      </funcdef>
      <paramdef>double 
       <parameter>xmin</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>xmax</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>ymin</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>ymax</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_ortho2</function> function defines a two
     dimensional orthographic mapping of user coordinates onto the
     current viewport, this defaults to one to one mapping of the area
     of the Flash movie.  If a perspective transformation is desired,
     the <function>swf_perspective </function> function can be used.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-perspective">
   <refnamediv>
    <refname>swf_perspective</refname>
    <refpurpose>
     Define a perspective projection transformation
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_perspective</function>
      </funcdef>
      <paramdef>double 
       <parameter>fovy</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>aspect</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>near</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>far</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_perspective</function> function defines a
     perspective projection transformation.  The
     <parameter>fovy</parameter> parameter is field-of-view angle in
     the y direction.  The <parameter>aspect</parameter> parameter
     should be set to the aspect ratio of the viewport that is being
     drawn onto.  The <parameter>near</parameter> parameter is the
     near clipping plane and the <parameter>far</parameter> parameter
     is the far clipping plane.
    </para>
    <note>
     <para>
      Various distortion artifacts may appear when performing a
      perspective projection, this is because Flash players only have
      a two dimensional matrix.  Some are not to pretty.
     </para>
    </note>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-polarview">
   <refnamediv>
    <refname>swf_polarview</refname>
    <refpurpose>
     Define the viewer's position with polar coordinates
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_polarview</function>
      </funcdef>
      <paramdef>double 
       <parameter>dist</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>azimuth</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>incidence</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>twist</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_polarview</function> function defines the
     viewer's position in polar coordinates.  The
     <parameter>dist</parameter> parameter gives the distance between
     the viewpoint to the world space origin.  The
     <parameter>azimuth</parameter> parameter defines the azimuthal
     angle in the x,y coordinate plane, measured in distance from the
     y axis.  The <parameter>incidence</parameter> parameter defines
     the angle of incidence in the y,z plane, measured in distance
     from the z axis.  The incidence angle is defined as the angle of
     the viewport relative to the z axis.  Finally the
     <parameter>twist</parameter> specifies the amount that the
     viewpoint is to be rotated about the line of sight using the
     right hand rule.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-lookat">
   <refnamediv>
    <refname>swf_lookat</refname>
    <refpurpose>Define a viewing transformation</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>swf_lookat</function>
      </funcdef>
      <paramdef>double 
       <parameter>view_x</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>view_y</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>view_z</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>reference_x</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>reference_y</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>reference_z</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>twist</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_lookat</function> function defines a viewing
     transformation by giving the viewing position (the parameters
     <parameter>view_x</parameter>, <parameter>view_y</parameter>, and
     <parameter>view_z</parameter>) and the coordinates of a reference
     point in the scene, the reference point is defined by the
     <parameter>reference_x</parameter>, <parameter>reference_y
     </parameter>, and <parameter>reference_z</parameter> parameters.
     The <parameter>twist </parameter> controls the rotation along
     with viewer's z axis.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-pushmatrix">
   <refnamediv>
    <refname>swf_pushmatrix</refname>
    <refpurpose>
     Push the current transformation matrix back unto the stack
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_pushmatrix</function>
      </funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_pushmatrix</function> function pushes the
     current transformation matrix back onto the stack.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-popmatrix">
   <refnamediv>
    <refname>swf_popmatrix</refname>
    <refpurpose>
     Restore a previous transformation matrix
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_popmatrix</function>
      </funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_popmatrix</function> function pushes the
     current transformation matrix back onto the stack.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.swf-scale">
   <refnamediv>
    <refname>swf_scale</refname>
    <refpurpose>Scale the current transformation</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_scale</function>
      </funcdef>
      <paramdef>double 
       <parameter>x</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>y</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>z</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_scale</function> scales the x coordinate of the
     curve by the value of the <parameter>x</parameter> parameter, the
     y coordinate of the curve by the value of the
     <parameter>y</parameter> parameter, and the z coordinate of the
     curve by the value of the <parameter>z</parameter> parameter.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-translate">
   <refnamediv>
    <refname>swf_translate</refname>
    <refpurpose>Translate the current transformations</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_translate</function>
      </funcdef>
      <paramdef>double 
       <parameter>x</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>y</parameter>
      </paramdef>
      <paramdef>double 
       <parameter>z</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_translate</function> function translates the
     current transformation by the <parameter>x</parameter>,
     <parameter>y</parameter>, and <parameter>z</parameter> values
     given.
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-rotate">
   <refnamediv>
    <refname>swf_rotate</refname>
    <refpurpose>Rotate the current transformation</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_rotate</function>
      </funcdef>
      <paramdef>double 
       <parameter>angle</parameter>
      </paramdef>
      <paramdef>string 
       <parameter>axis</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_rotate</function> rotates the current
     transformation by the angle given by the
     <parameter>angle</parameter> parameter around the axis given by
     the <parameter>axis</parameter> parameter.  Valid values for the
     axis are 'x' (the x axis), 'y' (the y axis) or 'z' (the z axis).
    </para>
   </refsect1>
  </refentry>
    
  <refentry id="function.swf-posround">
   <refnamediv>
    <refname>swf_posround</refname>
    <refpurpose>
     Enables or Disables the rounding of the translation when objects
     are placed or moved
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>swf_posround</function>
      </funcdef>
      <paramdef>int 
       <parameter>round</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>swf_posround</function> function enables or
     disables the rounding of the translation when objects are placed
     or moved, there are times when text becomes more readable because
     rounding has been enabled.  The <parameter>round</parameter> is
     whether to enable rounding or not, if set to the value of 1, then
     rounding is enabled, if set to 0 then rounding is disabled.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/sybase.xml
+++ phpdoc/kr/functions/sybase.xml
 <reference id="ref.sybase">
  <title>Sybase functions</title>
  <titleabbrev>Sybase</titleabbrev>

  <refentry id="function.sybase-affected-rows">
   <refnamediv>
    <refname>sybase_affected_rows</refname>
    <refpurpose>get number of affected rows in last query</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>sybase_affected_rows</function></funcdef>
      <paramdef>int <parameter><optional>link_identifier</optional>
                    </parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns: The number of affected rows by the last query.
    </para>
    <para>
     <function>sybase_affected_rows</function> returns the number of
     rows affected by the last INSERT, UPDATE or DELETE query on the
     server associated with the specified link identifier.  If the
     link identifier isn't specified, the last opened link is assumed.
    </para>
    <para>
     This command is not effective for SELECT statements, only on
     statements which modify records. To retrieve the number of rows
     returned from a SELECT, use <function>sybase_num_rows</function>.
     <note>
      <para>
       This function is only available using the CT library interface
       to Sybase, and not the DB library.
      </para>
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sybase-close">
   <refnamediv>
    <refname>sybase_close</refname>
    <refpurpose>close Sybase connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>sybase_close</function></funcdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns: true on success, false on error
    </para>
    <para> sybase_close() closes the link to a Sybase database that's
    associated with the specified link identifier.  If the link
    identifier isn't specified, the last opened link is assumed.
    </para>
    <para> Note that this isn't usually necessary, as non-persistent
    open links are automatically closed at the end of the script's
    execution.
    </para>
    <para> sybase_close() will not close persistent links generated by
    sybase_pconnect().
    </para>
    <para> See also: <function>sybase_connect</function>,
                     <function>sybase_pconnect</function>.
    </para> 
   </refsect1>
  </refentry>

  <refentry id="function.sybase-connect">
   <refnamediv>
    <refname>sybase_connect</refname>
    <refpurpose>open Sybase server connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>sybase_connect</function></funcdef>
      <paramdef>string <parameter>servername</parameter></paramdef>
      <paramdef>string <parameter>username</parameter></paramdef>
      <paramdef>string <parameter>password</parameter></paramdef>
      <paramdef>string <parameter><optional>charset</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> Returns: A positive Sybase link identifier on success, or
    false on error.
    </para>
    <para> sybase_connect() establishes a connection to a Sybase server.
    The servername argument has to be a valid servername that is defined
    in the 'interfaces' file.
    </para>
    <para> In case a second call is made to sybase_connect() with the
    same arguments, no new link will be established, but instead, the
    link identifier of the already opened link will be returned.
    </para>
    <para> The link to the server will be closed as soon as the
    execution of the script ends, unless it's closed earlier by
    explicitly calling <function>sybase_close</function>.
    </para>
    <para>See also <function>sybase_pconnect</function>, 
                   <function>sybase_close</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sybase-data-seek">
   <refnamediv>
    <refname>sybase_data_seek</refname>
    <refpurpose>move internal row pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>sybase_data_seek</function></funcdef>
      <paramdef>int <parameter>result_identifier</parameter></paramdef>
      <paramdef>int <parameter>row_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> Returns: true on success, false on failure
    </para>
    <para> sybase_data_seek() moves the internal row pointer of the
    Sybase result associated with the specified result identifier to
    pointer to the specifyed row number.  The next call to
    <function>sybase_fetch_row</function> would return that row.
    </para>
    <para> See also: <function>sybase_data_seek</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sybase-fetch-array">
   <refnamediv>
    <refname>sybase_fetch_array</refname>
    <refpurpose>fetch row as array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>sybase_fetch_array</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> Returns: An array that corresponds to the fetched row, or
    false if there are no more rows.
    </para>
    <para>
     sybase_fetch_array() is an extended version of
     <function>sybase_fetch_row</function>.  In addition to storing the
     data in the numeric indices of the result array, it also stores
     the data in associative indices, using the field names as keys.
    </para>
    <para>
     An important thing to note is that using sybase_fetch_array() is
     NOT significantly slower than using sybase_fetch_row(), while it
     provides a significant added value.</para>
    <para>
     For further details, also see
     <function>sybase_fetch_row</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sybase-fetch-field">
   <refnamediv>
    <refname>sybase_fetch_field</refname>
    <refpurpose>get field information</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>object <function>sybase_fetch_field</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>field_offset</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an object containing field information.  
    </para>
    <para>
     sybase_fetch_field() can be used in order to obtain information about
     fields in a certain query result.  If the field offset isn't
     specified, the next field that wasn't yet retreived by
     sybase_fetch_field() is retreived.
    </para>
    <para>
     The properties of the object are:
    </para>

     <itemizedlist>
      <listitem><simpara>
        name - column name.  if the column is a result of a function, this property is 
set to computed#N,
        where #N is a serial number.
       </simpara></listitem>
      <listitem><simpara>
        column_source - the table from which the column was taken
       </simpara></listitem>
      <listitem><simpara>
        max_length - maximum length of the column
       </simpara></listitem>
      <listitem><simpara>
        numeric - 1 if the column is numeric
       </simpara></listitem> 
     <listitem><simpara>
       type - datatype of the column
      </simpara></listitem>
     </itemizedlist>

    <para>
     See also <function>sybase_field_seek</function>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sybase-fetch-object">
   <refnamediv>
    <refname>sybase_fetch_object</refname>
    <refpurpose>fetch row as object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>sybase_fetch_object</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> Returns: An object with properties that correspond to the
    fetched row, or false if there are no more rows.
    </para>
    <para> sybase_fetch_object() is similar to
    <function>sybase_fetch_array</function>, with one difference - an
    object is returned, instead of an array.  Indirectly, that means
    that you can only access the data by the field names, and not by
    their offsets (numbers are illegal property names).</para>  
    <para>
    Speed-wise, the function is identical to
    <function>sybase_fetch_array</function>, and almost as quick as
    <function>sybase_fetch_row</function> (the difference is
    insignificant).
    </para>
    <para> See also: <function>sybase_fetch-array</function> and
                     <function>sybase_fetch-row</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sybase-fetch-row">
   <refnamediv>
    <refname>sybase_fetch_row</refname>
    <refpurpose>get row as enumerated array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>sybase_fetch_row</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> Returns: An array that corresponds to the fetched row, or
    false if there are no more rows.
    </para>
    <para>
     sybase_fetch_row() fetches one row of data from the result
     associated with the specified result identifier.  The row is
     returned as an array.  Each result column is stored in an array
     offset, starting at offset 0.
    </para>
    <para>
     Subsequent call to sybase_fetch_rows() would return the next row
     in the result set, or false if there are no more rows.
    </para>
    <para>
     See also: <function>sybase_fetch_array</function>,
               <function>sybase_fetch_object</function>,
               <function>sybase_data_seek</function>,
               <function>sybase_fetch_lengths</function>, and
               <function>sybase_result</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sybase-field-seek">
   <refnamediv>
    <refname>sybase_field_seek</refname>
    <refpurpose>set field offset</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>sybase_field_seek</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int <parameter>field_offset</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Seeks to the specified field offset.  If the next call to
     <function>sybase_fetch_field</function> won't include a field
     offset, this field would be returned.</para>
    <para></para>
    <para>
     See also: <function>sybase_fetch_field</function>.</para>
   </refsect1>
  </refentry>

  <refentry id="function.sybase-free-result">
   <refnamediv>
    <refname>sybase_free_result</refname>
    <refpurpose>free result memory</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>sybase_free_result</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>sybase_free_result</function> only needs to be called
     if you are worried about using too much memory while your script
     is running. All result memory will automatically be freed when
     the script ends. You may call <function>sybase_free_result</function>
     with the result identifier as an argument and the associated
     result memory will be freed.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sybase-get-last-message">
   <refnamediv>
    <refname>sybase_get_last_message</refname>
    <refpurpose>Returns the last message from the server</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>sybase_get_last_message</function></funcdef>
      <paramdef>void <parameter></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>sybase_get_last_message</function> returns the last
     message reported by the server.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sybase-min-client-severity">
   <refnamediv>
    <refname>sybase_min_client_severity</refname>
    <refpurpose>Sets minimum client severity</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>sybase_min_client_severity</function></funcdef>
      <paramdef>int <parameter>severity</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>sybase_min_client_severity</function> sets the minimum
     client severity level.
     <note>
      <para>
       This function is only available using the CT library interface
       to Sybase, and not the DB library.
      </para>
     </note>
    </para>
    <para> 
      See also: <function>sybase_min_server_severity</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sybase-min-error-severity">
   <refnamediv>
    <refname>sybase_min_error_severity</refname>
    <refpurpose>Sets minimum error severity</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>sybase_min_error_severity</function></funcdef>
      <paramdef>int <parameter>severity</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>sybase_min_error_severity</function> sets the minimum
     error severity level.
    </para>
    <para> 
      See also: <function>sybase_min_message_severity</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sybase-min-message-severity">
   <refnamediv>
    <refname>sybase_min_message_severity</refname>
    <refpurpose>Sets minimum message severity</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>sybase_min_message_severity</function></funcdef>
      <paramdef>int <parameter>severity</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>sybase_min_message_severity</function> sets the minimum
     message severity level.
    </para>
    <para> 
      See also: <function>sybase_min_error_severity</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sybase-min-server-severity">
   <refnamediv>
    <refname>sybase_min_server_severity</refname>
    <refpurpose>Sets minimum server severity</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>sybase_min_server_severity</function></funcdef>
      <paramdef>int <parameter>severity</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     <function>sybase_min_server_severity</function> sets the minimum
     server severity level.
     <note>
      <para>
       This function is only available using the CT library interface
       to Sybase, and not the DB library.
      </para>
     </note>
    </para>
    <para> 
      See also: <function>sybase_min_client_severity</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sybase-num-fields">
   <refnamediv>
    <refname>sybase_num_fields</refname>
    <refpurpose>get number of fields in result</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>sybase_num_fields</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> sybase_num_fields() returns the number of fields in a result
    set.
    </para>
    <para> 
     See also:  
     <function>sybase_db_query</function>, 
     <function>sybase_query</function>, 
     <function>sybase_fetch_field</function>, 
     <function>sybase_num_rows</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sybase-num-rows">
   <refnamediv>
    <refname>sybase_num_rows</refname>
    <refpurpose>get number of rows in result</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>sybase_num_rows</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     sybase_num_rows() returns the number of rows in a result set.
    </para>
    <para>
     See also:  
     <function>sybase_db_query</function>, 
     <function>sybase_query</function> and, 
     <function>sybase_fetch_row</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sybase-pconnect">
   <refnamediv>
    <refname>sybase_pconnect</refname>
    <refpurpose>open persistent Sybase connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>sybase_pconnect</function></funcdef>
      <paramdef>string <parameter>servername</parameter></paramdef>
      <paramdef>string <parameter>username</parameter></paramdef>
      <paramdef>string <parameter>password</parameter></paramdef>
      <paramdef>string <parameter><optional>charset</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Returns: A positive Sybase persistent link identifier on success,
     or false on error</para>
    <para>
     sybase_pconnect() acts very much like
     <function>sybase_connect</function> with two major differences.</para>
    <para> 
     First, when connecting, the function would first try to find a
     (persistent) link that's already open with the same host,
     username and password.  If one is found, an identifier for it
     will be returned instead of opening a new connection.</para>
    <para> 
     Second, the connection to the SQL server will not be closed when
     the execution of the script ends.  Instead, the link will remain
     open for future use (<function>sybase_close</function> will not
     close links established by <function>sybase_pconnect()</function>).
    </para>
    <para> 
     This type of links is therefore called 'persistent'.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sybase-query">
   <refnamediv>
    <refname>sybase_query</refname>
    <refpurpose>send Sybase query</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>sybase_query</function></funcdef>
      <paramdef>string <parameter>query</parameter></paramdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> Returns: A positive Sybase result identifier on success, or
    false on error.
    </para>
    <para> sybase_query() sends a query to the currently active
    database on the server that's associated with the specified link
    identifier.  If the link identifier isn't specified, the last
    opened link is assumed.  If no link is open, the function tries to
    establish a link as if <function>sybase_connect</function> was
    called, and use it.
    </para>
    <para>
     See also:  
     <function>sybase_db_query</function>, 
     <function>sybase_select_db</function>, and 
     <function>sybase_connect</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sybase-result">
   <refnamediv>
    <refname>sybase_result</refname>
    <refpurpose>get result data</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>sybase_result</function></funcdef>
      <paramdef>int <parameter>result</parameter></paramdef>
      <paramdef>int <parameter>row</parameter></paramdef>
      <paramdef>mixed <parameter>field</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> Returns: The contents of the cell at the row and offset in
    the specified Sybase result set.
    </para>
    <para>
     sybase_result() returns the contents of one cell from a Sybase
     result set.  The field argument can be the field's offset, or the
     field's name, or the field's table dot field's name
     (tablename.fieldname).  If the column name has been aliased
     ('select foo as bar from...'), use the alias instead of the
     column name.
    </para>
    <para>
     When working on large result sets, you should consider using one
     of the functions that fetch an entire row (specified below).  As
     these functions return the contents of multiple cells in one
     function call, they're MUCH quicker than sybase_result().  Also,
     note that specifying a numeric offset for the field argument is
     much quicker than specifying a fieldname or tablename.fieldname
     argument.
    </para>
    <para>
     Recommended high-performance alternatives:
     <function>sybase_fetch_row</function>, 
     <function>sybase_fetch_array</function>, and
     <function>sybase_fetch_object</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.sybase-select-db">
   <refnamediv>
    <refname>sybase_select_db</refname>
    <refpurpose>select Sybase database</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>sybase_select_db</function></funcdef>
      <paramdef>string <parameter>database_name</parameter></paramdef>
      <paramdef>int <parameter>link_identifier</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> Returns: true on success, false on error
    </para>
    <para> sybase_select_db() sets the current active database on the
    server that's associated with the specified link identifier.  If
    no link identifier is specified, the last opened link is assumed.
    If no link is open, the function will try to establish a link as
    if <function>sybase_connect</function> was called, and use it.
    </para>
    <para>
     Every subsequent call to <function>sybase_query</function> will be
     made on the active database.
    </para>
    <para> See also:
     <function>sybase_connect</function>, 
     <function>sybase_pconnect</function>, and
     <function>sybase_query</function>
    </para>
   </refsect1>
  </refentry>

</reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/uodbc.xml
+++ phpdoc/kr/functions/uodbc.xml
 <reference id="ref.odbc">
  <title>Unified ODBC functions</title>
  <titleabbrev>ODBC</titleabbrev>
  <partintro>
   <simpara>
    In addition to normal ODBC support, the Unified ODBC functions in
    PHP allow you to access several databases that have borrowed the
    semantics of the ODBC API to implement their own API.  Instead of
    maintaining multiple database drivers that were all nearly
    identical, these drivers have been unified into a single set of
    ODBC functions.
   </simpara>
   <simpara>
    The following databases are supported by the Unified ODBC
    functions: <ulink url="&url.adabas;">Adabas D</ulink>, <ulink
    url="&url.ibmdb2;">IBM DB2</ulink>, <ulink
    url="&url.iodbc;">iODBC</ulink>, <ulink
    url="&url.solid;">Solid</ulink>, and <ulink
    url="&url.sybase;">Sybase SQL Anywhere</ulink>.
   </simpara>
   <simpara>
    Please see the <link
    linkend="database-support-options">Installation on Unix
    Systems</link> chapter for more information about configuring PHP
    with these databases.
   </simpara>
   <note>
    <simpara>
     There is no ODBC involved when connecting to the above
     databases. The functions that you use to speak natively to them
     just happen to share the same names and syntax as the ODBC
     functions.
    </simpara>
   </note>
  </partintro>

  <refentry id="function.odbc-autocommit">
   <refnamediv>
    <refname>odbc_autocommit</refname>
    <refpurpose>Toggle autocommit behaviour</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_autocommit</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
      <paramdef>int <parameter><optional>OnOff</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Without the <parameter>OnOff</parameter> parameter, this function
     returns auto-commit status for
     <parameter>connection_id</parameter>.  True is returned if
     auto-commit is on, false if it is off or an error occurs.
    </para>
    <para>
     If <parameter>OnOff</parameter> is true, auto-commit is enabled,
     if it is false auto-commit is disabled.  Returns
     <literal>true</literal> on success, <literal>false</literal> on
     failure.
    </para>
    <para>
     By default, auto-commit is on for a connection.  Disabling
     auto-commit is equivalent with starting a transaction.
    </para>
    <simpara>
     See also
     <function>odbc_commit</function> and
     <function>odbc_rollback</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-binmode">
   <refnamediv>
    <refname>odbc_binmode</refname>
   <refpurpose>Handling of binary column data</refpurpose>
  </refnamediv>
  <refsect1>
   <title>Description</title>
   <funcsynopsis>
     <funcprototype>
     <funcdef>int <function>odbc_binmode</function></funcdef>
     <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter>mode</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     (ODBC SQL types affected: BINARY, VARBINARY, LONGVARBINARY)
    </para>
    <itemizedlist>
      <listitem>
      <simpara>
       ODBC_BINMODE_PASSTHRU: Passthru BINARY data
      </simpara>
     </listitem> 
     <listitem>
      <simpara>
       ODBC_BINMODE_RETURN: Return as is
      </simpara>
     </listitem>
     <listitem>
      <simpara>
       ODBC_BINMODE_CONVERT: Convert to char and return
      </simpara>
     </listitem>
    </itemizedlist>
    <para>
     When binary SQL data is converted to character C data, each byte
     (8 bits) of source data is represented as two ASCII characters.
     These characters are the ASCII character representation of the
     number in its hexadecimal form. For example, a binary 00000001 is
     converted to <literal>"01"</literal> and a binary 11111111 is
     converted to <literal>"FF"</literal>.
     <table>
      <title>LONGVARBINARY handling</title>
      <tgroup cols="3">
       <thead>
        <row>
         <entry>binmode</entry>
         <entry>longreadlen</entry>
         <entry>result</entry>
        </row>
       </thead>
       <tbody>
        <row>
         <entry>ODBC_BINMODE_PASSTHRU</entry>
         <entry>0</entry>
         <entry>passthru</entry>
        </row>
        <row>
         <entry>ODBC_BINMODE_RETURN</entry>
         <entry>0</entry>
         <entry>passthru</entry>
        </row>
        <row>
         <entry>ODBC_BINMODE_CONVERT</entry>
         <entry>0</entry>
         <entry>passthru</entry>
        </row>
        <row>
         <entry>ODBC_BINMODE_PASSTHRU</entry>
         <entry>0</entry>
         <entry>passthru</entry>
        </row>
        <row>
         <entry>ODBC_BINMODE_PASSTHRU</entry>
         <entry>>0</entry>
         <entry>passthru</entry>
        </row>
        <row>
         <entry>ODBC_BINMODE_RETURN</entry>
         <entry>>0</entry>
         <entry>return as is</entry>
        </row>
        <row>
         <entry>ODBC_BINMODE_CONVERT</entry>
         <entry>>0</entry>
         <entry>return as char</entry>
        </row>
       </tbody>
      </tgroup>
     </table>
    </para>
    <para>
     If <function>odbc_fetch_into</function> is used, passthru means
     that an empty string is returned for these columns.
    </para>
    <para>
     If <parameter>result_id</parameter> is <literal>0</literal>, the
     settings apply as default for new results.
     <note>
      <simpara> 
       Default for longreadlen is <literal>4096</literal> and binmode
       defaults to <literal>ODBC_BINMODE_RETURN</literal>.  Handling
       of binary long columns is also affected by
       <function>odbc_longreadlen</function>
      </simpara>
     </note>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.odbc-close">
   <refnamediv>
    <refname>odbc_close</refname>
    <refpurpose>Close an ODBC connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>odbc_close</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>odbc_close</function> will close down the connection to
     the database server associated with the given connection
     identifier.
     <note>
      <simpara>
       This function will fail if there are open transactions on this
       connection.  The connection will remain open in this case.
      </simpara>
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-close-all">
   <refnamediv>
    <refname>odbc_close_all</refname>
    <refpurpose>Close all ODBC connections</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>odbc_close_all</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>odbc_close_all</function> will close down all
     connections to database server(s).
     <note>
      <simpara>
       This function will fail if there are open transactions on a
       connection. This connection will remain open in this case.
      </simpara>
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-commit">
   <refnamediv>
    <refname>odbc_commit</refname>
    <refpurpose>Commit an ODBC transaction</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_commit</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns: <literal>true</literal> on success,
     <literal>false</literal> on failure.  All pending transactions on
     <parameter>connection_id</parameter> are committed.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-connect">
   <refnamediv>
    <refname>odbc_connect</refname>
    <refpurpose>Connect to a datasource</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_connect</function></funcdef>
      <paramdef>string <parameter>dsn</parameter></paramdef>
      <paramdef>string <parameter>user</parameter></paramdef>
      <paramdef>string <parameter>password</parameter></paramdef>
      <paramdef>int <parameter><optional>cursor_type</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an ODBC connection id or 0 (<literal>false</literal>) on
     error.
    </para>
    <simpara>
     The connection id returned by this functions is needed by other
     ODBC functions. You can have multiple connections open at once.
     The optional fourth parameter sets the type of cursor to be used
     for this connection. This parameter is not normally needed, but
     can be useful for working around problems with some ODBC drivers.
    </simpara>
    <simpara>
     With some ODBC drivers, executing a complex stored procedure may
     fail with an error similar to: "Cannot open a cursor on a stored
     procedure that has anything other than a single select statement
     in it".  Using SQL_CUR_USE_ODBC may avoid that error. Also, some
     drivers don't support the optional row_number parameter in
     <function>odbc_fetch_row</function>. SQL_CUR_USE_ODBC might help
     in that case, too.
    </simpara>
    <simpara>
     The following constants are defined for cursortype:
    </simpara>
    <para>
     <itemizedlist>
      <listitem>
       <simpara>
        SQL_CUR_USE_IF_NEEDED
       </simpara>
      </listitem> 
      <listitem>
       <simpara>
        SQL_CUR_USE_ODBC
       </simpara>
      </listitem> 
      <listitem>
       <simpara>
        SQL_CUR_USE_DRIVER
       </simpara>
      </listitem> 
      <listitem>
       <simpara>
        SQL_CUR_DEFAULT
       </simpara></listitem> 
     </itemizedlist>
    </para>
    <simpara>
     For persistent connections see
     <function>odbc_pconnect</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-cursor">
   <refnamediv>
    <refname>odbc_cursor</refname>
    <refpurpose>Get cursorname</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>odbc_cursor</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     odbc_cursor will return a cursorname for the given result_id.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-do">
   <refnamediv>
    <refname>odbc_do</refname>
    <refpurpose>Synonym for <function>odbc_exec</function></refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_do</function></funcdef>
      <paramdef>int <parameter>conn_id</parameter></paramdef>
      <paramdef>string <parameter>query</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Odbc_do</function> will execute a query on the given
     connection.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-exec">
   <refnamediv>
    <refname>odbc_exec</refname>
    <refpurpose>Prepare and execute a SQL statement</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_exec</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
      <paramdef>string <parameter>query_string</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns <literal>false</literal> on error.  Returns an ODBC
     result identifier if the SQL command was executed successfully.
    </para>
    <para>
     <function>odbc_exec</function> will send an SQL statement to the
     database server specified by
     <parameter>connection_id</parameter>.  This parameter must be a
     valid identifier returned by <function>odbc_connect</function> or
     <function>odbc_pconnect</function>.
    </para>
    <simpara> 
     See also: <function>odbc_prepare</function> and
     <function>odbc_execute</function> for multiple execution of SQL
     statements.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-execute">
   <refnamediv>
    <refname>odbc_execute</refname>
    <refpurpose>Execute a prepared statement</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_execute</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>array
       <parameter><optional>parameters_array</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Executes a statement prepared with
     <function>odbc_prepare</function>.  Returns
     <literal>true</literal> on successful execution,
     <literal>false</literal> otherwise. The array 
     <parameter>arameters_array</parameter> only needs to
     be given if you really have parameters in your statement.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-fetch-into">
   <refnamediv>
    <refname>odbc_fetch_into</refname>
    <refpurpose>Fetch one result row into array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_fetch_into</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter><optional>rownumber</optional></parameter></paramdef>
      <paramdef>array <parameter>result_array</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the number of columns in the result;
     <literal>false</literal> on error.
     <parameter>result_array</parameter> must be passed by reference,
     but it can be of any type since it will be converted to type
     array. The array will contain the column values starting at array
     index 0.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-fetch-row">
   <refnamediv>
    <refname>odbc_fetch_row</refname>
    <refpurpose>Fetch a row</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_fetch_row</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter><optional>row_number</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     If <function>odbc_fetch_row</function> was succesful (there was a
     row), <literal>true</literal> is returned.  If there are no more
     rows, <literal>false</literal> is returned.
    </para>
    <para>
     <function>odbc_fetch_row</function> fetches a row of the data
     that was returned by <function>odbc_do</function> /
     <function>odbc_exec</function>.  After
     <function>odbc_fetch_row</function> is called, the fields of that
     row can be accessed with <function>odbc_result</function>.
    </para>
    <para>
     If <parameter>row_number</parameter> is not specified,
     <function>odbc_fetch_row</function> will try to fetch the next
     row in the result set. Calls to
     <function>odbc_fetch_row</function> with and without
     <parameter>row_number</parameter> can be mixed.
    </para> 
    <para>
     To step through the result more than once, you can call
     <function>odbc_fetch_row</function> with
     <parameter>row_number</parameter> 1, and then continue doing
     <function>odbc_fetch_row</function> without
     <parameter>row_number</parameter> to review the result.  If a
     driver doesn't support fetching rows by number, the
     <parameter>row_number</parameter> parameter is ignored.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-field-name">
   <refnamediv>
    <refname>odbc_field_name</refname>
    <refpurpose>Get the columnname</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>odbc_field_name</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter>field_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>odbc_field_name</function> will return the name of the
     field occupying the given column number in the given ODBC result
     identifier.  Field numbering starts at 1.
     <literal>false</literal> is returned on error.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-field-num">
   <refnamediv>
    <refname>odbc_field_num</refname>
    <refpurpose>Return column number</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_field_num</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>string <parameter>field_name</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>odbc_field_num</function> will return the number of the
     column slot that corresponds to the named field in the given ODBC
     result identifier.  Field numbering starts at 1.
     <literal>false</literal> is returned on error.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-field-type">
   <refnamediv>
    <refname>odbc_field_type</refname>
    <refpurpose>Datatype of a field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>odbc_field_type</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter>field_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>odbc_field_type</function> will return the SQL type of
     the field referecend by number in the given ODBC result
     identifier.  Field numbering starts at 1.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-field-len">
   <refnamediv>
    <refname>odbc_field_len</refname>
    <refpurpose>Get the length (precision) of a field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_field_len</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter>field_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>odbc_field_len</function> will return the length of
     the field referecend by number in the given ODBC result
     identifier.  Field numbering starts at 1.
    </para>
    <simpara>
     See also: <function>odbc_field_scale</function> to get the scale of a
     floating point number.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-field-precision">
   <refnamediv>
    <refname>odbc_field_precision</refname>
    <refpurpose>Synonym for <function>odbc_field_len</function></refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>odbc_field_precision</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter>field_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>odbc_field_precision</function> will return the precision
     of the field referecend by number in the given ODBC result
     identifier.
    </para>
    <para>
     See also: <function>odbc_field_scale</function> to get the scale of a 
     floating point number.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-field-scale">
   <refnamediv>
    <refname>odbc_field_scale</refname>
    <refpurpose>Get the scale of a field</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>odbc_field_scale</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter>field_number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>odbc_field_precision</function> will return the scale
     of the field referecend by number in the given ODBC result
     identifier.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-free-result">
   <refnamediv>
    <refname>odbc_free_result</refname>
    <refpurpose>Free resources associated with a result</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_free_result</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Always returns <literal>true</literal>.
    </para>
    <para>
     <function>odbc_free_result</function> only needs to be called if
     you are worried about using too much memory while your script is
     running.  All result memory will automatically be freed when the
     script is finished.  But, if you are sure you are not going to
     need the result data anymore in a script, you may call
     <function>odbc_free_result</function>, and the memory associated
     with <parameter>result_id</parameter> will be freed.
    </para>
    <para>
     <note>
      <simpara>
       If auto-commit is disabled (see
       <function>odbc_autocommit</function>) and you call
       <function>odbc_free_result</function> before commiting, all
       pending transactions are rolled back.
      </simpara>
     </note>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-longreadlen">
   <refnamediv>
    <refname>odbc_longreadlen</refname>
   <refpurpose>Handling of LONG columns</refpurpose>
  </refnamediv>
  <refsect1>
   <title>Description</title>
   <funcsynopsis>
     <funcprototype>
     <funcdef>int <function>odbc_longreadlen</function></funcdef>
     <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>int <parameter>length</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     (ODBC SQL types affected: LONG, LONGVARBINARY) The number of
     bytes returned to PHP is controled by the parameter length. If it
     is set to 0, Long column data is passed thru to the
     client.
    </para> 
    <note>
     <simpara> 
      Handling of LONGVARBINARY columns is also affected by
      <function>odbc_binmode</function>.
     </simpara>
    </note>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-num-fields">
   <refnamediv>
    <refname>odbc_num_fields</refname>
    <refpurpose>Number of columns in a result</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_num_fields</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Odbc_num_fields</function> will return the number of
     fields (columns) in an ODBC result.  This function will return -1
     on error.  The argument is a valid result identifier returned by
     <function>odbc_exec</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-pconnect">
   <refnamediv>
    <refname>odbc_pconnect</refname>
    <refpurpose>Open a persistent database connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_pconnect</function></funcdef>
      <paramdef>string <parameter>dsn</parameter></paramdef>
      <paramdef>string <parameter>user</parameter></paramdef>
      <paramdef>string <parameter>password</parameter></paramdef>
      <paramdef>int <parameter><optional>cursor_type</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns an ODBC connection id or 0 (<literal>false</literal>) on
     error.  This function is much like
     <function>odbc_connect</function>, except that the connection is
     not really closed when the script has finished.  Future requests
     for a connection with the same <parameter>dsn</parameter>,
     <parameter>user</parameter>, <parameter>password</parameter>
     combination (via <function>odbc_connect</function> and
     <function>odbc_pconnect</function>) can reuse the persistent
     connection.
    </para>
    <para>
     <note>
      <simpara>
       Persistent connections have no effect if PHP is used as a CGI
       program.
      </simpara>
     </note>
    </para>
    <para>
     For information about the optional cursor_type parameter see the
     <function>odbc_connect</function> function.  For more information
     on persistent connections, refer to the PHP FAQ.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-prepare">
   <refnamediv>
    <refname>odbc_prepare</refname>
    <refpurpose>Prepares a statement for execution</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_prepare</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
      <paramdef>string <parameter>query_string</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns <literal>false</literal> on error.
    </para>
    <para>
     Returns an ODBC result identifier if the SQL command was prepared
     successfully.  The result identifier can be used later to execute
     the statement with <function>odbc_execute</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-num-rows">
   <refnamediv>
    <refname>odbc_num_rows</refname>
    <refpurpose>Number of rows in a result</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_num_rows</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>odbc_num_rows</function> will return the number of rows
     in an ODBC result.  This function will return -1 on error.  For
     INSERT, UPDATE and DELETE statements
     <function>odbc_num_rows</function> returns the number of rows
     affected.  For a SELECT clause this <literal>can</literal> be 
     the number of rows available.
    </para>
    <para>
     Note: Using <function>odbc_num_rows</function> to determine the
     number of rows available after a SELECT will return -1 with many
     drivers.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-result">
   <refnamediv>
    <refname>odbc_result</refname>
    <refpurpose>Get result data</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>odbc_result</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>mixed <parameter>field</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the contents of the field.
    </para>
    <para>
     <parameter>field</parameter> can either be an integer containing
     the column number of the field you want; or it can be a string
     containing the name of the field. For example:
     <informalexample><programlisting>
$item_3 = odbc_result ($Query_ID, 3);
$item_val = odbc_result ($Query_ID, "val");
      </programlisting>
     </informalexample>
    </para>
    <para>
     The first call to <function>odbc_result</function> returns the
     value of the third field in the current record of the query
     result. The second function call to
     <function>odbc_result</function> returns the value of the field
     whose field name is "val" in the current record of the query
     result. An error occurs if a column number parameter for a field
     is less than one or exceeds the number of columns (or fields) in
     the current record. Similarly, an error occurs if a field with a
     name that is not one of the fieldnames of the table(s) that
     is(are) being queried.
    </para>
    <para>
     Field indices start from 1. Regarding the way binary or
     long column data is returned refer to <function>odbc_binmode
     </function> and <function>odbc_longreadlen</function>.

<!--

If the requested field contains
     binary data or is of datatype LONG, 
longer than 4096 bytes, the contents is not
     returned, instead it is sent directly to the client. Hint: If you
     need to have binary data returned, use the SQL function HEX() to
     retrieve the field in hexadecimal notation.  E.g. "SELECT
     HEX(binary_col) FROM mytable"
-->

    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-result-all">
   <refnamediv>
    <refname>odbc_result_all</refname>
    <refpurpose>Print result as HTML table</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_result_all</function></funcdef>
      <paramdef>int <parameter>result_id</parameter></paramdef>
      <paramdef>string <parameter><optional>format</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the number of rows in the result or
     <literal>false</literal> on error.
    </para>
    <para>
     <function>Odbc_result_all</function> will print all rows from a
     result identifier produced by <function>odbc_exec</function>. The
     result is printed in HTML table format.  With the optional string
     argument <parameter>format</parameter>, additional overall table
     formatting can be done.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-rollback">
   <refnamediv>
    <refname>odbc_rollback</refname>
    <refpurpose>Rollback a transaction</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_rollback</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Rolls back all pending statements on
     <parameter>connection_id</parameter>.  Returns
     <literal>true</literal> on success, <literal>false</literal> on
     failure.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-setoption">
   <refnamediv>
    <refname>odbc_setoption</refname> 
    <refpurpose>
     Adjust ODBC settings. Returns false if an error occurs, otherwise
     true.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_setoption</function></funcdef>
      <paramdef>int <parameter>id</parameter></paramdef>
      <paramdef>int <parameter>function</parameter></paramdef>
      <paramdef>int <parameter>option</parameter></paramdef>
      <paramdef>int <parameter>param</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function allows fiddling with the ODBC options for a
     particular connection or query result.  It was written to help
     find work arounds to problems in quirky ODBC drivers.  You should
     probably only use this function if you are an ODBC programmer and
     understand the effects the various options will have.  You will
     certainly need a good ODBC reference to explain all the different
     options and values that can be used.  Different driver versions
     support different options.
    </para>
    <para>
     Because the effects may vary depending on the ODBC driver, use of
     this function in scripts to be made publicly available is
     strongly discouraged.  Also, some ODBC options are not available
     to this function because they must be set before the connection
     is established or the query is prepared.  However, if on a
     particular job it can make PHP work so your boss doesn't tell you
     to use a commercial product, that's all that really
     matters.
    </para>
    <para>
     <parameter>ID</parameter> is a connection id or result id on
     which to change the settings.For SQLSetConnectOption(), this is a
     connection id. For SQLSetStmtOption(), this is a result
     id.
    </para>
    <para>
     <parameter>Function</parameter> is the ODBC function to use. The
     value should be 1 for SQLSetConnectOption() and 2 for
     SQLSetStmtOption().
    </para>
    <para>
     Parameter <parameter>option</parameter> is the option to set.</para>
    <para>
     Parameter <parameter>param</parameter> is the value for the
     given <parameter>option</parameter>.
     <example>
      <title>ODBC Setoption Examples</title>
      <programlisting role="php">
// 1. Option 102 of SQLSetConnectOption() is SQL_AUTOCOMMIT.
//    Value 1 of SQL_AUTOCOMMIT is SQL_AUTOCOMMIT_ON.
//    This example has the same effect as
//    odbc_autocommit($conn, true);

odbc_setoption ($conn, 1, 102, 1);

// 2. Option 0 of SQLSetStmtOption() is SQL_QUERY_TIMEOUT.
//    This example sets the query to timeout after 30 seconds.

$result = odbc_prepare ($conn, $sql);
odbc_setoption ($result, 2, 0, 30);
odbc_execute ($result);
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.odbc-tables">
   <refnamediv>
    <refname>odbc_tables</refname>
    <refpurpose>
     Get the list of table names stored in a specific data source.
     Returns a result identifier containing the
     information.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_tables</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
      <paramdef>string <parameter><optional>qualifier</optional></parameter></paramdef>
      <paramdef>string <parameter><optional>owner</optional></parameter></paramdef> 
      <paramdef>string <parameter><optional>name</optional></parameter></paramdef> 
      <paramdef>string <parameter><optional>types</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Lists all tables in the requested range.  Returns an ODBC result
     identifier or <literal>false</literal> on failure.
    </para>
    <para>
     The result set has the following columns:
     <itemizedlist>
      <listitem><simpara>TABLE_QUALIFIER</simpara></listitem>
      <listitem><simpara>TABLE_OWNER</simpara></listitem> 
      <listitem><simpara>TABLE_NAME</simpara></listitem>
      <listitem><simpara>TABLE_TYPE</simpara></listitem>
      <listitem><simpara>REMARKS</simpara></listitem>
     </itemizedlist> 
    </para>
    <simpara>
     The result set is ordered by TABLE_TYPE, TABLE_QUALIFIER,
     TABLE_OWNER and TABLE_NAME.
    </simpara>
    <para>
     The <parameter>owner</parameter> and <parameter>name</parameter>
     arguments accept search patterns ('%' to match zero or more
     characters and '_' to match a single character).
    </para>
    <para>
     To support enumeration of qualifiers, owners, and table types,
     the following special semantics for the
     <parameter>qualifier</parameter>, <parameter>owner</parameter>,
     <parameter>name</parameter>, and
     <parameter>table_type</parameter> are available:
     <itemizedlist>
      <listitem>
       <simpara>
        If <parameter>qualifier</parameter> is a single percent
        character (%) and <parameter>owner</parameter> and
        <parameter>name</parameter> are empty strings, then the result
        set contains a list of valid qualifiers for the data
        source. (All columns except the TABLE_QUALIFIER column contain
        NULLs.)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        If <parameter>owner</parameter> is a single percent character
        (%) and <parameter>qualifier</parameter> and
        <parameter>name</parameter> are empty strings, then the result
        set contains a list of valid owners for the data source. (All
        columns except the TABLE_OWNER column contain
        NULLs.)
       </simpara>
      </listitem>
      <listitem>
       <simpara>
        If <parameter>table_type</parameter> is a single percent
        character (%) and <parameter>qualifier</parameter>,
        <parameter>owner</parameter> and <parameter>name</parameter>
        are empty strings, then the result set contains a list of
        valid table types for the data source. (All columns except the
        TABLE_TYPE column contain NULLs.)
       </simpara>
      </listitem>
     </itemizedlist> 
    </para>
    <para>
     If <parameter>table_type</parameter> is not an empty string, it
     must contain a list of comma-separated values for the types of
     interest; each value may be enclosed in single quotes (') or
     unquoted. For example, "'TABLE','VIEW'" or "TABLE, VIEW".  If the
     data source does not support a specified table type,
     <function>odbc_tables</function> does not return any results for
     that type.
    </para>
    <simpara>
     See also <function>odbc_tableprivileges</function> to retrieve
     associated privileges.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-tableprivileges">
   <refnamediv>
    <refname>odbc_tableprivileges</refname>
    <refpurpose>
     Lists tables and the privileges associated with each table
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_tableprivileges</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
      <paramdef>string <parameter><optional>qualifier</optional></parameter></paramdef>
      <paramdef>string <parameter><optional>owner</optional></parameter></paramdef>
      <paramdef>string <parameter><optional>name</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Lists tables in the requested range and the privileges associated
     with each table.  Returns an ODBC result identifier or
     <literal>false</literal> on failure.
    </para>
    <para>
     The result set has the following columns:
     <itemizedlist>
      <listitem><simpara>TABLE_QUALIFIER</simpara></listitem>
      <listitem><simpara>TABLE_OWNER</simpara></listitem>
      <listitem><simpara>TABLE_NAME</simpara></listitem>
      <listitem><simpara>GRANTOR</simpara></listitem>
      <listitem><simpara>GRANTEE</simpara></listitem>
      <listitem><simpara>PRIVILEGE</simpara></listitem>
      <listitem><simpara>IS_GRANTABLE</simpara></listitem>
     </itemizedlist>
    </para>
    <simpara>
     The result set is ordered by TABLE_QUALIFIER, TABLE_OWNER and
     TABLE_NAME.
    </simpara>
    <para>
     The <parameter>owner</parameter> and <parameter>name</parameter>
     arguments accept search patterns ('%' to match zero or more
     characters and '_' to match a single character).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-columns">
   <refnamediv>
    <refname>odbc_columns</refname>
    <refpurpose>
     Lists the column names in specified tables. Returns a result
     identifier containing the information.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_columns</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
      <paramdef>string <parameter><optional>qualifier</optional></parameter></paramdef>
      <paramdef>string <parameter><optional>owner</optional></parameter></paramdef>
      <paramdef>string 
<parameter><optional>table_name</optional></parameter></paramdef>
      <paramdef>string 
<parameter><optional>column_name</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Lists all columns in the requested range.  Returns an ODBC result
     identifier or <literal>false</literal> on failure.
    </para>
    <para>
     The result set has the following columns:
     <itemizedlist>
      <listitem><simpara>TABLE_QUALIFIER</simpara></listitem>
      <listitem><simpara>TABLE_OWNER</simpara></listitem>
      <listitem><simpara>TABLE_NAME</simpara></listitem>
      <listitem><simpara>COLUMN_NAME</simpara></listitem>
      <listitem><simpara>DATA_TYPE</simpara></listitem>
      <listitem><simpara>TYPE_NAME</simpara></listitem>
      <listitem><simpara>PRECISION</simpara></listitem>
      <listitem><simpara>LENGTH</simpara></listitem>
      <listitem><simpara>SCALE</simpara></listitem>
      <listitem><simpara>RADIX</simpara></listitem>
      <listitem><simpara>NULLABLE</simpara></listitem>
      <listitem><simpara>REMARKS</simpara></listitem>
     </itemizedlist>
    </para>
    <simpara>
     The result set is ordered by TABLE_QUALIFIER, TABLE_OWNER and
     TABLE_NAME.
    </simpara>
    <para>
     The <parameter>owner</parameter>,
     <parameter>table_name</parameter> and
     <parameter>column_name</parameter> arguments accept search
     patterns ('%' to match zero or more characters and '_' to match a
     single character).
    </para>
    <simpara>
     See also <function>odbc_columnprivileges</function> to retrieve
     associated privileges.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-columnprivileges">
   <refnamediv>
    <refname>odbc_columnprivileges</refname>
    <refpurpose>
     Returns a result identifier that can be used to fetch a list of
     columns and associated privileges
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_columnprivileges</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
      <paramdef>string <parameter><optional>qualifier</optional></parameter></paramdef>
      <paramdef>string <parameter><optional>owner</optional></parameter></paramdef>
      <paramdef>string 
<parameter><optional>table_name</optional></parameter></paramdef>
      <paramdef>string 
<parameter><optional>column_name</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Lists columns and associated privileges for the given table.
     Returns an ODBC result identifier or <literal>false</literal> on
     failure.
    </para>
    <para>
     The result set has the following columns:
     <itemizedlist>
      <listitem><simpara>TABLE_QUALIFIER</simpara></listitem>
      <listitem><simpara>TABLE_OWNER</simpara></listitem>
      <listitem><simpara>TABLE_NAME</simpara></listitem>
      <listitem><simpara>GRANTOR</simpara></listitem>
      <listitem><simpara>GRANTEE</simpara></listitem>
      <listitem><simpara>PRIVILEGE</simpara></listitem>
      <listitem><simpara>IS_GRANTABLE</simpara></listitem>
     </itemizedlist>
    </para>
    <simpara>
     The result set is ordered by TABLE_QUALIFIER, TABLE_OWNER and
     TABLE_NAME.
    </simpara>
    <para>
     The <parameter>column_name</parameter> argument accepts search
     patterns ('%' to match zero or more characters and '_' to match a
     single character).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-gettypeinfo">
   <refnamediv>
    <refname>odbc_gettypeinfo</refname>
    <refpurpose>
     Returns a result identifier containing information about data
     types supported by the data source.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_gettypeinfo</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
      <paramdef>int <parameter><optional>data_type</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Retrieves information about data types supported by the data
     source.  Returns an ODBC result identifier or
     <literal>false</literal> on failure.  The optional argument
     <parameter>data_type</parameter> can be used to restrict the
     information to a single data type.
    </para>
    <para>
     The result set has the following columns:
     <itemizedlist>
      <listitem><simpara>TYPE_NAME</simpara></listitem>
      <listitem><simpara>DATA_TYPE</simpara></listitem>
      <listitem><simpara>PRECISION</simpara></listitem>
      <listitem><simpara>LITERAL_PREFIX</simpara></listitem>
      <listitem><simpara>LITERAL_SUFFIX</simpara></listitem>
      <listitem><simpara>CREATE_PARAMS</simpara></listitem>
      <listitem><simpara>NULLABLE</simpara></listitem>
      <listitem><simpara>CASE_SENSITIVE</simpara></listitem>
      <listitem><simpara>SEARCHABLE</simpara></listitem>
      <listitem><simpara>UNSIGNED_ATTRIBUTE</simpara></listitem>
      <listitem><simpara>MONEY</simpara></listitem>
      <listitem><simpara>AUTO_INCREMENT</simpara></listitem>
      <listitem><simpara>LOCAL_TYPE_NAME</simpara></listitem>
      <listitem><simpara>MINIMUM_SCALE</simpara></listitem>
      <listitem><simpara>MAXIMUM_SCALE</simpara></listitem>
     </itemizedlist>
    </para>
    <simpara>The result set is ordered by DATA_TYPE and TYPE_NAME.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-primarykeys">
   <refnamediv>
    <refname>odbc_primarykeys</refname>
    <refpurpose>
     Returns a result identifier that can be used to fetch the column
     names that comprise the primary key for a table
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_primarykeys</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
      <paramdef>string <parameter>qualifier</parameter></paramdef>
      <paramdef>string <parameter>owner</parameter></paramdef>
      <paramdef>string <parameter>table</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the column names that comprise the primary key for a
     table.  Returns an ODBC result identifier or
     <literal>false</literal> on failure.
    </para>
    <para>
     The result set has the following columns:
     <itemizedlist>
      <listitem><simpara>TABLE_QUALIFIER</simpara></listitem>
      <listitem><simpara>TABLE_OWNER</simpara></listitem>
      <listitem><simpara>TABLE_NAME</simpara></listitem>
      <listitem><simpara>COLUMN_NAME</simpara></listitem>
      <listitem><simpara>KEY_SEQ</simpara></listitem>
      <listitem><simpara>PK_NAME</simpara></listitem>
     </itemizedlist>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-foreignkeys">
   <refnamediv>
    <refname>odbc_foreignkeys</refname>
    <refpurpose>
     Returns a list of foreign keys in the specified table or a list
     of foreign keys in other tables that refer to the primary key in
     the specified table
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_foreignkeys</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
      <paramdef>string <parameter>pk_qualifier</parameter></paramdef>
      <paramdef>string <parameter>pk_owner</parameter></paramdef>
      <paramdef>string <parameter>pk_table</parameter></paramdef>
      <paramdef>string <parameter>fk_qualifier</parameter></paramdef>
      <paramdef>string <parameter>fk_owner</parameter></paramdef>
      <paramdef>string <parameter>fk_table</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Odbc_foreignkeys</function> retrieves information about
     foreign keys. Returns an ODBC result identifier or
     <literal>false</literal> on failure.
    </para>
    <para>
     The result set has the following columns:
     <itemizedlist>
      <listitem><simpara>PKTABLE_QUALIFIER</simpara></listitem>
      <listitem><simpara>PKTABLE_OWNER</simpara></listitem>
      <listitem><simpara>PKTABLE_NAME</simpara></listitem>
      <listitem><simpara>PKCOLUMN_NAME</simpara></listitem>
      <listitem><simpara>FKTABLE_QUALIFIER</simpara></listitem>
      <listitem><simpara>FKTABLE_OWNER</simpara></listitem>
      <listitem><simpara>FKTABLE_NAME</simpara></listitem>
      <listitem><simpara>FKCOLUMN_NAME</simpara></listitem>
      <listitem><simpara>KEY_SEQ</simpara></listitem>
      <listitem><simpara>UPDATE_RULE</simpara></listitem>
      <listitem><simpara>DELETE_RULE</simpara></listitem>
      <listitem><simpara>FK_NAME</simpara></listitem>
      <listitem><simpara>PK_NAME</simpara></listitem>
     </itemizedlist>
    </para>
    <simpara>
     If <parameter>pk_table</parameter> contains a table name,
     <function>odbc_foreignkeys</function> returns a result set
     containing the primary key of the specified table and all of the
     foreign keys that refer to it.
    </simpara>
    <simpara>
     If <parameter>fk_table</parameter> contains a table name,
     <function>odbc_foreignkeys</function> returns a result set
     containing all of the foreign keys in the specified table and the
     primary keys (in other tables) to which they refer.
    </simpara>
    <simpara>
     If both <parameter>pk_table</parameter> and
     <parameter>fk_table</parameter> contain table names,
     <function>odbc_foreignkeys</function> returns the foreign keys in
     the table specified in <parameter>fk_table</parameter> that refer
     to the primary key of the table specified in
     <parameter>pk_table</parameter>. This should be one key at most.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-procedures">
   <refnamediv>
    <refname>odbc_procedures</refname>
    <refpurpose>
     Get the list of procedures stored in a specific data source.
     Returns a result identifier containing the information.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_procedures</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
      <paramdef>string <parameter><optional>qualifier</optional></parameter></paramdef>
      <paramdef>string <parameter><optional>owner</optional></parameter></paramdef>
      <paramdef>string <parameter><optional>name</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Lists all procedures in the requested range.  Returns an ODBC
     result identifier or <literal>false</literal> on failure.
    </para>
    <para>
     The result set has the following columns:
     <itemizedlist>
      <listitem><simpara>PROCEDURE_QUALIFIER</simpara></listitem>
      <listitem><simpara>PROCEDURE_OWNER</simpara></listitem>
      <listitem><simpara>PROCEDURE_NAME</simpara></listitem>
      <listitem><simpara>NUM_INPUT_PARAMS</simpara></listitem>
      <listitem><simpara>NUM_OUTPUT_PARAMS</simpara></listitem>
      <listitem><simpara>NUM_RESULT_SETS</simpara></listitem>
      <listitem><simpara>REMARKS</simpara></listitem>
      <listitem><simpara>PROCEDURE_TYPE</simpara></listitem>
     </itemizedlist>
    </para>
    <para>
     The <parameter>owner</parameter> and <parameter>name</parameter>
     arguments accept search patterns ('%' to match zero or more
     characters and '_' to match a single character).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-procedurecolumns">
   <refnamediv>
    <refname>odbc_procedurecolumns</refname>
    <refpurpose>
     Retrieve information about parameters to procedures
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_procedurecolumns</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
      <paramdef>string <parameter><optional>qualifier</optional></parameter></paramdef>
      <paramdef>string <parameter><optional>owner</optional></parameter></paramdef>
      <paramdef>string <parameter><optional>proc</optional></parameter></paramdef>
      <paramdef>string <parameter><optional>column</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the list of input and output parameters, as well as the 
     columns that make up the result set for the specified procedures. Returns
     an ODBC result identifier or <literal>false</literal> on failure.
    </para>
    <para>
     The result set has the following columns:
     <itemizedlist>
      <listitem><simpara>PROCEDURE_QUALIFIER</simpara></listitem>
      <listitem><simpara>PROCEDURE_OWNER</simpara></listitem>
      <listitem><simpara>PROCEDURE_NAME</simpara></listitem>
      <listitem><simpara>COLUMN_NAME</simpara></listitem>
      <listitem><simpara>COLUMN_TYPE</simpara></listitem>
      <listitem><simpara>DATA_TYPE</simpara></listitem>
      <listitem><simpara>TYPE_NAME</simpara></listitem>
      <listitem><simpara>PRECISION</simpara></listitem>
      <listitem><simpara>LENGTH</simpara></listitem>
      <listitem><simpara>SCALE</simpara></listitem>
      <listitem><simpara>RADIX</simpara></listitem>
      <listitem><simpara>NULLABLE</simpara></listitem>
      <listitem><simpara>REMARKS</simpara></listitem>
     </itemizedlist>
    </para>
    <simpara>The result set is ordered by PROCEDURE_QUALIFIER, PROCEDURE_OWNER,
     PROCEDURE_NAME and COLUMN_TYPE.
    </simpara>
    <para>
     The <parameter>owner</parameter>, <parameter>proc</parameter> and
     <parameter>column</parameter> arguments accept search patterns
     ('%' to match zero or more characters and '_' to match a single
     character).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-specialcolumns">
   <refnamediv>
    <refname>odbc_specialcolumns</refname>
    <refpurpose>
     Returns either the optimal set of columns that uniquely
     identifies a row in the table or columns that are automatically
     updated when any value in the row is updated by a transaction
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_specialcolumns</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
      <paramdef>int <parameter>type</parameter></paramdef>
      <paramdef>string <parameter>qualifier</parameter></paramdef>
      <paramdef>string <parameter>owner</parameter></paramdef>
      <paramdef>string <parameter>table</parameter></paramdef>
      <paramdef>int <parameter>scope</parameter></paramdef>
      <paramdef>int <parameter>nullable</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     When the type argument is SQL_BEST_ROWID,
     <function>odbc_specialcolumns</function> returns the
     column or columns that uniquely identify each row in the table.
    </simpara>
    <simpara>
     When the type argument is SQL_ROWVER, 
     <function>odbc_specialcolumns</function> returns the
     optimal column or set of columns that, by retrieving values from
     the column or columns, allows any row in the specified table to be
     uniquely identified. 
    </simpara>
    <simpara>
     Returns an ODBC result identifier or <literal>false</literal> on
     failure.
    </simpara>
    <para>
     The result set has the following columns:
     <itemizedlist>
      <listitem><simpara>SCOPE</simpara></listitem>
      <listitem><simpara>COLUMN_NAME</simpara></listitem>
      <listitem><simpara>DATA_TYPE</simpara></listitem>
      <listitem><simpara>TYPE_NAME</simpara></listitem>
      <listitem><simpara>PRECISION</simpara></listitem>
      <listitem><simpara>LENGTH</simpara></listitem>
      <listitem><simpara>SCALE</simpara></listitem>
      <listitem><simpara>PSEUDO_COLUMN</simpara></listitem>
     </itemizedlist>
    </para>
    <simpara>
     The result set is ordered by SCOPE.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.odbc-statistics">
   <refnamediv>
    <refname>odbc_statistics</refname>
    <refpurpose>Retrieve statistics about a table</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>odbc_statistics</function></funcdef>
      <paramdef>int <parameter>connection_id</parameter></paramdef>
      <paramdef>string <parameter>qualifier</parameter></paramdef>
      <paramdef>string <parameter>owner</parameter></paramdef>
      <paramdef>string <parameter>table_name</parameter></paramdef>
      <paramdef>int <parameter>unique</parameter></paramdef>
      <paramdef>int <parameter>accuracy</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Get statistics about a table and it's indexes. Returns an ODBC
     result identifier or <literal>false</literal> on failure.
    </para>
    <para>
     The result set has the following columns:
     <itemizedlist>
      <listitem><simpara>TABLE_QUALIFIER</simpara></listitem>
      <listitem><simpara>TABLE_OWNER</simpara></listitem>
      <listitem><simpara>TABLE_NAME</simpara></listitem>
      <listitem><simpara>NON_UNIQUE</simpara></listitem>
      <listitem><simpara>INDEX_QUALIFIER</simpara></listitem>
      <listitem><simpara>INDEX_NAME</simpara></listitem>
      <listitem><simpara>TYPE</simpara></listitem>
      <listitem><simpara>SEQ_IN_INDEX</simpara></listitem>
      <listitem><simpara>COLUMN_NAME</simpara></listitem>
      <listitem><simpara>COLLATION</simpara></listitem>
      <listitem><simpara>CARDINALITY</simpara></listitem>
      <listitem><simpara>PAGES</simpara></listitem>
      <listitem><simpara>FILTER_CONDITION</simpara></listitem>
     </itemizedlist>
    </para>
    <simpara>
     The result set is ordered by NON_UNIQUE, TYPE, INDEX_QUALIFIER,
     INDEX_NAME and SEQ_IN_INDEX.
    </simpara>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/url.xml
+++ phpdoc/kr/functions/url.xml
 <reference id="ref.url">
  <title>URL Functions</title>
  <titleabbrev>URLs</titleabbrev>

  <refentry id="function.base64-decode">
   <refnamediv>
    <refname>base64_decode</refname>
    <refpurpose>Decodes data encoded with MIME base64</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>base64_decode</function></funcdef>
      <paramdef>string <parameter>encoded_data</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Base64_decode</function> decodes
     <parameter>encoded_data</parameter> and returns the original
     data.  The returned data may be binary.
    </para>
    <para>
     See also: <function>base64_encode</function>, RFC-2045 section
     6.8.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.base64-encode">
   <refnamediv>
    <refname>base64_encode</refname>
    <refpurpose>Encodes data with MIME base64</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>base64_encode</function></funcdef>
      <paramdef>string <parameter>data</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Base64_encode</function> returns
     <parameter>data</parameter> encoded with base64.  This encoding
     is designed to make binary data survive transport through
     transport layers that are not 8-bit clean, such as mail bodies.
    </para>
    <para>
     Base64-encoded data takes about 33% more space than the original
     data.</para>
    <para>
     See also:
     <function>base64_decode</function>,
     <function>chunk_split</function>,
     RFC-2045 section 6.8.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.parse-url">
   <refnamediv>
    <refname>parse_url</refname>
    <refpurpose>Parse a URL and return its components</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>parse_url</function></funcdef>
      <paramdef>string <parameter>url</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns an associative array returning any of the
     various components of the URL that are present. This includes the
     "scheme", "host", "port", "user", "pass", "path", "query", and
     "fragment".
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.rawurldecode">
   <refnamediv>
    <refname>rawurldecode</refname>
    <refpurpose>Decode URL-encoded strings</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>rawurldecode</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string in which the sequences with percent
     (<literal>%</literal>) signs followed by two hex digits have been
     replaced with literal characters.  For example, the string
     <screen>foo%20bar%40baz</screen> decodes into <screen>foo
     bar@baz</screen>.
    </para>
    <simpara>
     See also <function>rawurlencode</function>,
                          <function>urldecode</function>,
                                                        <function>urlencode</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.rawurlencode">
   <refnamediv>
    <refname>rawurlencode</refname>
    <refpurpose>URL-encode according to RFC1738</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>rawurlencode</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string in which all non-alphanumeric characters except
     <screen>-_.</screen> have been replaced with a percent
     (<literal>%</literal>) sign followed by two hex digits.  This is
     the encoding described in RFC1738 for protecting literal
     characters from being interpreted as special URL delimiters, and
     for protecting URL's from being mangled by transmission media
     with character conversions (like some email systems).  For
     example, if you want to include a password in an ftp url:
     <example>
      <title><function>Rawurlencode</function> example 1</title>
      <programlisting role="php">
echo '&lt;A HREF="ftp://user:', rawurlencode ('foo @+%/'),
     '@ftp.my.com/x.txt">';
      </programlisting>
     </example>
     Or, if you pass information in a path info component of the url:
     <example>
      <title><function>Rawurlencode</function> example 2</title>
      <programlisting role="php">
echo '&lt;A HREF="http://x.com/department_list_script/',
    rawurlencode ('sales and marketing/Miami'), '">';
      </programlisting>
     </example>
    </para>
    <simpara>
     See also <function>rawurldecode</function>,
                          <function>urldecode</function>,
                                                        <function>urlencode</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.urldecode">
   <refnamediv>
    <refname>urldecode</refname>
    <refpurpose>Decodes URL-encoded string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>urldecode</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Decodes any <literal>%<replaceable>##</replaceable></literal>
     encoding in the given string.  The decoded string is returned.
     <example>
      <title><function>Urldecode</function> example</title>
      <programlisting role="php">
$a = split ('&amp;', $querystring);
$i = 0;
while ($i &lt; count ($a)) {
    $b = split ('=', $a [$i]);
    echo 'Value for parameter ', htmlspecialchars (urldecode ($b [0])),
         ' is ', htmlspecialchars (urldecode ($b [1])), "&lt;BR>";
    $i++;
}
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>urlencode</function>,
                          <function>rawurlencode</function>,
                                                        
<function>rawurldecode</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.urlencode">
   <refnamediv>
    <refname>urlencode</refname>
    <refpurpose>URL-encodes string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>urlencode</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string in which all non-alphanumeric characters except
     <literal>-_.</literal> have been replaced with a percent
     (<literal>%</literal>) sign followed by two hex digits and spaces
     encoded as plus (<literal>+</literal>) signs.  It is encoded the
     same way that the posted data from a WWW form is encoded, that is
     the same way as in
     <literal>application/x-www-form-urlencoded</literal> media type.
     This differs from the RFC1738 encoding (see
     <function>rawurlencode</function>) in that for historical
     reasons, spaces are encoded as plus (+) signs.  This function is
     convenient when encoding a string to be used in a query part of
     an URL, as a convenient way to pass variables to the next page:
     <example>
      <title><function>Urlencode</function> example</title>
      <programlisting role="php">
echo '&lt;A HREF="mycgi?foo=', urlencode ($userinput), '"&gt;';
      </programlisting>
     </example>
    </para>
        <para>Note: Be careful about variables that may match HTML entities.  
        Things like &amp;amp, &amp;copy and &amp;pound are parsed by the browser
        and the actual entity is used instead of the desired variable name.  This 
        is an obvious hassle that the W3C has been telling people about for years.
        The reference is here: <ulink url="&url.argsep;">&url.argsep;</ulink>
        PHP supports changing the argument separator to the W3C-suggested
        semi-colon through the arg_separator .ini directive.  Unfortunately most
        user agents do not send form data in this semi-colon separated format.
        A more portable way around this is to use &amp;amp; instead of &amp; as the
    separator.  You don't need to change PHP's arg_separator for this.  Leave
        it as &amp;, but simply encode your URLs using 
<function>htmlentities</function>(urlencode($data)).
     <example>
      <title><function>Urlencode/htmlentities</function> example</title>
      <programlisting role="php">
echo '&lt;A HREF="mycgi?foo=', htmlentities (urlencode ($userinput) ), '"&gt;';
      </programlisting>
     </example>
        </para>
    <para>
     See also <function>urldecode</function>,
                          <function>htmlentities</function>,
                          <function>rawurldecode</function>,
                                                        
<function>rawurlencode</function>.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/var.xml
+++ phpdoc/kr/functions/var.xml
 <reference id="ref.var">
  <title>Variable Functions</title>
  <titleabbrev>Variables</titleabbrev>

  <refentry id="function.doubleval">
   <refnamediv>
    <refname>doubleval</refname>
    <refpurpose>Get double value of a variable</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>double <function>doubleval</function></funcdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns the double (floating point) value of
     <parameter>var</parameter>.
    </simpara>
    <para>
     <parameter>Var</parameter> may be any scalar type. You cannot use
     <function>doubleval</function> on arrays or objects.
    <informalexample>
      <programlisting role="php">
$var = '122.34343The';
$double_value_of_var = doubleval ($var);
print $double_value_of_var; // prints 122.34343
      </programlisting>
     </informalexample>
    </para>
    <simpara>
     See also <function>intval</function>,
     <function>strval</function>, <function>settype</function> and
     <link linkend="language.types.type-juggling">Type
     juggling</link>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.empty">
   <refnamediv>
    <refname>empty</refname>
    <refpurpose>Determine whether a variable is set</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>empty</function></funcdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns false if <parameter>var</parameter> is set and has a
     non-empty or non-zero value; true otherwise.
     <informalexample>
      <programlisting role="php">
$var = 0;

if (empty($var)) {  // evaluates true
    echo '$var is either 0 or not set at all';
}

if (!isset($var)) { // evaluates false
    echo '$var is not set at all';
}
      </programlisting>
     </informalexample>
    </para>
    <simpara>
     Note that this is meaningless when used on anything which isn't a
     variable; i.e. <command>empty (addslashes ($name))</command> has
     no meaning since it would be checking whether something which
     isn't a variable is a variable with a false value.
    </simpara>
    <simpara>
     See also <function>isset</function> and
     <function>unset</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.gettype">
   <refnamediv>
    <refname>gettype</refname>
    <refpurpose>Get the type of a variable</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>gettype</function></funcdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the type of the PHP variable
     <parameter>var</parameter>.
    </para>
    <para>
     Possibles values for the returned string are:
     <itemizedlist>
      <listitem>
       <simpara>"boolean"</simpara>
      </listitem>
      <listitem>
       <simpara>"integer"</simpara>
      </listitem>
      <listitem>
       <simpara>"double"</simpara>
      </listitem>
      <listitem>
       <simpara>"string"</simpara>
      </listitem>
      <listitem>
       <simpara>"array"</simpara>
      </listitem>
      <listitem>
       <simpara>"object"</simpara>
      </listitem>
      <listitem>
       <simpara>"resource"</simpara>
      </listitem>
      <listitem>
       <simpara>"user function" (PHP 3 only, deprecated)</simpara>
      </listitem>
      <listitem>
       <simpara>"unknown type"</simpara>
      </listitem>
     </itemizedlist>
    </para>
    <para>
     For PHP 4, you should use <function>function_exists</function> and
     <function>method_exists</function> to replace the prior usage of
     <function>gettype</function> on a function.
    </para>
    <para>
     See also <function>settype</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.intval">
   <refnamediv>
    <refname>intval</refname>
    <refpurpose>Get integer value of a variable</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>intval</function></funcdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
      <paramdef>int
       <parameter><optional>base</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns the integer value of <parameter>var</parameter>,
     using the specified base for the conversion (the default is
     base 10).
    </simpara>
    <simpara>
     <parameter>Var</parameter> may be any scalar type. You cannot use
     <function>intval</function> on arrays or objects.
    </simpara>
    <simpara>
     See also <function>doubleval</function>,
     <function>strval</function>, <function>settype</function> and
     <link linkend="language.types.type-juggling">Type
     juggling</link>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.is-array">
   <refnamediv>
    <refname>is_array</refname>
    <refpurpose>Finds whether a variable is an array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>is_array</function></funcdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true if <parameter>var</parameter> is an array, false
     otherwise.
    </para>
    <para>
     See also <function>is_double</function>,
     <function>is_float</function>,
     <function>is_int</function>,
     <function>is_integer</function>,
     <function>is_real</function>,
     <function>is_string</function>,
     <function>is_long</function>, and
     <function>is_object</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.is-bool">
   <refnamediv>
    <refname>is_bool</refname>
     <refpurpose>
      Finds out whether a variable is a boolean
     </refpurpose>
    </refnamediv>
    <refsect1>
     <title>Description</title>
     <funcsynopsis>
     <funcprototype>
       <funcdef>bool
        <function>is_bool</function>
       </funcdef>
       <paramdef>mixed 
        <parameter>var</parameter>
       </paramdef>
     </funcprototype>
     </funcsynopsis>
     <para>
      Returns true if the <parameter>var</parameter> parameter is 
      a boolean.
     </para>
     <para>
     See also <function>is_array</function>,
     <function>is_double</function>,
     <function>is_float</function>,
     <function>is_int</function>,
     <function>is_integer</function>,
     <function>is_real</function>,
     <function>is_string</function>,
     <function>is_long</function>, and
     <function>is_object</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.is-double">
   <refnamediv>
    <refname>is_double</refname>
    <refpurpose>Finds whether a variable is a double</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>is_double</function></funcdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true if <parameter>var</parameter> is a double,
     false otherwise.
    </para>
    <para>
     See also <function>is_array</function>,
     <function>is_bool</function>,
     <function>is_float</function>,
     <function>is_int</function>,
     <function>is_integer</function>,
     <function>is_real</function>,
     <function>is_string</function>,
     <function>is_long</function>, and
     <function>is_object</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.is-float">
   <refnamediv>
    <refname>is_float</refname>
    <refpurpose>Finds whether a variable is a float</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>is_float</function></funcdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     This function is an alias for <function>is_double</function>.
    </simpara>
    <simpara>
     See also <function>is_double</function>,
     <function>is_bool</function>,
     <function>is_real</function>,
     <function>is_int</function>,
     <function>is_integer</function>,
     <function>is_string</function>,
     <function>is_object</function>,
     <function>is_array</function>, and
     <function>is_long</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.is-int">
   <refnamediv>
    <refname>is_int</refname>
    <refpurpose>Find whether a variable is an integer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>is_int</function></funcdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     This function is an alias for <function>is_long</function>.
    </simpara>
    <simpara>
     See also <function>is_bool</function>,
     <function>is_double</function>,
     <function>is_float</function>,
     <function>is_integer</function>,
     <function>is_string</function>,
     <function>is_real</function>,
     <function>is_object</function>,
     <function>is_array</function>, and
     <function>is_long</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.is-integer">
   <refnamediv>
    <refname>is_integer</refname>
    <refpurpose>Find whether a variable is an integer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>is_integer</function></funcdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     This function is an alias for
     <function>is_long</function>.
    </simpara>
    <simpara>
     See also <function>is_bool</function>,
     <function>is_double</function>,
     <function>is_float</function>,
     <function>is_int</function>,
     <function>is_string</function>,
     <function>is_real</function>,
     <function>is_object</function>,
     <function>is_array</function>, and
     <function>is_long</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.is-long">
   <refnamediv>
    <refname>is_long</refname>
    <refpurpose>Finds whether a variable is an integer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>is_long</function></funcdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true if <parameter>var</parameter> is an integer (long),
     false otherwise.
    </para>
    <para>
     See also <function>is_bool</function>,
     <function>is_double</function>,
     <function>is_float</function>,
     <function>is_int</function>,
     <function>is_real</function>,
     <function>is_string</function>,
     <function>is_object</function>,
     <function>is_array</function>, and
     <function>is_integer</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.is-numeric">
   <refnamediv>
    <refname>is_numeric</refname>
    <refpurpose>
     Finds whether a variable is a number or a numeric string
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>is_numeric</function></funcdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true if <parameter>var</parameter> is a number or a
     numeric string, false otherwise.
    </para>
    <para>
     See also <function>is_bool</function>,
     <function>is_double</function>,
     <function>is_float</function>,
     <function>is_int</function>,
     <function>is_real</function>,
     <function>is_string</function>,
     <function>is_object</function>,
     <function>is_array</function>, and
     <function>is_integer</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.is-object">
   <refnamediv>
    <refname>is_object</refname>
    <refpurpose>Finds whether a variable is an object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>is_object</function></funcdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true if <parameter>var</parameter> is an object, false
     otherwise.
    </para>
    <para>
     See also <function>is_bool</function>,
     <function>is_long</function>,
     <function>is_int</function>,
     <function>is_integer</function>,
     <function>is_float</function>,
     <function>is_double</function>,
     <function>is_real</function>,
     <function>is_string</function>, and
     <function>is_array</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.is-real">
   <refnamediv>
    <refname>is_real</refname>
    <refpurpose>Finds whether a variable is a real</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>is_real</function></funcdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     This function is an alias for <function>is_double</function>.
    </simpara>
    <simpara>
     See also <function>is_bool</function>,
     <function>is_long</function>,
     <function>is_int</function>,
     <function>is_integer</function>,
     <function>is_float</function>,
     <function>is_double</function>,
     <function>is_object</function>,
     <function>is_string</function>, and
     <function>is_array</function>.
    </simpara>
   </refsect1>
  </refentry>
  
  <refentry id="function.is-resource">
   <refnamediv>
    <refname>is_resource</refname>
    <refpurpose>
     Finds whether a variable is a resource
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool 
       <function>is_resource</function>
      </funcdef>
      <paramdef>mixed 
       <parameter>var</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>is_resource</function> returns true if the variable
     given by the <parameter>var</parameter> parameter is a resource, 
     otherwise it returns false.
    </para>
    <para>
     Resources are things like file or database result handles that
     are allocated and freed by internal PHP functions and that may
     need some cleanup when they are no longer in use but haven't been
     freed by user code.  
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.is-string">
   <refnamediv>
    <refname>is_string</refname>
    <refpurpose>Finds whether a variable is a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>is_string</function></funcdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true if <parameter>var</parameter> is a string,
     false otherwise.
    </para>
    <para>
     See also <function>is_bool</function>,
     <function>is_long</function>,
     <function>is_int</function>,
     <function>is_integer</function>,
     <function>is_float</function>,
     <function>is_double</function>,
     <function>is_real</function>,
     <function>is_object</function>, and
     <function>is_array</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.isset">
   <refnamediv>
    <refname>isset</refname>
    <refpurpose>Determine whether a variable is set</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>isset</function></funcdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns true if <parameter>var</parameter> exists;
     false otherwise.
    </simpara>
    <para>
     If a variable has been unset with <function>unset</function>,
     it will no longer be <function>isset</function>.
     <informalexample>
      <programlisting role="php">
$a = "test";
echo isset ($a); // true
unset ($a);
echo isset ($a); // false
      </programlisting>
     </informalexample>
    </para>
    <simpara>
     See also <function>empty</function> and
     <function>unset</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.print-r">
   <refnamediv>
    <refname>print_r</refname>
    <refpurpose>
     Prints human-readable information about a variable
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>print_r</function></funcdef>
      <paramdef>mixed <parameter>expression</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     This function displays information about the values of variables
     in a way that's readable by humans.  If given a string, integer
     or double, the value itself will be printed.  If given an array,
     values will be presented in a format that shows keys and
     elements.  Similar notation is used for objects.
    </simpara>
    <simpara>
     Compare <function>print_r</function> to
     <function>var_dump</function>.
    </simpara>
    <para>
     <informalexample>
      <programlisting role="php">
&lt;?php
$a = array (1, 2, array ("a", "b", "c"));
print_r ($a);
?>
      </programlisting>
     </informalexample>
    </para>
    <warning>
     <para>
      This function will continue forever if given an array or object 
      that contains a direct or indirect reference to itself or that 
      contains an array or object on a deeper level that does so.
      This is especially true for <literal>print_r($GLOBALS)</literal>, 
      as <literal>$GLOBALS</literal> is itself a global variable and
      contains a reference to itself as such.
     </para>
    </warning>
   </refsect1>
  </refentry>

  <refentry id="function.serialize">
   <refnamediv>
    <refname>serialize</refname>
    <refpurpose>
     Generates a storable representation of a value
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>serialize</function></funcdef>
      <paramdef>mixed <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Serialize</function> returns a string containing a
     byte-stream representation of <parameter>value</parameter> that
     can be stored anywhere.
    </simpara>
    <simpara>
     This is useful for storing or passing PHP values around without
     losing their type and structure.
    </simpara>
    <simpara>
     To make the serialized string into a PHP value again, use
     <function>unserialize</function>.    <function>Serialize</function>
     handles the types <type>integer</type>, <type>double</type>,
     <type>string</type>, <type>array</type> (multidimensional) and
     <type>object</type> (object properties will be serialized, but
     methods are lost).
    </simpara>
    <para>
     <example>
      <title><function>Serialize</function> example</title>
      <programlisting role="php">
// $session_data contains a multi-dimensional array with session
// information for the current user.  We use serialize() to store
// it in a database at the end of the request.

$conn = odbc_connect ("webdb", "php", "chicken");
$stmt = odbc_prepare ($conn,
      "UPDATE sessions SET data = ? WHERE id = ?");
$sqldata = array (serialize($session_data), $PHP_AUTH_USER);
if (!odbc_execute ($stmt, &amp;$sqldata)) {
    $stmt = odbc_prepare($conn,
     "INSERT INTO sessions (id, data) VALUES(?, ?)");
    if (!odbc_execute($stmt, &amp;$sqldata)) {
    /* Something went wrong.  Bitch, whine and moan. */
    }
}
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.settype">
   <refnamediv>
    <refname>settype</refname>
    <refpurpose>Set the type of a variable</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>settype</function></funcdef>
      <paramdef>string <parameter>var</parameter></paramdef>
      <paramdef>string <parameter>type</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Set the type of variable <parameter>var</parameter> to
     <parameter>type</parameter>.
    </para>
    <para>
     Possibles values of <parameter>type</parameter> are:
     <itemizedlist>
      <listitem><simpara>"integer"</simpara></listitem>
      <listitem><simpara>"double"</simpara></listitem>
      <listitem><simpara>"string"</simpara></listitem>
      <listitem><simpara>"array"</simpara></listitem>
      <listitem><simpara>"object"</simpara></listitem>
     </itemizedlist>
    </para>
    <para>
     Returns true if successful; otherwise returns false.
    </para>
    <para>
     See also <function>gettype</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.strval">
   <refnamediv>
    <refname>strval</refname>
    <refpurpose>Get string value of a variable</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>strval</function></funcdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     Returns the string value of <parameter>var</parameter>.
    </simpara>
    <simpara>
     <parameter>var</parameter> may be any scalar type. You cannot use
     <function>strval</function> on arrays or objects.
    </simpara>
    <simpara>
     See also <function>doubleval</function>,
     <function>intval</function>, <function>settype</function> and
     <link linkend="language.types.type-juggling">Type
     juggling</link>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.unserialize">
   <refnamediv>
    <refname>unserialize</refname>
    <refpurpose>
     Creates a PHP value from a stored representation
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>unserialize</function></funcdef>
      <paramdef>string <parameter>str</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>unserialize</function> takes a single serialized
     variable (see <function>serialize</function>) and converts it
     back into a PHP value.  The converted value is returned, and can
     be an <type>integer</type>, <type>double</type>,
     <type>string</type>, <type>array</type> or <type>object</type>.
     If an object was serialized, its methods are not preserved in the
     returned value.
    </simpara>
    <para>
     <example>
      <title><function>Unserialize</function> example</title>
      <programlisting role="php">
// Here, we use unserialize() to load session data from a database
// into $session_data.    This example complements the one described
// with <function>serialize</function>.

$conn = odbc_connect ("webdb", "php", "chicken");
$stmt = odbc_prepare ($conn, "SELECT data FROM sessions WHERE id = ?");
$sqldata = array ($PHP_AUTH_USER);
if (!odbc_execute ($stmt, &amp;$sqldata) || !odbc_fetch_into ($stmt, &amp;$tmp)) {
    // if the execute or fetch fails, initialize to empty array
    $session_data = array();
} else {
    // we should now have the serialized data in $tmp[0].
    $session_data = unserialize ($tmp[0]);
    if (!is_array ($session_data)) {
    // something went wrong, initialize to empty array
    $session_data = array();
    }
}
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.unset">
   <refnamediv>
    <refname>unset</refname>
    <refpurpose>Unset a given variable</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>unset</function></funcdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
      <paramdef>mixed <parameter><optional>var</optional></parameter></paramdef>
      <paramdef><parameter><optional>...</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>unset</function> destroys the specified variables and
     returns true.
    </para>
    <para>
     <example>
      <title><function>Unset</function> example</title>
      <programlisting role="php">
// destroy a single variable
unset ($foo);

// destroy a single element of an array
unset ($bar['quux']);

// destroy more than one variable
unset ($foo1, $foo2, $foo3);
      </programlisting>
     </example>
    </para>
    <para>
     The behavior of <function>unset</function> inside of a function
     can vary depending on what type of variable you are attempting to
     destroy.
    </para>
    <para>
     If a globalized variable is <function>unset</function> inside of
     a function, only the local variable is destroyed.  The variable
     in the calling environment will retain the same value as before
     <function>unset</function> was called.
     <informalexample>
      <programlisting role="php">
function destroy_foo() {
    global $foo;
    unset($foo);
}

$foo = 'bar';
destroy_foo();
echo $foo;
      </programlisting>
     </informalexample>
     The above example would output:
     <informalexample>
      <programlisting>
bar
      </programlisting>
     </informalexample>
    </para>
    <para>
     If a variable that is PASSED BY REFERENCE is
     <function>unset</function> inside of a function, only the local
     variable is destroyed.  The variable in the calling environment
     will retain the same value as before <function>unset</function>
     was called.
     <informalexample>
      <programlisting role="php">
function foo(&$bar) { 
    unset($bar); 
    $bar = "blah"; 
}

$bar = 'something';
echo "$bar\n";

foo($bar);
echo "$bar\n";
      </programlisting>
     </informalexample>
     The above example would output:
     <informalexample>
      <programlisting>
something
something
      </programlisting>
     </informalexample>
    </para>
    <para>
     If a static variable is <function>unset</function> inside of a
     function, <function>unset</function> unsets the reference to the
     static variable, rather than the static variable itself.
     <informalexample>
      <programlisting role="php">
function foo() { 
    static $a;
    $a++;
       echo "$a\n";

    unset($a);
}

foo();
foo();
foo();
      </programlisting>
     </informalexample>
     The above example would output:
     <informalexample>
      <programlisting>
1
2
3
      </programlisting>
     </informalexample>
    </para>
    <para>
     If you would like to <function>unset</function> a global variable inside of a 
function, you can use the <parameter>$GLOBALS</parameter> array to do so:
     <informalexample>
      <programlisting role="php">
function foo() {
    unset($GLOBALS['bar']);       
}

$bar = "something";
foo();
      </programlisting>
     </informalexample>
    </para>
    <para>
     See also <function>isset</function> and
     <function>empty</function>.
    </para>
   </refsect1>
  </refentry>
  
  <refentry id="function.var-dump">
   <refnamediv>
    <refname>var_dump</refname>
    <refpurpose>Dumps information about a variable</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>var_dump</function></funcdef>
      <paramdef>mixed <parameter>expression</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     This function returns structured information about an expression
     that includes its type and value.  Arrays are explored
     recursively with values indented to show structure.
    </simpara>
    <simpara>
     Compare <function>var_dump</function> to
     <function>print_r</function>.
    </simpara>
    <para>
     <informalexample>
      <programlisting role="php">
&lt;pre>
&lt;?php
    $a = array (1, 2, array ("a", "b", "c"));
    var_dump ($a);
?>
&lt;/pre>
      </programlisting>
     </informalexample>
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/wddx.xml
+++ phpdoc/kr/functions/wddx.xml
 <reference id="ref.wddx">
  <title>WDDX functions</title>
  <titleabbrev>WDDX</titleabbrev>
  
  <partintro>
   <para>
    These functions are intended for work with <ulink 
url="&url.wddx;">WDDX</ulink>.</para>
  
   <para>
    Note that all the functions that serialize variables use the first
    element of an array to determine whether the array is to be
    serialized into an array or structure.  If the first element has
    string key, then it is serialized into a structure, otherwise,
    into an array.

    <example>
     <title>Serializing a single value</title>
     <programlisting role="php">
&lt;?php
print wddx_serialize_value("PHP to WDDX packet example", "PHP packet");
?&gt;
     </programlisting>
    </example></para>
    
   <para>
    This example will produce:
    <informalexample>
     <programlisting role="php">
&lt;wddxPacket version='1.0'&gt;&lt;header comment='PHP packet'/&gt;&lt;data&gt;
&lt;string&gt;PHP to WDDX packet example&lt;/string&gt;&lt;/data&gt;&lt;/wddxPacket&gt;
     </programlisting>
    </informalexample>

    <example>
     <title>Using incremental packets</title>
     <programlisting role="php">
&lt;?php
$pi = 3.1415926;
$packet_id = wddx_packet_start("PHP");
wddx_add_vars($packet_id, "pi");

/* Suppose $cities came from database */
$cities = array("Austin", "Novato", "Seattle");
wddx_add_vars($packet_id, "cities");

$packet = wddx_packet_end($packet_id);
print $packet;
?&gt;
     </programlisting>
    </example></para>
    
   <para>
    This example will produce:

    <informalexample>
     <programlisting role="php">
&lt;wddxPacket version='1.0'&gt;&lt;header comment='PHP'/&gt;&lt;data&gt;&lt;struct&gt;
&lt;var name='pi'&gt;&lt;number&gt;3.1415926&lt;/number&gt;&lt;/var&gt;&lt;var 
name='cities'&gt;
&lt;array 
length='3'&gt;&lt;string&gt;Austin&lt;/string&gt;&lt;string&gt;Novato&lt;/string&gt;
&lt;string&gt;Seattle&lt;/string&gt;&lt;/array&gt;&lt;/var&gt;&lt;/struct&gt;&lt;/data&gt;&lt;/wddxPacket&gt;
     </programlisting>
    </informalexample></para>
   
  </partintro>
  
  <refentry id="function.wddx-serialize-value">
   <refnamediv>
    <refname>wddx_serialize_value</refname>
    <refpurpose>Serialize a single value into a WDDX packet</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string
      <function>wddx_serialize_value</function></funcdef>
      <paramdef>mixed <parameter>var</parameter></paramdef>
      <paramdef>string
      <parameter><optional>comment</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
  
    <para>
     <function>wddx_serialize_value</function> is used to create a
     WDDX packet from a single given value.  It takes the value
     contained in <parameter>var</parameter>, and an optional
     <parameter>comment</parameter> string that appears in the packet
     header, and returns the WDDX packet.</para>
      
   </refsect1>
  </refentry>
  
  <refentry id="function.wddx-serialize-vars">
   <refnamediv>
    <refname>wddx_serialize_vars</refname>
    <refpurpose>Serialize variables into a WDDX packet</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>wddx_serialize_vars</function></funcdef>
      <paramdef>mixed <parameter>var_name</parameter></paramdef>
      <paramdef>mixed 
       <parameter><optional>...</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
  
    <para>
     <function>wddx_serialize_vars</function> is used to create a WDDX
     packet with a structure that contains the serialized
     representation of the passed variables.</para>
   
    <para>
     <function>wddx_serialize_vars</function> takes a variable number
     of arguments, each of which can be either a string naming a
     variable or an array containing strings naming the variables or
     another array, etc.</para>
   
    <para>
     <example>
      <title>wddx_serialize_vars example</title>
      <programlisting>
&lt;?php
$a = 1;
$b = 5.5;
$c = array("blue", "orange", "violet");
$d = "colors";

$clvars = array("c", "d");
print wddx_serialize_vars("a", "b", $clvars);
?&gt;
      </programlisting>
     </example></para>
   
    <para>
     The above example will produce:
     <programlisting>
&lt;wddxPacket version='1.0'&gt;&lt;header/&gt;&lt;data&gt;&lt;struct&gt;&lt;var 
name='a'&gt;&lt;number&gt;1&lt;/number&gt;&lt;/var&gt;
&lt;var name='b'&gt;&lt;number&gt;5.5&lt;/number&gt;&lt;/var&gt;&lt;var 
name='c'&gt;&lt;array length='3'&gt;
&lt;string&gt;blue&lt;/string&gt;&lt;string&gt;orange&lt;/string&gt;&lt;string&gt;violet&lt;/string&gt;&lt;/array&gt;&lt;/var&gt;
&lt;var 
name='d'&gt;&lt;string&gt;colors&lt;/string&gt;&lt;/var&gt;&lt;/struct&gt;&lt;/data&gt;&lt;/wddxPacket&gt;
     </programlisting></para>
  
   </refsect1>
  </refentry>
  
  <refentry id="function.wddx-packet-start">
   <refnamediv>
    <refname>wddx_packet_start</refname>
    <refpurpose>Starts a new WDDX packet with structure inside it</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>wddx_packet_start</function></funcdef>
      <paramdef>string
      <parameter><optional>comment</optional></parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
  
    <para>
     Use <function>wddx_packet_start</function> to start a new WDDX
     packet for incremental addition of variables.  It takes an
     optional <parameter>comment</parameter> string and returns a
     packet ID for use in later functions.  It automatically creates a
     structure definition inside the packet to contain the variables.</para>
   
   </refsect1>
  </refentry>
  
  <refentry id="function.wddx-packet-end">
   <refnamediv>
    <refname>wddx_packet_end</refname>
    <refpurpose>Ends a WDDX packet with the specified ID</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>wddx_packet_end</function></funcdef>
      <paramdef>int <parameter>packet_id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
  
    <para>
     <function>wddx_packet_end</function> ends the WDDX packet
     specified by the <parameter>packet_id</parameter> and returns the
     string with the packet.</para>
   
   </refsect1>
  </refentry>
  
  <refentry id="function.wddx-add-vars">
   <refnamediv>
    <refname>wddx_add_vars</refname>
    <refpurpose>Add variables to a WDDX packet with the specified ID</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef><function>wddx_add_vars</function></funcdef>
      <paramdef>int <parameter>packet_id</parameter></paramdef>
      <paramdef>mixed <parameter>name_var</parameter></paramdef>
      <paramdef>mixed 
       <parameter><optional>...</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
  
    <para>
     <function>wddx_add_vars</function> is used to serialize passed
     variables and add the result to the packet specified by the
     <parameter>packet_id</parameter>.  The variables to be serialized
     are specified in exactly the same way as
     <function>wddx_serialize_vars</function>.</para>
     
   </refsect1>
  </refentry>
  
  <refentry id="function.wddx-deserialize">
   <refnamediv>
    <refname>wddx_deserialize</refname>
    <refpurpose>Deserializes a WDDX packet</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>wddx_deserialize</function></funcdef>
      <paramdef>string <parameter>packet</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
  
    <para>
     <function>wddx_deserialized</function> takes a
     <parameter>packet</parameter> string and deserializes it.  It
     returns the result which can be string, number, or array.  Note
     that structures are deserialized into associative arrays.</para>
     
   </refsect1>
  </refentry>
 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/xml.xml
+++ phpdoc/kr/functions/xml.xml
 <reference id="ref.xml">
  <title>XML parser functions</title>
  <titleabbrev>XML</titleabbrev>

  <partintro>
   <sect1 id="xml.partintro">
    <title>Introduction</title>
    <sect2 id="xml.intro">
     <title>About XML</title>
     <para>
      XML (eXtensible Markup Language) is a data format for structured
      document interchange on the Web.  It is a standard defined by
      The World Wide Web consortium (W3C).  Information about XML and
      related technologies can be found at <ulink
      url="&url.xml;">&url.xml;</ulink>.
     </para>
    </sect2>
    <sect2 id="xml.install">
     <title>Installation</title>
     <para>
      This extension uses <productname>expat</productname>, which can
      be found at <ulink url="&url.expat;">&url.expat;</ulink>.  The
      Makefile that comes with expat does not build a library by
      default, you can use this make rule for that:
      <programlisting role="makefile">
libexpat.a: $(OBJS)
    ar -rc $@ $(OBJS)
    ranlib $@
      </programlisting>
      A source RPM package of expat can be found at <ulink
      url="&url.expat.rpm;">&url.expat.rpm;</ulink>.
     </para>
     <para>
      Note that if you are using Apache-1.3.7 or later, you already
      have the required expat library.  Simply configure PHP using
      <option role="configure">--with-xml</option> (without any
      additional path) and it will automatically use the expat library
      built into Apache.
     </para>
     <para>
      On UNIX, run <command>configure</command> with the <option
      role="configure">--with-xml</option> option.  The
      <productname>expat</productname> library should be installed
      somewhere your compiler can find it.  If you compile PHP as a
      module for Apache 1.3.9 or later, PHP will automatically use the
      bundled <productname>expat</productname> library from Apache.
      You may need to set <envar>CPPFLAGS</envar> and
      <envar>LDFLAGS</envar> in your environment before running
      configure if you have installed expat somewhere exotic.
     </para>
     <para>
      Build PHP.  <emphasis>Tada!</emphasis>  That should be it.
     </para>
    </sect2>

    <sect2 id="xml.about">
     <title>About This Extension</title>
     <para>
      This PHP extension implements support for James Clark's
      <productname>expat</productname> in PHP.  This toolkit lets you
      parse, but not validate, XML documents.  It supports three
      source <link linkend="xml.encoding">character encodings</link>
      also provided by PHP: <literal>US-ASCII</literal>,
      <literal>ISO-8859-1</literal> and <literal>UTF-8</literal>.
      <literal>UTF-16</literal> is not supported.
     </para>
     <para>
      This extension lets you <link
      linkend="function.xml-parser-create">create XML parsers</link>
      and then define <emphasis>handlers</emphasis> for different XML
      events.  Each XML parser also has a few <link
      linkend="function.xml-parser-set-option">parameters</link> you
      can adjust.
     </para>
     <para>
      The XML event handlers defined are:
      <table>
       <title>Supported XML handlers</title>
       <tgroup cols="2">
    <thead>
     <row>
      <entry>PHP function to set handler</entry>
      <entry>Event description</entry>
     </row>
    </thead>
    <tbody>
     <row>
      <entry><function>xml_set_element_handler</function></entry>
      <entry>
       Element events are issued whenever the XML parser
       encounters start or end tags.  There are separate handlers
       for start tags and end tags.
      </entry>
     </row>
     <row>
      <entry>
       <function>xml_set_character_data_handler</function>
      </entry>
      <entry>
       Character data is roughly all the non-markup contents of
       XML documents, including whitespace between tags.  Note
       that the XML parser does not add or remove any whitespace,
       it is up to the application (you) to decide whether
       whitespace is significant.
      </entry>
     </row>
     <row>
      <entry>
       <function>xml_set_processing_instruction_handler</function>
      </entry>
      <entry>
       PHP programmers should be familiar with processing
       instructions (PIs) already.  &lt;?php ?&gt; is a processing
       instruction, where <replaceable>php</replaceable> is called
       the "PI target".  The handling of these are
       application-specific, except that all PI targets starting
       with "XML" are reserved.
      </entry>
     </row>
     <row>
      <entry><function>xml_set_default_handler</function></entry>
      <entry>
       What goes not to another handler goes to the default
       handler.  You will get things like the XML and document
       type declarations in the default handler.
      </entry>
     </row>
     <row>
      <entry>
       <function>xml_set_unparsed_entity_decl_handler</function>
      </entry>
      <entry>
       This handler will be called for declaration of an unparsed
       (NDATA) entity.
      </entry>
     </row>
     <row>
      <entry>
       <function>xml_set_notation_decl_handler</function>
      </entry>
      <entry>
       This handler is called for declaration of a notation.
      </entry>
     </row>
     <row>
      <entry>
       <function>xml_set_external_entity_ref_handler</function>
      </entry>
      <entry>
       This handler is called when the XML parser finds a
       reference to an external parsed general entity.  This can
       be a reference to a file or URL, for example.  See <link
       linkend="example.xml-external-entity">the external entity
       example</link> for a demonstration.
      </entry>
     </row>
    </tbody>
       </tgroup>
      </table>
     </para>
    </sect2>

    <sect2 id="xml.case-folding">
     <title>Case Folding</title>
     <para>
      The element handler functions may get their element names
      <glossterm>case-folded</glossterm>.  Case-folding is defined by
      the XML standard as "a process applied to a sequence of
      characters, in which those identified as non-uppercase are
      replaced by their uppercase equivalents".  In other words, when
      it comes to XML, case-folding simply means uppercasing.
     </para>
     <para>
      By default, all the element names that are passed to the handler
      functions are case-folded.  This behaviour can be queried and
      controlled per XML parser with the
      <function>xml_parser_get_option</function> and
      <function>xml_parser_set_option</function> functions,
      respectively.
     </para>
    </sect2>

    <sect2 id="xml.error-codes">
     <title>Error Codes</title>
     <para>
      The following constants are defined for XML error codes (as
      returned by <function>xml_parse</function>):
      <simplelist>
       <member>XML_ERROR_NONE</member>
       <member>XML_ERROR_NO_MEMORY</member>
       <member>XML_ERROR_SYNTAX</member>
       <member>XML_ERROR_NO_ELEMENTS</member>
       <member>XML_ERROR_INVALID_TOKEN</member>
       <member>XML_ERROR_UNCLOSED_TOKEN</member>
       <member>XML_ERROR_PARTIAL_CHAR</member>
       <member>XML_ERROR_TAG_MISMATCH</member>
       <member>XML_ERROR_DUPLICATE_ATTRIBUTE</member>
       <member>XML_ERROR_JUNK_AFTER_DOC_ELEMENT</member>
       <member>XML_ERROR_PARAM_ENTITY_REF</member>
       <member>XML_ERROR_UNDEFINED_ENTITY</member>
       <member>XML_ERROR_RECURSIVE_ENTITY_REF</member>
       <member>XML_ERROR_ASYNC_ENTITY</member>
       <member>XML_ERROR_BAD_CHAR_REF</member>
       <member>XML_ERROR_BINARY_ENTITY_REF</member>
       <member>XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF</member>
       <member>XML_ERROR_MISPLACED_XML_PI</member>
       <member>XML_ERROR_UNKNOWN_ENCODING</member>
       <member>XML_ERROR_INCORRECT_ENCODING</member>
       <member>XML_ERROR_UNCLOSED_CDATA_SECTION</member>
       <member>XML_ERROR_EXTERNAL_ENTITY_HANDLING</member>
      </simplelist>
     </para>
    </sect2>
    <sect2 id="xml.encoding">
     <title>Character Encoding</title>
     <para>
      PHP's XML extension supports the <ulink
      url="&url.unicode;">Unicode</ulink> character set through
      different <glossterm>character encoding</glossterm>s.  There are
      two types of character encodings, <glossterm>source
      encoding</glossterm> and <glossterm>target encoding</glossterm>.
      PHP's internal representation of the document is always encoded
      with <literal>UTF-8</literal>.
     </para>
     <para>
      Source encoding is done when an XML document is <link
      linkend="function.xml-parse">parsed</link>.  Upon <link
      linkend="function.xml-parser-create">creating an XML
      parser</link>, a source encoding can be specified (this encoding
      can not be changed later in the XML parser's lifetime).  The
      supported source encodings are <literal>ISO-8859-1</literal>,
      <literal>US-ASCII</literal> and <literal>UTF-8</literal>.  The
      former two are single-byte encodings, which means that each
      character is represented by a single byte.
      <literal>UTF-8</literal> can encode characters composed by a
      variable number of bits (up to 21) in one to four bytes.  The
      default source encoding used by PHP is
      <literal>ISO-8859-1</literal>.
     </para>
     <para>
      Target encoding is done when PHP passes data to XML handler
      functions.  When an XML parser is created, the target encoding
      is set to the same as the source encoding, but this may be
      changed at any point.  The target encoding will affect character
      data as well as tag names and processing instruction targets.
     </para>
     <para>
      If the XML parser encounters characters outside the range that
      its source encoding is capable of representing, it will return
      an error.  
     </para>
     <para>
      If PHP encounters characters in the parsed XML document that can
      not be represented in the chosen target encoding, the problem
      characters will be "demoted".  Currently, this means that such
      characters are replaced by a question mark.
     </para>
    </sect2>
   </sect1>

   <sect1 id="xml.examples">
    <title>Some Examples</title>
    <para>
     Here are some example PHP scripts parsing XML documents.
    </para>
    <sect2 id="example.xml-structure">
     <title>XML Element Structure Example</title>
     <para>
      This first example displays the stucture of the start elements in
      a document with indentation.
      <example>
       <title>Show XML Element Structure</title>
       <programlisting role="php">
$file = "data.xml";
$depth = array();

function startElement($parser, $name, $attrs) {
    global $depth;
    for ($i = 0; $i &lt; $depth[$parser]; $i++) {
        print "  ";
    }
    print "$name\n";
    $depth[$parser]++;
}

function endElement($parser, $name) {
    global $depth;
    $depth[$parser]--;
}

$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
if (!($fp = fopen($file, "r"))) {
    die("could not open XML input");
}

while ($data = fread($fp, 4096)) {
    if (!xml_parse($xml_parser, $data, feof($fp))) {
        die(sprintf("XML error: %s at line %d",
                    xml_error_string(xml_get_error_code($xml_parser)),
                    xml_get_current_line_number($xml_parser)));
    }
}
xml_parser_free($xml_parser);
       </programlisting>
      </example>
     </para>
    </sect2>

    <sect2 id="example.xml-map-tags">
     <title>XML Tag Mapping Example</title>
     <para>
      <example>
       <title>Map XML to HTML</title>
       <para>
    This example maps tags in an XML document directly to HTML
    tags.  Elements not found in the "map array" are ignored.  Of
    course, this example will only work with a specific XML
    document type.
    <programlisting role="php">
$file = "data.xml";
$map_array = array(
    "BOLD"     =&gt; "B",
    "EMPHASIS" =&gt; "I",
    "LITERAL"  =&gt; "TT"
);

function startElement($parser, $name, $attrs) {
    global $map_array;
    if ($htmltag = $map_array[$name]) {
        print "&lt;$htmltag&gt;";
    }
}

function endElement($parser, $name) {
    global $map_array;
    if ($htmltag = $map_array[$name]) {
        print "&lt;/$htmltag&gt;";
    }
}

function characterData($parser, $data) {
    print $data;
}

$xml_parser = xml_parser_create();
// use case-folding so we are sure to find the tag in $map_array
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, true);
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
if (!($fp = fopen($file, "r"))) {
    die("could not open XML input");
}

while ($data = fread($fp, 4096)) {
    if (!xml_parse($xml_parser, $data, feof($fp))) {
        die(sprintf("XML error: %s at line %d",
                    xml_error_string(xml_get_error_code($xml_parser)),
                    xml_get_current_line_number($xml_parser)));
    }
}
xml_parser_free($xml_parser);
    </programlisting>
       </para>
      </example>
     </para>
    </sect2>

    <sect2 id="example.xml-external-entity">
     <title>XML External Entity Example</title>
     <para>
      This example highlights XML code.  It illustrates how to use an
      external entity reference handler to include and parse other
      documents, as well as how PIs can be processed, and a way of
      determining "trust" for PIs containing code.
     </para>
     <para>
      XML documents that can be used for this example are found below
      the example (<filename>xmltest.xml</filename> and
      <filename>xmltest2.xml</filename>.)
     </para>
     <para>
      <example>
       <title>External Entity Example</title>
       <programlisting role="php">
$file = "xmltest.xml";

function trustedFile($file) {
    // only trust local files owned by ourselves
    if (!eregi("^([a-z]+)://", $file) 
        &amp;&amp; fileowner($file) == getmyuid()) {
            return true;
    }
    return false;
}

function startElement($parser, $name, $attribs) {
    print "&amp;lt;&lt;font color=\"#0000cc\"&gt;$name&lt;/font&gt;";
    if (sizeof($attribs)) {
        while (list($k, $v) = each($attribs)) {
            print " &lt;font color=\"#009900\"&gt;$k&lt;/font&gt;=\"&lt;font 
                   color=\"#990000\"&gt;$v&lt;/font&gt;\"";
        }
    }
    print "&amp;gt;";
}

function endElement($parser, $name) {
    print "&amp;lt;/&lt;font color=\"#0000cc\"&gt;$name&lt;/font&gt;&amp;gt;";
}

function characterData($parser, $data) {
    print "&lt;b&gt;$data&lt;/b&gt;";
}

function PIHandler($parser, $target, $data) {
    switch (strtolower($target)) {
        case "php":
            global $parser_file;
            // If the parsed document is "trusted", we say it is safe
            // to execute PHP code inside it.  If not, display the code
            // instead.
            if (trustedFile($parser_file[$parser])) {
                eval($data);
            } else {
                printf("Untrusted PHP code: &lt;i&gt;%s&lt;/i&gt;", 
                        htmlspecialchars($data));
            }
            break;
    }
}

function defaultHandler($parser, $data) {
    if (substr($data, 0, 1) == "&amp;" &amp;&amp; substr($data, -1, 1) == ";") {
        printf('&lt;font color="#aa00aa"&gt;%s&lt;/font&gt;', 
                htmlspecialchars($data));
    } else {
        printf('&lt;font size="-1"&gt;%s&lt;/font&gt;', 
                htmlspecialchars($data));
    }
}

function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId,
                                  $publicId) {
    if ($systemId) {
        if (!list($parser, $fp) = new_xml_parser($systemId)) {
            printf("Could not open entity %s at %s\n", $openEntityNames,
                   $systemId);
            return false;
        }
        while ($data = fread($fp, 4096)) {
            if (!xml_parse($parser, $data, feof($fp))) {
                printf("XML error: %s at line %d while parsing entity %s\n",
                       xml_error_string(xml_get_error_code($parser)),
                       xml_get_current_line_number($parser), $openEntityNames);
                xml_parser_free($parser);
                return false;
            }
        }
        xml_parser_free($parser);
        return true;
    }
    return false;
}


function new_xml_parser($file) {
    global $parser_file;

    $xml_parser = xml_parser_create();
    xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 1);
    xml_set_element_handler($xml_parser, "startElement", "endElement");
    xml_set_character_data_handler($xml_parser, "characterData");
    xml_set_processing_instruction_handler($xml_parser, "PIHandler");
    xml_set_default_handler($xml_parser, "defaultHandler");
    xml_set_external_entity_ref_handler($xml_parser, "externalEntityRefHandler");
    
    if (!($fp = @fopen($file, "r"))) {
        return false;
    }
    if (!is_array($parser_file)) {
        settype($parser_file, "array");
    }
    $parser_file[$xml_parser] = $file;
    return array($xml_parser, $fp);
}

if (!(list($xml_parser, $fp) = new_xml_parser($file))) {
    die("could not open XML input");
}

print "&lt;pre&gt;";
while ($data = fread($fp, 4096)) {
    if (!xml_parse($xml_parser, $data, feof($fp))) {
        die(sprintf("XML error: %s at line %d\n",
                    xml_error_string(xml_get_error_code($xml_parser)),
                    xml_get_current_line_number($xml_parser)));
    }
}
print "&lt;/pre&gt;";
print "parse complete\n";
xml_parser_free($xml_parser);

?&gt;
       </programlisting>
      </example>
     </para>
     <para id="example.xml-xmltest.xml">
      <example>
       <title>xmltest.xml</title>
       <programlisting role="xml">
&lt;?xml version='1.0'?&gt;
&lt;!DOCTYPE chapter SYSTEM "/just/a/test.dtd" [
&lt;!ENTITY plainEntity "FOO entity"&gt;
&lt;!ENTITY systemEntity SYSTEM "xmltest2.xml"&gt;
]&gt;
&lt;chapter&gt;
 &lt;TITLE&gt;Title &amp;plainEntity;&lt;/TITLE&gt;
 &lt;para&gt;
  &lt;informaltable&gt;
   &lt;tgroup cols="3"&gt;
    &lt;tbody&gt;
     &lt;row&gt;&lt;entry&gt;a1&lt;/entry&gt;&lt;entry 
morerows="1"&gt;b1&lt;/entry&gt;&lt;entry&gt;c1&lt;/entry&gt;&lt;/row&gt;
     &lt;row&gt;&lt;entry&gt;a2&lt;/entry&gt;&lt;entry&gt;c2&lt;/entry&gt;&lt;/row&gt;
     
&lt;row&gt;&lt;entry&gt;a3&lt;/entry&gt;&lt;entry&gt;b3&lt;/entry&gt;&lt;entry&gt;c3&lt;/entry&gt;&lt;/row&gt;
    &lt;/tbody&gt;
   &lt;/tgroup&gt;
  &lt;/informaltable&gt;
 &lt;/para&gt;
 &amp;systemEntity;
 &lt;sect1 id="about"&gt;
  &lt;title&gt;About this Document&lt;/title&gt;
  &lt;para&gt;
   &lt;!-- this is a comment --&gt;
   &lt;?php print 'Hi!  This is PHP version '.phpversion(); ?&gt;
  &lt;/para&gt;
 &lt;/sect1&gt;
&lt;/chapter&gt;
       </programlisting>
      </example>
     </para>
     <para id="example.xml-xmltest2.xml">
      This file is included from <filename>xmltest.xml</filename>:
      <example>
       <title>xmltest2.xml</title>
       <programlisting role="xml">
&lt;?xml version="1.0"?&gt;
&lt;!DOCTYPE foo [
&lt;!ENTITY testEnt "test entity"&gt;
]&gt;
&lt;foo&gt;
   &lt;element attrib="value"/&gt;
   &amp;testEnt;
   &lt;?php print "This is some more PHP code being executed."; ?&gt;
&lt;/foo&gt;
       </programlisting>
      </example>
     </para>
    </sect2>
   </sect1>
  </partintro>

  <refentry id="function.xml-parser-create">
   <refnamediv>
    <refname>xml_parser_create</refname>
    <refpurpose>create an XML parser</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>xml_parser_create</function></funcdef>
      <paramdef>string 
       <parameter><optional>encoding</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <variablelist>
      <varlistentry>
       <term><parameter>encoding</parameter> (optional)</term>
       <listitem>
    <para>
     Which character encoding the parser should use.  The
     following character encodings are supported:
     <simplelist>
      <member><literal>ISO-8859-1</literal> (default)</member>
      <member><literal>US-ASCII</literal></member>
      <member><literal>UTF-8</literal></member>
     </simplelist>
    </para>
       </listitem>
      </varlistentry>
     </variablelist>
     This function creates an XML parser and returns a handle for use
     by other XML functions.  Returns <literal>false</literal> on
     failure.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xml-set-object">
   <refnamediv>
    <refname>xml_set_object</refname>
    <refpurpose>Use XML Parser within an object</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>xml_set_object</function></funcdef>
      <paramdef>int <parameter>parser</parameter></paramdef>
      <paramdef>object <parameter>&amp;object</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function allows to use <parameter>parser</parameter> inside
     <parameter>object</parameter>. All callback functions could be
     set with <function>xml_set_element_handler</function> etc and
     assumed to be methods of <parameter>object</parameter>.
    </para>
    <programlisting role="php">
&lt;?php
class xml  {
var $parser;

function xml() {
    $this-&gt;parser = xml_parser_create();
    xml_set_object($this-&gt;parser,&amp;$this);
    xml_set_element_handler($this-&gt;parser,"tag_open","tag_close");
    xml_set_character_data_handler($this-&gt;parser,"cdata");
}

function parse($data) { 
    xml_parse($this-&gt;parser,$data);
}

function tag_open($parser,$tag,$attributes) { 
    var_dump($parser,$tag,$attributes); 
}

function cdata($parser,$cdata) { 
    var_dump($parser,$cdata);
}

function tag_close($parser,$tag) { 
    var_dump($parser,$tag); 
}

} // end of class xml

$xml_parser = new xml();
$xml_parser-&gt;parse("&lt;A ID=\"hallo\"&gt;PHP&lt;/A&gt;");
?&gt;
    </programlisting>
   </refsect1>
  </refentry>

  <refentry id="function.xml-set-element-handler">
   <refnamediv>
    <refname>xml_set_element_handler</refname>
    <refpurpose>set up start and end element handlers</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>xml_set_element_handler</function>
      </funcdef>
      <paramdef>int <parameter>parser</parameter></paramdef>
      <paramdef>string 
       <parameter>startElementHandler</parameter>
      </paramdef>
      <paramdef>string 
       <parameter>endElementHandler</parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets the element handler functions for the XML parser
     <parameter>parser</parameter>.
     <parameter>startElementHandler</parameter> and
     <parameter>endElementHandler</parameter> are strings containing
     the names of functions that must exist when
     <function>xml_parse</function> is called for
     <parameter>parser</parameter>.
    </para>
    <para>
     The function named by <parameter>startElementHandler</parameter>
     must accept three parameters:
     <funcsynopsis>
     <funcprototype>
       <funcdef><replaceable>startElementHandler</replaceable></funcdef>
       <paramdef>int <parameter>parser</parameter></paramdef>
       <paramdef>string <parameter>name</parameter></paramdef>
       <paramdef>array <parameter>attribs</parameter></paramdef>
     </funcprototype>
     </funcsynopsis>
     <variablelist>
      <varlistentry>
       <term><parameter>parser</parameter></term> 
       <listitem>
    <simpara>
     The first parameter, <replaceable>parser</replaceable>, is a
     reference to the XML parser calling the
     handler.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>name</parameter></term>
       <listitem>
    <simpara>
     The second parameter, <parameter>name</parameter>, contains
     the name of the element for which this handler is called.  If
     <link linkend="xml.case-folding">case-folding</link> is in
     effect for this parser, the element name will be in uppercase
     letters.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>attribs</parameter></term>
       <listitem>
    <simpara>
     The third parameter, <parameter>attribs</parameter>, contains
     an associative array with the element's attributes (if any).
     The keys of this array are the attribute names, the values
     are the attribute values.  Attribute names are <link
     linkend="xml.case-folding">case-folded</link> on the same
     criteria as element names.  Attribute values are
     <emphasis>not</emphasis> case-folded.
    </simpara>
    <simpara>
     The original order of the attributes can be retrieved by
     walking through <parameter>attribs</parameter> the normal
     way, using <function>each</function>.  The first key in the
     array was the first attribute, and so on.
    </simpara>
       </listitem>
      </varlistentry>
     </variablelist>
    </para>
    <para>
     The function named by <parameter>endElementHandler</parameter>
     must accept two parameters:
     <funcsynopsis>
     <funcprototype>
       <funcdef><replaceable>endElementHandler</replaceable></funcdef>
       <paramdef>int <parameter>parser</parameter></paramdef>
       <paramdef>string <parameter>name</parameter></paramdef>
     </funcprototype>
     </funcsynopsis>
     <variablelist>
      <varlistentry>
       <term><parameter>parser</parameter></term> 
       <listitem>
    <simpara>
     The first parameter, <replaceable>parser</replaceable>, is a
     reference to the XML parser calling the
     handler.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>name</parameter></term>
       <listitem>
    <simpara>
     The second parameter, <parameter>name</parameter>, contains
     the name of the element for which this handler is called.  If
     <link linkend="xml.case-folding">case-folding</link> is in
     effect for this parser, the element name will be in uppercase
     letters.
    </simpara>
       </listitem>
      </varlistentry>
     </variablelist>
    </para>
    <para>
     If a handler function is set to an empty string, or
     <literal>false</literal>, the handler in question is disabled.
    </para>
    <para>
     True is returned if the handlers are set up, false if
     <parameter>parser</parameter> is not a parser.
    </para>
    <para>
     There is currently no support for object/method handlers.  See
     <function>xml_set_object</function> for using the XML parser
     within an object.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xml-set-character-data-handler">
   <refnamediv>
    <refname>xml_set_character_data_handler</refname>
    <refpurpose>set up character data handler</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>xml_set_character_data_handler</function>
      </funcdef>
      <paramdef>int <parameter>parser</parameter></paramdef>
      <paramdef>string <parameter>handler</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets the character data handler function for the XML parser
     <parameter>parser</parameter>.  <parameter>handler</parameter> is
     a string containing the name of a function that must exist when
     <function>xml_parse</function> is called for
     <parameter>parser</parameter>.</para>
    <para>
     The function named by <parameter>handler</parameter> must accept
     two parameters:
     <funcsynopsis>
     <funcprototype>
       <funcdef><replaceable>handler</replaceable></funcdef>
       <paramdef>int <parameter>parser</parameter></paramdef>
       <paramdef>string <parameter>data</parameter></paramdef>
     </funcprototype>
     </funcsynopsis>
     <variablelist>
      <varlistentry>
       <term><parameter>parser</parameter></term>
       <listitem>
    <simpara>
     The first parameter, <replaceable>parser</replaceable>, is a
     reference to the XML parser calling the handler.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>data</parameter></term>
       <listitem>
    <simpara>
     The second parameter, <parameter>data</parameter>, contains
     the character data as a string.
    </simpara>
       </listitem>
      </varlistentry>
     </variablelist></para>
    <para>
     If a handler function is set to an empty string, or
     <literal>false</literal>, the handler in question is
     disabled.
    </para>
    <para>
     True is returned if the handler is set up, false if
     <parameter>parser</parameter> is not a parser.
    </para>
    <para>
     There is currently no support for object/method handlers.  See
     <function>xml_set_object</function> for using the XML parser
     within an object.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xml-set-processing-instruction-handler">
   <refnamediv>
    <refname>xml_set_processing_instruction_handler</refname>
    <refpurpose>
     Set up processing instruction (PI) handler
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>xml_set_processing_instruction_handler</function>
      </funcdef>
      <paramdef>int <parameter>parser</parameter></paramdef>
      <paramdef>string <parameter>handler</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets the processing instruction (PI) handler function for the XML
     parser <parameter>parser</parameter>.
     <parameter>handler</parameter> is a string containing the name of
     a function that must exist when <function>xml_parse</function> is
     called for <parameter>parser</parameter>.
    </para>
    <para>
     A processing instruction has the following format:
     <informalexample>
      <programlisting>&lt;?
       <replaceable>target</replaceable> 
       <replaceable>data</replaceable>?>
      </programlisting>
     </informalexample>
     You can put PHP code into such a tag, but be aware of one
     limitation: in an XML PI, the PI end tag
     (<literal>?&gt;</literal>) can not be quoted, so this character
     sequence should not appear in the PHP code you embed with PIs in
     XML documents.  If it does, the rest of the PHP code, as well as
     the "real" PI end tag, will be treated as character data.
    </para>
    <para>
     The function named by <parameter>handler</parameter> must accept
     three parameters:
     <funcsynopsis>
     <funcprototype>
       <funcdef><replaceable>handler</replaceable></funcdef>
       <paramdef>int <parameter>parser</parameter></paramdef>
       <paramdef>string <parameter>target</parameter></paramdef>
       <paramdef>string <parameter>data</parameter></paramdef>
     </funcprototype>
     </funcsynopsis>
     <variablelist>
      <varlistentry>
       <term><parameter>parser</parameter></term> <listitem><simpara>
       The first parameter, <replaceable>parser</replaceable>, is a
       reference to the XML parser calling the
       handler.</simpara></listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>target</parameter></term>
       <listitem><simpara>
     The second parameter, <parameter>target</parameter>, contains
     the PI target.</simpara></listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>data</parameter></term>
       <listitem><simpara>
     The third parameter, <parameter>data</parameter>, contains
     the PI data.</simpara></listitem>
      </varlistentry>
     </variablelist></para>
    <para>
     If a handler function is set to an empty string, or
     <literal>false</literal>, the handler in question is disabled.
    </para>
    <para>
     True is returned if the handler is set up, false if
     <parameter>parser</parameter> is not a parser.
    </para>
    <para>
     There is currently no support for object/method handlers.  See
     <function>xml_set_object</function> for using the XML parser
     within an object.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xml-set-default-handler">
   <refnamediv>
    <refname>xml_set_default_handler</refname>
    <refpurpose>set up default handler</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>xml_set_default_handler</function>
      </funcdef>
      <paramdef>int <parameter>parser</parameter></paramdef>
      <paramdef>string <parameter>handler</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets the default handler function for the XML parser
     <parameter>parser</parameter>.  <parameter>handler</parameter> is
     a string containing the name of a function that must exist when
     <function>xml_parse</function> is called for
     <parameter>parser</parameter>.</para>
    <para>
     The function named by <parameter>handler</parameter> must accept
     two parameters:
     <funcsynopsis>
     <funcprototype>
       <funcdef><replaceable>handler</replaceable></funcdef>
       <paramdef>int <parameter>parser</parameter></paramdef>
       <paramdef>string <parameter>data</parameter></paramdef>
     </funcprototype>
     </funcsynopsis>
     <variablelist>
      <varlistentry>
       <term>
    <parameter>parser</parameter>
       </term> 
       <listitem>
    <simpara>
     The first parameter, <replaceable>parser</replaceable>, is a
     reference to the XML parser calling the
     handler.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term>
    <parameter>data</parameter>
       </term>
       <listitem>
    <simpara>
     The second parameter, <parameter>data</parameter>, contains
     the character data.  This may be the XML declaration,
     document type declaration, entities or other data for which
     no other handler exists.
    </simpara>
       </listitem>
      </varlistentry>
     </variablelist>
    </para>
    <para>
     If a handler function is set to an empty string, or
     <literal>false</literal>, the handler in question is disabled.
    </para>
    <para>
     True is returned if the handler is set up, false if
     <parameter>parser</parameter> is not a parser.
    </para>
    <para>
     There is currently no support for object/method handlers.  See
     <function>xml_set_object</function> for using the XML parser
     within an object.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xml-set-unparsed-entity-decl-handler">
   <refnamediv>
    <refname>xml_set_unparsed_entity_decl_handler</refname>
    <refpurpose>
     Set up unparsed entity declaration handler
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>xml_set_unparsed_entity_decl_handler</function>
      </funcdef>
      <paramdef>int <parameter>parser</parameter></paramdef>
      <paramdef>string <parameter>handler</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets the unparsed entity declaration handler function for the XML
     parser <parameter>parser</parameter>.
     <parameter>handler</parameter> is a string containing the name of
     a function that must exist when <function>xml_parse</function> is
     called for <parameter>parser</parameter>.</para>
    <para>
     This handler will be called if the XML parser encounters an
     external entity declaration with an NDATA declaration, like the
     following:
     <programlisting role="xml">
&lt;!ENTITY <parameter>name</parameter> {<parameter>publicId</parameter> | 
<parameter>systemId</parameter>} 
        NDATA <parameter>notationName</parameter>&gt;
     </programlisting>
    </para>
    <para>
     See <ulink url="&url.rec-xml;#sec-external-ent">section 4.2.2 of
     the XML 1.0 spec</ulink> for the definition of notation declared
     external entities.
    </para> 
    <para> The function named by
     <parameter>handler</parameter> must accept six parameters:
     <funcsynopsis>
     <funcprototype>
       <funcdef><replaceable>handler</replaceable></funcdef>
       <paramdef>int <parameter>parser</parameter></paramdef>
       <paramdef>string <parameter>entityName</parameter></paramdef>
       <paramdef>string <parameter>base</parameter></paramdef>
       <paramdef>string <parameter>systemId</parameter></paramdef>
       <paramdef>string <parameter>publicId</parameter></paramdef>
       <paramdef>string <parameter>notationName</parameter></paramdef>
     </funcprototype>
     </funcsynopsis>
     <variablelist>
      <varlistentry>
       <term><parameter>parser</parameter></term>
       <listitem>
    <simpara>
     The first parameter, <replaceable>parser</replaceable>, is a
     reference to the XML parser calling the
     handler.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>entityName</parameter></term>
       <listitem>
    <simpara>
     The name of the entity that is about to be defined.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>base</parameter></term>
       <listitem><simpara>
     This is the base for resolving the system identifier
     (<parameter>systemId</parameter>) of the external
     entity.  Currently this parameter will always be set to
     an empty string.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>systemId</parameter></term>
       <listitem>
    <simpara>
     System identifier for the external entity.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>publicId</parameter></term>
       <listitem>
    <simpara> 
     Public identifier for the external entity.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>notationName</parameter></term>
       <listitem>
    <simpara> 
     Name of the notation of this entity (see
     <function>xml_set_notation_decl_handler</function>).
    </simpara>
       </listitem>
      </varlistentry>
     </variablelist></para>
    <para>
     If a handler function is set to an empty string, or
     <literal>false</literal>, the handler in question is disabled.
    </para>
    <para>
     True is returned if the handler is set up, false if
     <parameter>parser</parameter> is not a parser.
    </para>
    <para>
     There is currently no support for object/method handlers.  See
     <function>xml_set_object</function> for using the XML parser
     within an object.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xml-set-notation-decl-handler">
   <refnamediv>
    <refname>xml_set_notation_decl_handler</refname>
    <refpurpose>set up notation declaration handler</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>xml_set_notation_decl_handler</function>
      </funcdef>
      <paramdef>int <parameter>parser</parameter></paramdef>
      <paramdef>string <parameter>handler</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets the notation declaration handler function for the XML parser
     <parameter>parser</parameter>.  <parameter>handler</parameter> is
     a string containing the name of a function that must exist when
     <function>xml_parse</function> is called for
     <parameter>parser</parameter>.
    </para>
    <para>
     A notation declaration is part of the document's DTD and has the
     following format: <programlisting role="xml">&lt;!NOTATION
     <parameter>name</parameter> {<parameter>systemId</parameter> |
     <parameter>publicId</parameter>}&gt;</programlisting> See <ulink
     url="&url.rec-xml;#Notations">section 4.7 of the XML 1.0
     spec</ulink> for the definition of notation declarations.
    </para>
    <para>
     The function named by <parameter>handler</parameter> must accept
     five parameters:
     <funcsynopsis>
     <funcprototype>
       <funcdef><replaceable>handler</replaceable></funcdef>
       <paramdef>int <parameter>parser</parameter></paramdef>
       <paramdef>string <parameter>notationName</parameter></paramdef>
       <paramdef>string <parameter>base</parameter></paramdef>
       <paramdef>string <parameter>systemId</parameter></paramdef>
       <paramdef>string <parameter>publicId</parameter></paramdef>
     </funcprototype>
     </funcsynopsis>
     <variablelist>
      <varlistentry>
       <term>
    <parameter>parser</parameter>
       </term> 
       <listitem>
    <simpara>
     The first parameter, <replaceable>parser</replaceable>, is a
     reference to the XML parser calling the
     handler.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>notationName</parameter></term>
       <listitem>
    <simpara>
     This is the notation's <parameter>name</parameter>, as per
     the notation format described above.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term>
    <parameter>base</parameter>
       </term>
       <listitem>
    <simpara>
     This is the base for resolving the system identifier
     (<parameter>systemId</parameter>) of the notation
     declaration.  Currently this parameter will always be set to
     an empty string.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>systemId</parameter></term>
       <listitem>
    <simpara>
     System identifier of the external notation
     declaration.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term>
    <parameter>publicId</parameter>
       </term>
       <listitem>
    <simpara>
     Public identifier of the external notation
     declaration.
    </simpara>
       </listitem>
      </varlistentry>
     </variablelist>
    </para>
    <para>
     If a handler function is set to an empty string, or
     <literal>false</literal>, the handler in question is
     disabled.
    </para>
    <para>
     True is returned if the handler is set up, false if
     <parameter>parser</parameter> is not a parser.
    </para>
    <para>
     There is currently no support for object/method handlers.  See
     <function>xml_set_object</function> for using the XML parser
     within an object.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xml-set-external-entity-ref-handler">
   <refnamediv>
    <refname>xml_set_external_entity_ref_handler</refname>
    <refpurpose>set up external entity reference handler</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>xml_set_external_entity_ref_handler</function>
      </funcdef>
      <paramdef>int <parameter>parser</parameter></paramdef>
      <paramdef>string <parameter>handler</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets the notation declaration handler function for the XML parser
     <parameter>parser</parameter>.  <parameter>handler</parameter> is
     a string containing the name of a function that must exist when
     <function>xml_parse</function> is called for
     <parameter>parser</parameter>.
    </para>
    <para>
     The function named by <parameter>handler</parameter> must accept
     five parameters, and should return an integer value.  If the
     value returned from the handler is false (which it will be if no
     value is returned), the XML parser will stop parsing and
     <function>xml_get_error_code</function> will return <systemitem
     class="constant">XML_ERROR_EXTERNAL_ENTITY_HANDLING</systemitem>.
     <funcsynopsis>
     <funcprototype>
       <funcdef>int <replaceable>handler</replaceable></funcdef>
       <paramdef>int <parameter>parser</parameter></paramdef>
       <paramdef>string
        <parameter>openEntityNames</parameter>
       </paramdef>
       <paramdef>string <parameter>base</parameter></paramdef>
       <paramdef>string <parameter>systemId</parameter></paramdef>
       <paramdef>string <parameter>publicId</parameter></paramdef>
     </funcprototype>
     </funcsynopsis>
     <variablelist>
      <varlistentry>
       <term><parameter>parser</parameter></term>
       <listitem>
    <simpara>
     The first parameter, <replaceable>parser</replaceable>, is a
     reference to the XML parser calling the handler.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>openEntityNames</parameter></term>
       <listitem>
    <simpara>
     The second parameter, <parameter>openEntityNames</parameter>,
     is a space-separated list of the names of the entities that
     are open for the parse of this entity (including the name of
     the referenced entity).
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>base</parameter></term>
       <listitem>
    <simpara>
     This is the base for resolving the system identifier
     (<parameter>systemid</parameter>) of the external entity.
     Currently this parameter will always be set to an empty
     string.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>systemId</parameter></term>
       <listitem>
    <simpara>
     The fourth parameter, <parameter>systemId</parameter>, is the
     system identifier as specified in the entity declaration.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>publicId</parameter></term>
       <listitem>
    <simpara>
     The fifth parameter, <parameter>publicId</parameter>, is the
     public identifier as specified in the entity declaration, or
     an empty string if none was specified; the whitespace in the
     public identifier will have been normalized as required by
     the XML spec.
    </simpara>
       </listitem>
      </varlistentry>
     </variablelist>
    </para>
    <para>
     If a handler function is set to an empty string, or
     <literal>false</literal>, the handler in question is
     disabled.
    </para>
    <para>
     True is returned if the handler is set up, false if
     <parameter>parser</parameter> is not a parser.
    </para>
    <para>
     There is currently no support for object/method handlers.  See
     <function>xml_set_object</function> for using the XML parser
     within an object.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xml-parse">
   <refnamediv>
    <refname>xml_parse</refname>
    <refpurpose>start parsing an XML document</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>xml_parse</function></funcdef>
      <paramdef>int <parameter>parser</parameter></paramdef>
      <paramdef>string <parameter>data</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>isFinal</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <variablelist>
      <varlistentry>
       <term><parameter>parser</parameter></term>
       <listitem>
    <simpara>
     A reference to the XML parser to use.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>data</parameter></term>
       <listitem>
    <simpara>
     Chunk of data to parse.  A document may be parsed piece-wise
     by calling <function>xml_parse</function> several times with
     new data, as long as the <parameter>isFinal</parameter>
     parameter is set and true when the last data is parsed.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>isFinal</parameter> (optional)</term>
       <listitem>
    <simpara>
     If set and true, <parameter>data</parameter> is the last
     piece of data sent in this parse.
    </simpara>
       </listitem>
      </varlistentry>
     </variablelist>
    </para>
    <para>
     When the XML document is parsed, the handlers for the configured
     events are called as many times as necessary, after which this
     function returns true or false.
    </para>
    <para>
     True is returned if the parse was successful, false if it was not
     successful, or if <parameter>parser</parameter> does not refer to
     a valid parser.  For unsuccessful parses, error information can
     be retrieved with <function>xml_get_error_code</function>,
     <function>xml_error_string</function>,
     <function>xml_get_current_line_number</function>,
     <function>xml_get_current_column_number</function> and
     <function>xml_get_current_byte_index</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xml-get-error-code">
   <refnamediv>
    <refname>xml_get_error_code</refname>
    <refpurpose>get XML parser error code</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>xml_get_error_code</function></funcdef>
      <paramdef>int <parameter>parser</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <variablelist>
      <varlistentry>
       <term><parameter>parser</parameter></term>
       <listitem>
    <simpara>
     A reference to the XML parser to get error code from.
    </simpara>
       </listitem>
      </varlistentry>
     </variablelist>
    </para>
    <para>
     This function returns false if <parameter>parser</parameter> does
     not refer to a valid parser, or else it returns one of the error
     codes listed in the <link linkend="xml.error-codes">error codes
     section</link>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xml-error-string">
   <refnamediv>
    <refname>xml_error_string</refname>
    <refpurpose>get XML parser error string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>xml_error_string</function></funcdef>
      <paramdef>int <parameter>code</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <variablelist>
      <varlistentry>
       <term><parameter>code</parameter></term>
       <listitem>
    <simpara>
     An error code from <function>xml_get_error_code</function>.
    </simpara>
       </listitem>
      </varlistentry>
     </variablelist>
    </para>
    <para>
     Returns a string with a textual description of the error code
     <parameter>code</parameter>, or false if no description was found.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xml-get-current-line-number">
   <refnamediv>
    <refname>xml_get_current_line_number</refname>
    <refpurpose>get current line number for an XML parser</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>xml_get_current_line_number</function>
      </funcdef>
      <paramdef>int <parameter>parser</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <variablelist>
      <varlistentry>
       <term><parameter>parser</parameter></term>
       <listitem>
    <simpara>
     A reference to the XML parser to get line number from.
    </simpara>
       </listitem>
      </varlistentry>
     </variablelist>
    </para>
    <para>
     This function returns false if <parameter>parser</parameter> does
     not refer to a valid parser, or else it returns which line the
     parser is currently at in its data buffer.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xml-get-current-column-number">
   <refnamediv>
    <refname>xml_get_current_column_number</refname> 
    <refpurpose>
     Get current column number for an XML parser
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>xml_get_current_column_number</function>
      </funcdef>
      <paramdef>int <parameter>parser</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <variablelist>
      <varlistentry>
       <term><parameter>parser</parameter></term>
       <listitem>
    <simpara>
     A reference to the XML parser to get column number from.
    </simpara>
       </listitem>
      </varlistentry>
     </variablelist>
    </para>
    <para>
     This function returns false if <parameter>parser</parameter> does
     not refer to a valid parser, or else it returns which column on
     the current line (as given by
     <function>xml_get_current_line_number</function>) the parser is
     currently at.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xml-get-current-byte-index">
   <refnamediv>
    <refname>xml_get_current_byte_index</refname>
    <refpurpose>get current byte index for an XML parser</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int 
       <function>xml_get_current_byte_index</function>
      </funcdef>
      <paramdef>int <parameter>parser</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <variablelist>
      <varlistentry>
       <term><parameter>parser</parameter></term>
       <listitem>
    <simpara>
     A reference to the XML parser to get byte index from.
    </simpara>
       </listitem>
      </varlistentry>
     </variablelist>
    </para>
    <para>
     This function returns false if <parameter>parser</parameter> does
     not refer to a valid parser, or else it returns which byte index
     the parser is currently at in its data buffer (starting at 0).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xml-parse-into-struct">
   <refnamediv>
    <refname>xml_parse_into_struct</refname>
    <refpurpose>Parse XML data into an array structure</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>xml_parse_into_struct</function></funcdef>
      <paramdef>int <parameter>parser</parameter></paramdef>
      <paramdef>string <parameter>data</parameter></paramdef>
      <paramdef>array <parameter>&amp;values</parameter></paramdef>
      <paramdef>array <parameter>&amp;index</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function parses an XML file into 2 parallel array
     structures, one (<parameter>index</parameter>) containing pointers 
     to the location of the appropriate values in the
     <parameter>values</parameter> array. These last two parameters
     must be passed by reference.
    </para>
    <para>
     Below is an example that illustrates the internal structure of
     the arrays being generated by the function. We use a simple
     <literal>note</literal> tag embeded inside a
     <literal>para</literal> tag, and then we parse this an print out
     the structures generated:
     <informalexample>
      <programlisting>
$simple = &quot;&lt;para&gt;&lt;note&gt;simple note&lt;/note&gt;&lt;/para&gt;&quot;;
$p = xml_parser_create();
xml_parse_into_struct($p,$simple,$vals,$index);
xml_parser_free($p);
echo "Index array\n";
print_r($index);
echo "\nVals array\n";
print_r($vals);
      </programlisting>
     </informalexample>
     When we run that code, the output will be:
     <informalexample>
      <programlisting>
Index array
Array
(
    [PARA] =&gt; Array
        (
            [0] =&gt; 0
            [1] =&gt; 2
        )

    [NOTE] =&gt; Array
        (
            [0] =&gt; 1
        )

)

Vals array
Array
(
    [0] =&gt; Array
        (
            [tag] =&gt; PARA
            [type] =&gt; open
            [level] =&gt; 1
        )

    [1] =&gt; Array
        (
            [tag] =&gt; NOTE
            [type] =&gt; complete
            [level] =&gt; 2
            [value] =&gt; simple note
        )

    [2] =&gt; Array
        (
            [tag] =&gt; PARA
            [type] =&gt; close
            [level] =&gt; 1
        )

)
      </programlisting>
     </informalexample>
    </para>
    <para>
     Event-driven parsing (based on the expat library) can get
     complicated when you have an XML document that is complex.
     This function does not produce a DOM style object, but it
     generates structures amenable of being transversed in a tree
     fashion. Thus, we can create objects representing the data
     in the XML file easily. Let's consider the following XML file
     representing a small database of aminoacids information:
     <example>
      <title>moldb.xml - small database of molecular information</title>
      <programlisting>
&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;moldb&gt;

    &lt;molecule&gt;
        &lt;name&gt;Alanine&lt;/name&gt;
        &lt;symbol&gt;ala&lt;/symbol&gt;
        &lt;code&gt;A&lt;/code&gt;
        &lt;type&gt;hydrophobic&lt;/type&gt;
    &lt;/molecule&gt;

    &lt;molecule&gt;
        &lt;name&gt;Lysine&lt;/name&gt;
        &lt;symbol&gt;lys&lt;/symbol&gt;
        &lt;code&gt;K&lt;/code&gt;
        &lt;type&gt;charged&lt;/type&gt;
    &lt;/molecule&gt;

&lt;/moldb&gt;
      </programlisting>
     </example>
      And some code to parse the document and generate the appropriate
      objects:
      <example>
      <title>
       parsemoldb.php - parses moldb.xml into and array of
       molecular objects
      </title>
      <programlisting role="php">
&lt;?php

class AminoAcid {
    var $name;  // aa name
    var $symbol;    // three letter symbol
    var $code;  // one letter code
    var $type;  // hydrophobic, charged or neutral
    
    function AminoAcid ($aa) {
        foreach ($aa as $k=&gt;$v)
            $this-&gt;$k = $aa[$k];
    }
}

function readDatabase($filename) {
    // read the xml database of aminoacids
    $data = implode(&quot;&quot;,file($filename));
    $parser = xml_parser_create();
    xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
    xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1);
    xml_parse_into_struct($parser,$data,$values,$tags);
    xml_parser_free($parser);

    // loop through the structures
    foreach ($tags as $key=&gt;$val) {
        if ($key == &quot;molecule&quot;) {
            $molranges = $val;
            // each contiguous pair of array entries are the 
            // lower and upper range for each molecule definition
            for ($i=0; $i &lt; count($molranges); $i+=2) {
                    $offset = $molranges[$i] + 1;
                $len = $molranges[$i + 1] - $offset;
                $tdb[] = parseMol(array_slice($values, $offset, $len));
            }
        } else {
            continue;
        }
    }
    return $tdb;
}

function parseMol($mvalues) {
    for ($i=0; $i &lt; count($mvalues); $i++)
        $mol[$mvalues[$i][&quot;tag&quot;]] = $mvalues[$i][&quot;value&quot;];
    return new AminoAcid($mol);
}

$db = readDatabase(&quot;moldb.xml&quot;);
echo "** Database of AminoAcid objects:\n";
print_r($db);

?&gt;
      </programlisting>
      </example>
      After executing <filename>parsemoldb.php</filename>, the variable
      <varname>$db</varname> contains an array of
      <classname>AminoAcid</classname> objects, and the output of the
      script confirms that:
      <informalexample>
       <programlisting>
** Database of AminoAcid objects:
Array
(
    [0] =&gt; aminoacid Object
        (
            [name] =&gt; Alanine
            [symbol] =&gt; ala
            [code] =&gt; A
            [type] =&gt; hydrophobic
        )

    [1] =&gt; aminoacid Object
        (
            [name] =&gt; Lysine
            [symbol] =&gt; lys
            [code] =&gt; K
            [type] =&gt; charged
        )

)
       </programlisting>
      </informalexample>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xml-parser-free">
   <refnamediv>
    <refname>xml_parser_free</refname>
    <refpurpose>Free an XML parser</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>xml_parser_free</function></funcdef>
      <paramdef>int <parameter>parser</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <variablelist>
      <varlistentry>
       <term><parameter>parser</parameter></term>
       <listitem>
    <simpara>
     A reference to the XML parser to free.
    </simpara>
       </listitem>
      </varlistentry>
     </variablelist></para>
    <para>
     This function returns false if <parameter>parser</parameter> does
     not refer to a valid parser, or else it frees the parser and
     returns true.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xml-parser-set-option">
   <refnamediv>
    <refname>xml_parser_set_option</refname>
    <refpurpose>set options in an XML parser</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>xml_parser_set_option</function></funcdef>
      <paramdef>int <parameter>parser</parameter></paramdef>
      <paramdef>int <parameter>option</parameter></paramdef>
      <paramdef>mixed <parameter>value</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <variablelist>
      <varlistentry>
       <term><parameter>parser</parameter></term>
       <listitem>
    <simpara>
     A reference to the XML parser to set an option in.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>option</parameter></term>
       <listitem>
    <simpara>
     Which option to set.  See below.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>value</parameter></term>
       <listitem>
    <simpara>
     The option's new value.
    </simpara>
       </listitem>
      </varlistentry>
     </variablelist>
    </para>
    <para>
     This function returns false if <parameter>parser</parameter> does
     not refer to a valid parser, or if the option could not be set.
     Else the option is set and true is returned.
    </para>
    <para>
     The following options are available:
     <table>
      <title>XML parser options</title>
      <tgroup cols="3">
       <thead>
    <row>
     <entry>Option constant</entry>
     <entry>Data type</entry>
     <entry>Description</entry>
    </row>
       </thead>
       <tbody>
    <row>
     <entry>XML_OPTION_CASE_FOLDING</entry>
     <entry>integer</entry>
     <entry>
      Controls whether <link
      linkend="xml.case-folding">case-folding</link> is enabled
      for this XML parser.  Enabled by default.
     </entry>
    </row>
    <row>
     <entry>XML_OPTION_TARGET_ENCODING</entry>
     <entry>string</entry> 
     <entry>
      Sets which <link linkend="xml.encoding">target
      encoding</link> to use in this XML parser.  By default, it
      is set to the same as the source encoding used by
      <function>xml_parser_create</function>.  Supported target
      encodings are <literal>ISO-8859-1</literal>,
      <literal>US-ASCII</literal> and <literal>UTF-8</literal>.
     </entry>
    </row>
       </tbody>
      </tgroup>
     </table>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xml-parser-get-option">
   <refnamediv>
    <refname>xml_parser_get_option</refname>
    <refpurpose>get options from an XML parser</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed
       <function>xml_parser_get_option</function>
      </funcdef>
      <paramdef>int <parameter>parser</parameter></paramdef>
      <paramdef>int <parameter>option</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <variablelist>
      <varlistentry>
       <term><parameter>parser</parameter></term>
       <listitem>
    <simpara>
     A reference to the XML parser to get an option
     from.
    </simpara>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><parameter>option</parameter></term>
       <listitem>
    <simpara>
     Which option to fetch.  See
     <function>xml_parser_set_option</function> for a list of
     options.
    </simpara>
       </listitem>
      </varlistentry>
     </variablelist>
    </para>
    <para>
     This function returns false if <parameter>parser</parameter> does
     not refer to a valid parser, or if the option could not be set.
     Else the option's value is returned.
    </para>
    <para>
     See <function>xml_parser_set_option</function> for the list of
     options.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.utf8-decode">
   <refnamediv>
    <refname>utf8_decode</refname> 
    <refpurpose>
     Converts a string with ISO-8859-1 characters encoded with UTF-8
     to single-byte ISO-8859-1.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>utf8_decode</function></funcdef>
      <paramdef>string <parameter>data</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function decodes <parameter>data</parameter>, assumed to be
     <literal>UTF-8</literal> encoded, to <literal>ISO-8859-1</literal>.
    </para>
    <para>
     See <function>utf8_encode</function> for an explaination of UTF-8
     encoding.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.utf8-encode">
   <refnamediv>
    <refname>utf8_encode</refname>
    <refpurpose>encodes an ISO-8859-1 string to UTF-8</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>utf8_encode</function></funcdef>
      <paramdef>string <parameter>data</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function encodes the string <parameter>data</parameter> to
     <literal>UTF-8</literal>, and returns the encoded version.
     <literal>UTF-8</literal> is a standard mechanism used by
     <acronym>Unicode</acronym>for encoding <glossterm>wide
     character</glossterm> values into a byte stream.
     <literal>UTF-8</literal> is transparent to plain
     <abbrev>ASCII</abbrev> characters, is self-synchronized (meaning
     it is possible for a program to figure out where in the
     bytestream characters start) and can be used with normal string
     comparison functions for sorting and such.  PHP encodes
     <literal>UTF-8</literal> characters in up to four bytes, like
     this:
     <table>
      <title>UTF-8 encoding</title>
      <tgroup cols="3">
       <thead>
    <row>
     <entry>bytes</entry>
     <entry>bits</entry>
     <entry>representation</entry>
    </row>
       </thead>
       <tbody>
    <row>
     <entry>1</entry>
     <entry>7</entry>
     <entry>0bbbbbbb</entry>
    </row>
    <row>
     <entry>2</entry>
     <entry>11</entry>
     <entry>110bbbbb 10bbbbbb</entry>
    </row>
    <row>
     <entry>3</entry>
     <entry>16</entry>
     <entry>1110bbbb 10bbbbbb 10bbbbbb</entry>
    </row>
    <row>
     <entry>4</entry>
     <entry>21</entry>
     <entry>11110bbb 10bbbbbb 10bbbbbb 10bbbbbb</entry>
    </row>
       </tbody>
      </tgroup>
     </table>
     Each <replaceable>b</replaceable> represents a bit that can be
     used to store character data.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/xslt.xml
+++ phpdoc/kr/functions/xslt.xml
 <reference id="ref.xslt">
  <title>XSLT functions</title>
  <titleabbrev>XSLT</titleabbrev>

  <partintro>
   <sect1 id="xslt.partintro">
    <title>Introduction</title>

    <sect2 id="xslt.intro">
     <title>About XSLT and Sablotron</title>
     <para>
      XSLT (Extensible Stylesheet Language (XSL)
      Transformations) is a language for transforming XML
      documents into other XML documents.  It is a standard
      defined by The World Wide Web consortium (W3C). 
      Information about XSLT and related technologies can be
      found at <ulink url="&url.xslt;">&url.xslt;</ulink>.
     </para>
    </sect2>

    <sect2 id="xslt.install">
     <title>Installation</title>
     <para>
      This extension uses <productname>Sabloton</productname>
      and <productname>expat</productname>, which can both be
      found at <ulink
      url="&url.sablotron;">&url.sablotron;</ulink>. Binaries
      are provided as well as source.
     </para>
     <para>
      On UNIX, run <command>configure</command> with the <option
      role="configure">--with-sablot</option>.  
      The <productname>Sablotron</productname> library
      should be installed somewhere your compiler can find it. 
     </para>
    </sect2>

    <sect2 id="xslt.about">
     <title>About This Extension</title>
     <para>
      This PHP extension implements support
      <productname>Sablotron</productname> from Ginger Alliance
      in PHP. This toolkit lets you transform 
      XML documents into other documents, including new XML
      documents, but also into HTML or other target formats. It
      basically provides a standardized and portable template
      mechanism, separating content and design of a website.
     </para>
    </sect2>

   </sect1>
  </partintro>

  <refentry id="function.xslt-closelog">
   <refnamediv>
    <refname>xslt_closelog</refname>
    <refpurpose>Clear the logfile for a given instance of Sablotron</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>xslt_closelog</function></funcdef>
      <paramdef>resource <parameter>xh</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <variablelist>
      <varlistentry>
       <term><parameter>xh</parameter></term>
       <listitem>
    <simpara>
     A reference to the XSLT parser.
    </simpara>
       </listitem>
      </varlistentry>
     </variablelist></para>
    <para>
     This function returns false if <parameter>parser</parameter> does
     not refer to a valid parser, or if the closing of the logfile
     fails. Otherwise it returns true.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xslt-create">
   <refnamediv>
    <refname>xslt_create</refname>
    <refpurpose>Create a new XSL processor.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>resource <function>xslt_create</function></funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns a handle for a new XSL processor. This handle
     is needed in all subsequent calls to XSL functions.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xslt-errno">
   <refnamediv>
    <refname>xslt_errno</refname>
    <refpurpose>Return the current error number</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>xslt_errno</function></funcdef>
       <paramdef>
        <parameter><optional>int xh</optional></parameter>
       </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Return the current error number of the given XSL processor. If
     no handle is given, the last error number that occured anywhere
     is returned.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xslt-error">
   <refnamediv>
    <refname>xslt_error</refname>
    <refpurpose>Return the current error string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>mixed <function>xslt_error</function></funcdef>
       <paramdef>
        <parameter><optional>int xh</optional></parameter>
       </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Return the current error string of the given XSL processor. If
     no handle is given, the last error string that occured anywhere
     is returned.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xslt-fetch-result">
   <refnamediv>
    <refname>xslt_fetch_result</refname>
    <refpurpose>Fetch a (named) result buffer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>xslt_fetch_result</function></funcdef>
       <paramdef>
        <parameter>int xh</parameter>
        <parameter><optional>string result_name</optional></parameter>
       </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Fetch a result buffer from the XSLT processor identified by
     the given handle. If no result name is given, the
     buffer named &quot;/_result&quot; is fetched.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xslt-free">
   <refnamediv>
    <refname>xslt_free</refname>
    <refpurpose>Free XSLT processor</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void <function>xslt_free</function></funcdef>
       <paramdef>
        <parameter>resource xh</parameter>
       </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Free the XSLT processor identified by the given handle.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xslt-openlog">
   <refnamediv>
    <refname>xslt_openlog</refname>
    <refpurpose>Set a logfile for XSLT processor messages</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>xslt_openlog</function></funcdef>
       <paramdef>
        <parameter>resource xh</parameter>
        <parameter>string logfile</parameter>
        <parameter><optional>int loglevel</optional></parameter>
       </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Set a logfile for the XSLT processor to place all of its error
     messages.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xslt-output-begintransform">
   <refnamediv>
    <refname>xslt_output_begintransform</refname>
    <refpurpose>Begin an XSLT transformation on the output</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void 
       <function>xslt_output_begintransform</function>
      </funcdef>
       <paramdef>
        <parameter>string xslt_filename</parameter>
       </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function will begin the output transformation on your data.
     From the point you call <function>xslt_output_begintransform</function>
     till the point you call <function>xslt_output_endtransform</function>
     all output will be transformed through the xslt stylesheet given by
     the first argument.
    </para>
    <para>
     <example>
      <title>
       Transforming output through an XSLT stylesheet, using the DOM-XML functions for 
xml generation
      </title>
      <programlisting role="php">
&lt;?php

$xsl_file = "article.xsl";
xslt_output_begintransform($xsl_file);

$doc = new_xmldoc('1.0');
$article = $doc->new_root('article');

$article->new_child('title', 'The History of South Tyrol');
$article->new_child('author', 'Sterling Hughes');
$article->new_child('body', 'Back after WWI, Italy gained South Tyrol from 
                             Austria.  Since that point nothing interesting has
                             happened');

echo $doc->dumpmem();

xslt_output_endtransform();
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xslt-output-endtransform">
   <refnamediv>
    <refname>xslt_output_endtransform</refname>
    <refpurpose>End an output transformation started with 
xslt_output_begintransform</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>void
       <function>xslt_output_endtransform</function>
      </funcdef>
      <void/>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>xslt_output_endtransform</function> ends the output transformation
     started by the <function>xslt_output_begintransform</function> function.  You 
must call
     this function in order to see the results of the output transformation.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xslt-process">
   <refnamediv>
    <refname>xslt_process</refname>
    <refpurpose>Transform XML data through a string containing XSL data</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool 
       <function>xslt_process</function>
      </funcdef>
       <paramdef>
        <parameter>string xsl_data</parameter>
        <parameter>string xml_data</parameter>
        <parameter>string result</parameter>
       </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>xslt_process</function> takes a string containing the XSLT 
stylesheet as
     its first argument, it takes a second string containing the XML data you want to 
     transform and then a third string containing the results of the transformation. 
     <function>xslt_process</function> will return true on success and false on 
failure,
     to get the error number and error string if an error occurs use the 
     <function>xslt_errno</function> and <function>xslt_error</function> functions.
    </para>
    <para>
     <example>
     <title>Using the <function>xslt_process</function> to transform three 
strings</title>
     <programlisting role="php">
&lt;?php

$xslData = '
&lt;xsl:stylesheet
  version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

&lt;xsl:template match="article">
    &lt;table border="1" cellpadding="2" cellspacing="1">
        &lt;tr>
            &lt;td width="20%">
             &nbsp;
            &lt;/title>
            &lt;td width="80%">
                &lt;h2>&lt;xsl:value-of select="title">&lt;/h2>
                &lt;h3>&lt;xsl:value-of select="author">&lt;/h3>
                &lt;br>
                
                &lt;xsl:value-of select="body">
            &lt;/td>
        &lt;/tr>
    &lt;/table>
&lt;/xsl:template>

&lt;/xsl:stylesheet>';

$xmlData = '
&lt;?xml version="1.0"?>
&lt;article>
    &lt;title>Learning German&lt;/title>
    &lt;author>Sterling Hughes&lt;/author>
    &lt;body>
      Essential phrases:
      &lt;br>
      &lt;br>
      Komme sie mir sagen, woe die toilette es?&lt;br>
      Eine grande beer bitte!&lt;br>
      Noch einem bitte.&lt;br>
    &lt;/body>
&lt;/article>';

if (xslt_process($xslData, $xmlData, $result))
{
    echo "Here is the brilliant in-depth article on learning";
    echo " German: ";
    echo "&lt;br>\n&lt;br>";
    echo $result;
}
else
{
    echo "There was an error that occurred in the XSL transformation...\n";
    echo "\tError number: " . xslt_errno() . "\n";
    echo "\tError string: " . xslt_error() . "\n";
    exit;
}
?>
      </programlisting>
     </example>
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xslt-run">
   <refnamediv>
    <refname>xslt_run</refname>
    <refpurpose>Apply a XSLT stylesheet to a file.</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>xslt_run</function></funcdef>
       <paramdef>
        <parameter>resource xh</parameter>
        <parameter>string xslt_file</parameter>
        <parameter>string xml_data_file</parameter>
        <parameter><optional>string result</optional></parameter>
        <parameter><optional>array xslt_params</optional></parameter>
        <parameter><optional>array xslt_args</optional></parameter>
       </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
      Process the xml_data_file by applying the xslt_file stylesheet to
      it. The stylesheet has access to xslt_params and the processor
      is started with xslt_args. The result of the XSLT transformation
      is placed in the named buffer (default is &quot;/_result&quot;).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xslt-set-sax-handler">
   <refnamediv>
    <refname>xslt_set_sax_handler</refname>
    <refpurpose>Set SAX handlers for a XSLT processor</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool <function>xslt_set_sax_handler</function></funcdef>
       <paramdef>
        <parameter>resource xh</parameter>
        <parameter>array handlers</parameter>
       </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Set SAX handlers on the resource handle given by xh.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.xslt-transform">
   <refnamediv>
    <refname>xslt_transform</refname>
    <refpurpose>Perform an XSLT transformation</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>bool
       <function>xslt_transform</function>
      </funcdef>
      <paramdef>
        <parameter>string xsl</parameter>
        <parameter>string xml</parameter>
        <parameter>string result</parameter>
        <parameter>string params</parameter>
        <parameter>string args</parameter>
        <parameter>string resultBuffer</parameter>
       </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The <function>xslt_transform</function> provides an interface to sablotron's
     more advanced features without requiring you to use the resource API.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/yaz.xml
+++ phpdoc/kr/functions/yaz.xml
 <reference id="ref.yaz">
  <title>YAZ functions</title>
  <titleabbrev>YAZ</titleabbrev>
  <partintro>
   <sect1 id="yaz.intro">
   <title>Introduction</title>
   <para>
    This extension offers a PHP interface to the
    <productname>YAZ</productname> toolkit that implements the Z39.50
    protocol for information retrieval. With this extension you can easily
    implement a Z39.50 origin (client) that searches Z39.50 targets
    (servers) in parallel.
   </para>
   <para>
    <productname>YAZ</productname> is available at <ulink
    url="&url.yaz;">&url.yaz;</ulink>. You can find news information,
    example scripts, etc. for this extension at <ulink
    url="&url.yaz-phpyaz;">&url.yaz-phpyaz;</ulink>.
   </para>
   <para>
    The module hides most of the complexity of Z39.50 so it should be
    fairly easy to use. It supports persistent stateless connections very
    similar to those offered by the various SQL APIs that are available
    for PHP. This means that sessions are stateless but shared amongst
    users, thus saving the connect and initialize phase steps in most cases.
   </para>
   </sect1>
   <sect1 id="yaz.install">
   <title>Installation</title>
   <para>
    Compile YAZ and install it. Build PHP with your favourite
    modules and add option --with-yaz. Your task is roughly the
    following:
   </para>
   <para>
   <informalexample>
    <programlisting>
gunzip -c yaz-1.6.tar.gz|tar xf -
gunzip -c php-4.0.X.tar.gz|tar xf -
cd yaz-1.6
/configure --prefix=/usr
make
make install
cd ../php-4.0.X
/configure --with-yaz=/usr/bin
make
make install
    </programlisting>
   </informalexample>
   </para>
   </sect1>
   <sect1 id="yaz.example">
   <title>Example</title>
   <para>
    PHP/YAZ keeps track of connections with targets
    (Z-Associations). A positive integer represents the ID of a
    particular association.
   </para>
   <para>
    The script below demonstrates the parallel searching feature of
    the API. When invoked with no arguments it prints a query form; else
    (arguments are supplied) it searches the targets as given in in array
    host.
   </para>
   <para>
   <example>
    <title><function>YAZ</function></title>
    <programlisting role="php">
$num_hosts = count ($host);
if (empty($term) || count($host) == 0) {
    echo '&lt;form method="get"&gt;
    &lt;input type="checkbox"
    name="host[]" value="bagel.indexdata.dk/gils"&gt;
        GILS test
    &lt;input type="checkbox"
    name="host[]" value="localhost:9999/Default"&gt;
        local test
    &lt;input type="checkbox" checked="1"
    name="host[]" value="z3950.bell-labs.com/books"&gt;
        BELL Labs Library
    &lt;br>
    RPN Query:
    &lt;input type="text" size="30" name="term"&gt;
    &lt;input type="submit" name="action" value="Search"&gt;
    ';        
} else {
    echo 'You searced for ' . htmlspecialchars($term) . '&lt;br&gt;';
    for ($i = 0; $i &lt; $num_hosts; $i++) {
        $id[] = yaz_connect($host[$i]);
        yaz_syntax($id[$i],"sutrs");
        yaz_search($id[$i],"rpn",$term);
    }
    yaz_wait();
    for ($i = 0; $i &lt; $num_hosts; $i++) {
        echo '&lt;hr&gt;' . $host[$i] . ":";
        $error = yaz_error($id[$i]);
        if (!empty($error)) {
            echo "Error: $error";
        } else {
            $hits = yaz_hits($id[$i]);
            echo "Result Count $hits";
        }
        echo '&lt;dl&gt;';
        for ($p = 1; $p &lt;= 10; $p++) {
            $rec = yaz_record($id[$i],$p,"string");
            if (empty($rec)) continue;
            echo "&lt;dt&gt;&lt;b&gt;$p&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;";
            echo ereg_replace("\n", "&lt;br&gt;\n",$rec);
            echo "&lt;/dd&gt;";
        }
        echo '&lt;/dl&gt;';
    }
}
    </programlisting>
   </example>
   </para>
   </sect1>
  </partintro>

  <refentry id="function.yaz-addinfo">
   <refnamediv>
    <refname>yaz_addinfo</refname>
    <refpurpose>Returns additional error information</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>yaz_addinfo</function></funcdef>
      <paramdef>int <parameter>id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns additional error message for target (last request). An
     empty string is returned if last operation was a success or if no
     additional information was provided by the target.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.yaz-close">
   <refnamediv>
    <refname>yaz_close</refname>
    <refpurpose>Closes a YAZ connection</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>yaz_close</function></funcdef>
      <paramdef>int <parameter>id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Closes a connection to a target. The application can no longer
     refer to the target with the given ID.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.yaz-connect">
   <refnamediv>
    <refname>yaz_connect</refname>
    <refpurpose>
     Returns a positive association ID on success; zero on failure
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>yaz_connect</function></funcdef>
      <paramdef>string <parameter>zurl</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Yaz_connect</function> prepares for a connection to a
     Z39.50 target. The zurl argument takes the form
     host[:port][/database]. If port is omitted 210 is used. If
     database is omitted Default is used. This function is
     non-blocking and doesn't attempt to establish a socket - it
     merely prepares a connect to be performed later when
     <function>yaz_wait</function> is called.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.yaz-errno">
   <refnamediv>
    <refname>yaz_errno</refname>
    <refpurpose>Returns error number</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>yaz_errno</function></funcdef>
      <paramdef>int <parameter>id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns error for target (last request). A positive value is
     returned if the target returned a diagnostic code; a value of
     zero is returned if no errors occurred (success); negative value
     is returned for other errors targets didn't indicate the error in
     question.
    </para>
    <para>
     <function>Yaz_errno</function> should be called after network
     activity for each target - (after <function>yaz_wait</function>
     returns) to determine the success or failure of the last
     operation (e.g. search).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.yaz-error">
   <refnamediv>
    <refname>yaz_error</refname>
    <refpurpose>Returns error description</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>yaz_error</function></funcdef>
      <paramdef>int <parameter>id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns error message for target (last request). An empty string
     is returned if last operation was a success.
    </para>
    <para>
     <function>Yaz_error</function> returns a english message
     corresponding to the last error number as returned by
     <function>yaz_errno</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.yaz-hits">
   <refnamediv>
    <refname>yaz_hits</refname>
    <refpurpose>Returns number of hits for last search</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>yaz_hits</function></funcdef>
      <paramdef>int <parameter>id</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Yaz_hits</function> returns number of hits for last
     search.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.yaz-range">
   <refnamediv>
    <refname>yaz_range</refname>
    <refpurpose>
     Specifies the maximum number of records to retrieve
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>yaz_range</function></funcdef>
      <paramdef>int <parameter>id</parameter></paramdef>
      <paramdef>int <parameter>start</parameter></paramdef>
      <paramdef>int <parameter>number</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function is used in conjunction with
     <function>yaz_search</function> to specify the maximum number of
     records to retrieve (number) and the first record position
     (start). If this function is not invoked (only
     <function>yaz_search</function>) start is set to 1 and number is
     set to 10.
    </para>
    <para>
     Returns true on success; false on error. 
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.yaz-record">
   <refnamediv>
    <refname>yaz_record</refname>
    <refpurpose>Returns a record</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>yaz_record</function></funcdef>
      <paramdef>int <parameter>id</parameter></paramdef>
      <paramdef>int <parameter>pos</parameter></paramdef>
      <paramdef>string <parameter>type</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns record at position or empty string if no record exists at
     given position.
    </para>
    <para>
     The <function>yaz_record</function> function inspects a record in
     the current result set at the position specified. If no database
     record exists at the given position an empty string is
     returned. The argument, type, specifies the form of the returned
     record. If type is "string" the record is returned in a string
     representation suitable for printing (for XML and SUTRS). If type
     is "array" the record is returned as an array representation (for
     structured records).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.yaz-search">
   <refnamediv>
    <refname>yaz_search</refname>
    <refpurpose>Prepares for a search</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>yaz_search</function></funcdef>
      <paramdef>int <parameter>id</parameter></paramdef>
      <paramdef>string <parameter>type</parameter></paramdef>
      <paramdef>string <parameter>query</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>yaz_search</function> prepares for a search on the
     target with given id. The type represents the query type - only
     "rpn" is supported now in which case the third argument specifies
     a Type-1 query (RPN). Like <function>yaz_connect</function> this
     function is non-blocking and only prepares for a search to be
     executed later when <function>yaz_wait</function> is called.
    </para>
   </refsect1>
   <refsect1>
    <title>The RPN query</title>
    <para>
     The RPN query is a textual represenation of the Type-1 query as
     defined by the Z39.50 standard. However, in the text representation
     as used by YAZ a prefix notation is used, that is the operater
     precedes the operands. The query string is a sequence of tokens where
     white space is ignored is ignored unless surrounded by double
     quotes. Tokens beginning with an at-character (<literal>@</literal>)
     are considered operators, otherwise they are treated as search terms.
    </para>
    <table>
     <title>RPN Operators</title>
     <tgroup cols="2">
      <thead>
        <row>
          <entry>Syntax</entry>
          <entry>Description</entry>
        </row>
      </thead>
      <tbody>
        <row>
         <entry><literal>@and query1 query2</literal></entry>
         <entry>intersection of query1 and query2</entry>
        </row>
        <row>
         <entry><literal>@or query1 query2</literal></entry>
         <entry>union of query1 and query2</entry>
        </row>
        <row>
         <entry><literal>@not query1 query2</literal></entry>
         <entry>query1 and not query2</entry>
        </row>
        <row>
         <entry><literal>@set name</literal></entry>
         <entry>result set reference</entry>
        </row>
        <row>
         <entry><literal>@attrset set query</literal></entry>
         <entry>specifies attribute-set for query. This construction is only
                allowed once - in the beginning of the whole query</entry>
        </row>
        <row>
          <entry><literal>@attr set type=value query</literal></entry>
          <entry>applies attribute to query. The type and value are
                 integers specifying the attribute-type and attribute-value
                 respectively. The set, if given, specifies the
                 attribute-set.</entry>
        </row>
      </tbody>
     </tgroup>
    </table>     
    <para>
     The following illustrates valid query constructions:
     <informalexample>
      <screen>computer</screen>
     </informalexample>
      Matches documents where "computer" occur. No attributes are specified.
    </para>
    <para>
     <informalexample>
      <screen>"donald knuth"</screen>
     </informalexample>
     Matches documents where "donald knuth" occur.
    </para>
    <para>
     <informalexample>
      <screen>@attr 1=4 art</screen>
     </informalexample>
     Attribute type is 1 (Bib-1 use), attribute value is 4
     Title), so this should match documents where "art" occur
     in the title.
    </para>
    <para>
     <informalexample>
<screen>@attrset gils @and @attr 1=4 art @attr 1=1003 "donald knuth"</screen>
     </informalexample>
     The query as a whole uses the GILS attributeset. The query matches
     documents where "art" occur in the title and in which "donald knuth"
     occur in the author.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.yaz-syntax">
   <refnamediv>
    <refname>yaz_syntax</refname>
    <refpurpose>
     Specifies the object identifier (OID) for the preferred record syntax
     for retrieval.
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>yaz_syntax</function></funcdef>
      <paramdef>int <parameter>id</parameter></paramdef>
      <paramdef>string <parameter>syntax</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The syntax may be specified in a raw dot-notation (like
     <literal>1.2.840.10003.5.10</literal>) or as one of the known
     record syntaxes (sutrs, usmarc, grs1, xml, etc.).
     This function is used in conjunction with
     <function>yaz_search</function> to specify the preferred record
     syntax for retrieval.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.yaz-wait">
   <refnamediv>
    <refname>yaz_wait</refname>
    <refpurpose>Executes queries</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>yaz_wait</function></funcdef>
      <paramdef>int <parameter>id</parameter></paramdef>
      <paramdef>string <parameter>syntax</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function carries out networked (blocked) activity for
     outstanding requests which have been prepared by the functions
     <function>yaz_connect</function>,
     <function>yaz_search</function>.  <function>yaz_wait</function>
     returns when all targets have either completed all requests or
     otherwise completed (in case of errors).
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Index: phpdoc/kr/functions/zlib.xml
+++ phpdoc/kr/functions/zlib.xml
 <reference id="ref.zlib">
  <title>Zlib Compression Functions</title>
  <titleabbrev>Zlib</titleabbrev>
  <partintro>
  <para>
   This module uses the functions of <ulink
   url="&url.zlib;">zlib</ulink> by Jean-loup Gailly and Mark Adler to
   transparently read and write gzip (.gz) compressed files. You have
   to use a zlib version >= 1.0.9 with this module.
  </para>
  <para>
   This module contains versions of most of the <link
   linkend="ref.filesystem">filesystem</link> functions which work
   with gzip-compressed files (and uncompressed files, too, but not
   with sockets).
  </para>
  <note>
   <para>
    The current CVS version 4.0.4-dev introduces a fopen-wrapper
    for .gz-files, so that you can use a special 'zlib:' URL to
    access compressed files transparently using the normal 
    f*() file access functions if you prepend the filename or path
    with a 'zlib:' prefix when calling <function>fopen</function>.
   </para>
   <para>
    This feature requires a C runtime library that provides the
    <literal>fopencookie()</literal> function. To my current
    knowledge the GNU libc is the only library that provides
    this feature.
   </para>
  </note>

   <sect1 id="zlib-example">
    <title>Small code example</title>
    <para>
     Opens a temporary file and writes a test string to it, then it
     prints out the content of this file twice.
    </para>
    <example>
     <title>Small Zlib Example</title>
<programlisting role="php">
&lt;?php

$filename = tempnam ('/tmp', 'zlibtest').'.gz';
print "&lt;html>\n&lt;head>&lt;/head>\n&lt;body>\n&lt;pre>\n";
$s = "Only a test, test, test, test, test, test, test, test!\n";

// open file for writing with maximum compression
$zp = gzopen($filename, "w9");

// write string to file
gzwrite($zp, $s);

// close file
gzclose($zp);

// open file for reading
$zp = gzopen($filename, "r");

// read 3 char
print gzread($zp, 3);

// output until end of the file and close it.
gzpassthru($zp);

print "\n";

// open file and print content (the 2nd time).
if (readgzfile($filename) != strlen($s)) {
        echo "Error with zlib functions!";
}
unlink($filename);
print "&lt;/pre>\n&lt;/h1>&lt;/body>\n&lt;/html>\n";

?>
     </programlisting>
    </example>
   </sect1>
  </partintro>

  <refentry id="function.gzclose">
   <refnamediv>
    <refname>gzclose</refname>
    <refpurpose>Close an open gz-file pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gzclose</function></funcdef>
      <paramdef>int <parameter>zp</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     The gz-file pointed to by zp is closed.
    </para>
    <para>
     Returns true on success and false on failure.
    </para>
    <para>
     The gz-file pointer must be valid, and must point to a file
     successfully opened by <function>gzopen</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gzeof">
   <refnamediv>
    <refname>gzeof</refname>
    <refpurpose>Test for end-of-file on a gz-file pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gzeof</function></funcdef>
      <paramdef>int <parameter>zp</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns true if the gz-file pointer is at EOF or an error occurs;
     otherwise returns false.
    </para>
    <para>
     The gz-file pointer must be valid, and must point to a file
     successfully opened by <function>gzopen</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gzfile">
   <refnamediv>
    <refname>gzfile</refname> 
    <refpurpose>Read entire gz-file into an array</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>array <function>gzfile</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>use_include_path</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Identical to <function>readgzfile</function>, except that
     <function>gzfile</function> returns the file in an array.
    </para>
    <para>
     You can use the optional second parameter and set it to "1", if
     you want to search for the file in the <link
     linkend="ini.include-path">include_path</link>, too.
    </para>
    <para> 
     See also <function>readgzfile</function>, and
     <function>gzopen</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gzgetc">
   <refnamediv>
    <refname>gzgetc</refname>
    <refpurpose>Get character from gz-file pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>gzgetc</function></funcdef>
      <paramdef>int <parameter>zp</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a string containing a single (uncompressed) character
     read from the file pointed to by zp.  Returns FALSE on EOF (as
     does <function>gzeof</function>).
    </para>
    <para>
     The gz-file pointer must be valid, and must point to a file
     successfully opened by <function>gzopen</function>.
    </para>
    <para> 
     See also <function>gzopen</function>, and
     <function>gzgets</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gzgets">
   <refnamediv>
    <refname>gzgets</refname>
    <refpurpose>Get line from file pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>gzgets</function></funcdef>
      <paramdef>int <parameter>zp</parameter></paramdef>
      <paramdef>int <parameter>length</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns a (uncompressed) string of up to length - 1 bytes read
     from the file pointed to by fp. Reading ends when length - 1
     bytes have been read, on a newline, or on EOF (whichever comes
     first).
    </para>
    <para> 
     If an error occurs, returns false.
    </para>
    <para> 
     The file pointer must be valid, and must point to a file
     successfully opened by <function>gzopen</function>.
    </para>
    <para> 
     See also <function>gzopen</function>,
     <function>gzgetc</function>, and <function>fgets</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gzgetss">
   <refnamediv>
    <refname>gzgetss</refname>
    <refpurpose>
     Get line from gz-file pointer and strip HTML tags
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>gzgetss</function></funcdef>
      <paramdef>int <parameter>zp</parameter></paramdef>
      <paramdef>int <parameter>length</parameter></paramdef>
      <paramdef>string 
       <parameter><optional>allowable_tags</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Identical to <function>gzgets</function>, except that
     <function>gzgetss</function> attempts to strip any HTML and PHP
     tags from the text it reads.
    </para>
    <para>
     You can use the optional third parameter to specify tags which
     should not be stripped.
     <note>
      <para>
       <parameter>Allowable_tags</parameter> was added in PHP 3.0.13,
       PHP4B3.
      </para> 
     </note>
    </para>
    <para>
     See also <function>gzgets</function>,
     <function>gzopen</function>, and <function>strip_tags</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gzopen">
   <refnamediv>
    <refname>gzopen</refname>
    <refpurpose>Open gz-file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gzopen</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
      <paramdef>string <parameter>mode</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>use_include_path</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Opens a gzip (.gz) file for reading or writing. The mode
     parameter is as in <function>fopen</function> ("rb" or "wb") but
     can also include a compression level ("wb9") or a strategy: 'f'
     for filtered data as in "wb6f", 'h' for Huffman only compression
     as in "wb1h". (See the description of deflateInit2 in zlib.h for
     more information about the strategy parameter.)
    </para>
    <para>
     <function>Gzopen</function> can be used to read a file which is
     not in gzip format; in this case <function>gzread</function> will
     directly read from the file without decompression.
    </para>
    <para>
     <function>Gzopen</function> returns a file pointer to the file
     opened, after that, everything you read from this file descriptor
     will be transparently decompressed and what you write gets
     compressed.
    </para>
    <para>
     If the open fails, the function returns false.
    </para>
    <para>
     You can use the optional third parameter and set it to "1", if
     you want to search for the file in the <link
     linkend="ini.include-path">include_path</link>, too.
    </para>
    <para>
     <example>
      <title><function>Gzopen</function> Example</title>
      <programlisting role="php">
$fp = gzopen ("/tmp/file.gz", "r");
      </programlisting>
     </example>
    </para>
    <para>
     See also <function>gzclose</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gzpassthru">
   <refnamediv>
    <refname>gzpassthru</refname>
    <refpurpose>
     Output all remaining data on a gz-file pointer
    </refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gzpassthru</function></funcdef>
      <paramdef>int <parameter>zp</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Reads to EOF on the given gz-file pointer and writes the
     (uncompressed) results to standard output.
    </para>
    <para>
     If an error occurs, returns false.
    </para>
    <para>
     The file pointer must be valid, and must point to a file
     successfully opened by <function>gzopen</function>.
    </para>
    <para>
     The gz-file is closed when <function>gzpassthru</function> is
     done reading it (leaving <parameter>zp</parameter> useless).
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gzputs">
   <refnamediv>
    <refname>gzputs</refname>
    <refpurpose>Write to a gz-file pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gzputs</function></funcdef>
      <paramdef>int <parameter>zp</parameter></paramdef>
      <paramdef>string <parameter>str</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>length</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     <function>Gzputs</function> is an alias to
     <function>gzwrite</function>, and is identical in every way.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gzread">
   <refnamediv>
    <refname>gzread</refname>
    <refpurpose>Binary-safe gz-file read</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>gzread</function></funcdef>
      <paramdef>int <parameter>zp</parameter></paramdef>
      <paramdef>int <parameter>length</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>gzread</function> reads up to
     <parameter>length</parameter> bytes from the gz-file pointer
     referenced by <parameter>zp</parameter>. Reading stops when
     <parameter>length</parameter> (uncompressed) bytes have been read
     or EOF is reached, whichever comes first.
    </simpara>
    <para>
    <informalexample>
      <programlisting role="php">
// get contents of a gz-file into a string
$filename = "/usr/local/something.txt.gz";
$zd = gzopen ($filename, "r");
$contents = gzread ($zd, 10000);
gzclose ($zd);
      </programlisting>
     </informalexample>
    </para>
    <simpara>
     See also <function>gzwrite</function>, <function>gzopen</function>,
     <function>gzgets</function>, <function>gzgetss</function>,
     <function>gzfile</function>, and <function>gzpassthru</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.gzrewind">
   <refnamediv>
    <refname>gzrewind</refname>
    <refpurpose>Rewind the position of a gz-file pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gzrewind</function></funcdef>
      <paramdef>int <parameter>zp</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>    
     Sets the file position indicator for zp to the beginning of the
     file stream.
    </para> 
    <para> 
     If an error occurs, returns 0.
    </para>
    <para> 
     The file pointer must be valid, and must point to a file
     successfully opened by <function>gzopen</function>.
    </para>
    <para>
     See also <function>gzseek</function> and
     <function>gztell</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gzseek">
   <refnamediv>
    <refname>gzseek</refname>
    <refpurpose>Seek on a gz-file pointer</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gzseek</function></funcdef>
      <paramdef>int <parameter>zp</parameter></paramdef>
      <paramdef>int <parameter>offset</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Sets the file position indicator for the file referenced by zp to
     offset bytes into the file stream. Equivalent to calling (in C)
     <literal>gzseek( zp, offset, SEEK_SET )</literal>.
    </para>
    <para>
     If the file is opened for reading, this function is emulated but
     can be extremely slow. If the file is opened for writing, only
     forward seeks are supported; gzseek then compresses a sequence of
     zeroes up to the new starting position.
    </para>
    <para>
     Upon success, returns 0; otherwise, returns -1. Note that seeking
     past EOF is not considered an error.
    </para>
    <para>
     See also <function>gztell</function> and
     <function>gzrewind</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gztell">
   <refnamediv>
    <refname>gztell</refname>
    <refpurpose>Tell gz-file pointer read/write position</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gztell</function></funcdef>
      <paramdef>int <parameter>zp</parameter></paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     Returns the position of the file pointer referenced by
     <parameter>zp</parameter>; i.e., its offset into the file
     stream.
    </para>
    <para>
     If an error occurs, returns false.
    </para>
    <para>
     The file pointer must be valid, and must point to a file
     successfully opened by <function>gzopen</function>.
    </para>
    <para> 
     See also <function>gzopen</function>, <function>gzseek</function>
     and <function>gzrewind</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gzwrite">
   <refnamediv>
    <refname>gzwrite</refname>
    <refpurpose>Binary-safe gz-file write</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>gzwrite</function></funcdef>
      <paramdef>int <parameter>zp</parameter></paramdef>
      <paramdef>string <parameter>string</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>length</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <simpara>
     <function>Gzwrite</function> writes the contents of
     <parameter>string</parameter> to the gz-file stream pointed to by
     <parameter>zp</parameter>. If the <parameter>length</parameter>
     argument is given, writing will stop after
     <parameter>length</parameter> (uncompressed) bytes have been
     written or the end of <parameter>string</parameter> is reached,
     whichever comes first.
    </simpara>
    <simpara>
     Note that if the <parameter>length</parameter> argument is given,
     then the <link
     linkend="ini.magic-quotes-runtime">magic_quotes_runtime</link>
     configuration option will be ignored and no slashes will be
     stripped from <parameter>string</parameter>.
    </simpara>
    <simpara>
     See also <function>gzread</function>, <function>gzopen</function>,
     and <function>gzputs</function>.
    </simpara>
   </refsect1>
  </refentry>

  <refentry id="function.readgzfile">
   <refnamediv>
    <refname>readgzfile</refname>
    <refpurpose>Output a gz-file</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>int <function>readgzfile</function></funcdef>
      <paramdef>string <parameter>filename</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>use_include_path</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para> 
     Reads a file, decompresses it and writes it to standard
     output.
    </para>
    <para>
     <function>Readgzfile</function> can be used to read a file which
     is not in gzip format; in this case
     <function>readgzfile</function> will directly read from the file
     without decompression.
    </para>
    <para> 
     Returns the number of (uncompressed) bytes read from the file. If
     an error occurs, false is returned and unless the function was
     called as <literal>@readgzfile</literal>, an error message is
     printed.
    </para>
    <para> 
     The file <parameter>filename</parameter> will be opened from the
     filesystem and its contents written to standard output.
    </para>
    <para>
     You can use the optional second parameter and set it to "1", if
     you want to search for the file in the <link
     linkend="ini.include-path">include_path</link>, too.
    </para>
    <para>
     See also <function>gzpassthru</function>,
     <function>gzfile</function>, and <function>gzopen</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gzcompress">
   <refnamediv>
    <refname>gzcompress</refname>
    <refpurpose>Gz-compress a string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>gzcompress</function></funcdef>
      <paramdef>string <parameter>data</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>level</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>
     This function returns a gzip-compressed version of the input
     <parameter>data</parameter> or false on errors. The optional
     parameter <parameter>level</parameter> can be given as 0 for no
     compression up to 9 for maximum compression.
    </para>
    <para>
     See also <function>gzuncompress</function>.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.gzuncompress">
   <refnamediv>
    <refname>gzuncompress</refname>
    <refpurpose>Uncompress a gz-compressed string</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
    <funcsynopsis>
     <funcprototype>
      <funcdef>string <function>gzuncompress</function></funcdef>
      <paramdef>string <parameter>data</parameter></paramdef>
      <paramdef>int 
       <parameter><optional>length</optional></parameter>
      </paramdef>
     </funcprototype>
    </funcsynopsis>
    <para>                      
     This function takes <parameter>data</parameter> compressed by
     <function>gzcompress</function> and returns the orignial
     uncompressed data or false on error.  The function will return an
     error if the uncompressed data is more than 256 times the lenght
     of the compressed input <parameter>data</parameter> or more than
     the optional parameter <parameter>length</parameter>.
    </para>
    <para>
     See also <function>gzcompress</function>.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->

Reply via email to