added docs for the new constant function

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@42994 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Daniel Beckham 2001-03-08 19:47:23 +00:00
parent 6cd00fd469
commit 79add51c1b

View file

@ -75,6 +75,52 @@
</refsect1>
</refentry>
<refentry id="function.constant">
<refnamediv>
<refname>constant</refname>
<refpurpose>Returns the value of a constant</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>mixed <function>constant</function></funcdef>
<paramdef>string <parameter>name</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<simpara>
<function>constant</function> will return the value of the
constant indicated by <parameter>name</parameter>.
</simpara>
<simpara>
<function>constant</function> is useful if you need to retrieve
the value of a constant, but do not know it's name. i.e. It is
stored in a variable or returned by a function.
</simpara>
<para>
<example>
<title><function>constant</function> example</title>
<programlisting role="php">
&lt;php
define ("MAXSIZE", 100);
echo MAXSIZE;
echo constant("MAXSIZE"); // same thing as the previous line
?&gt;
</programlisting>
</example>
</para>
<para>
See also <function>define</function>,
<function>defined</function> and the section on <link
linkend="language.constants">Constants</link>.
</para>
</refsect1>
</refentry>
<refentry id="function.define">
<refnamediv>
<refname>define</refname>
@ -147,7 +193,8 @@ echo CONSTANT; // outputs "Hello world."
an error occurs.
</para>
<para>
See also <function>defined</function> and the section on <link
See also <function>defined</function>,
<function>constant</function> and the section on <link
linkend="language.constants">Constants</link>.
</para>
</refsect1>
@ -183,7 +230,8 @@ if (defined("CONSTANT")){ // Note that it should be quoted
</example>
</para>
<para>
See also <function>define</function> and the section on <link
See also <function>define</function>,
<function>constant</function> and the section on <link
linkend="language.constants">Constants</link>.
</para>
</refsect1>