Adding initial documentation for the new getopt() function.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@97526 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Jon Parise 2002-09-30 11:53:23 +00:00
parent 8377396845
commit 1a0124d88b

View file

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<refentry id="function.getopt">
<refnamediv>
<refname>getopt</refname>
<refpurpose>Gets options from the command line argument list</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>getopt</methodname>
<methodparam><type>string</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
Returns an associative array of option / argument pairs based on the
options format specified in <parameter>options</parameter>, or &false;
on an error.
<informalexample>
<programlisting>
<![CDATA[
$options = getopt("f:hp:"); // parse the command line ($_GLOBALS['argv'])
]]>
</programlisting>
</informalexample>
</para>
<para>
The <parameter>options</parameter> parameter may contain the following
elements: individual characters, and characters followed by a colon to
indicate an option argument is to follow. For example, an option string
<literal>x</literal> recognizes an option <literal>-x</literal>, and an
option string <literal>x:</literal> recognizes an option and argument
<literal>-x argument</literal>. It does not matter if an argument has
leading white space.
</para>
<para>
This function will return an array of option / argument pairs. If an
option does not have an argument, the value will be set to &null;.
<note>
<para>
This function requires that the <link linkend="ini.register-argc-argv">
register_argc_argv</link> configuration option be enabled.
</para>
</note>
</para>
</refsect1>
</refentry>
<!-- 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
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->