mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 17:08:54 +00:00
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:
parent
6cd00fd469
commit
79add51c1b
1 changed files with 50 additions and 2 deletions
|
@ -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">
|
||||
<php
|
||||
|
||||
define ("MAXSIZE", 100);
|
||||
|
||||
echo MAXSIZE;
|
||||
echo constant("MAXSIZE"); // same thing as the previous line
|
||||
|
||||
?>
|
||||
</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>
|
||||
|
|
Loading…
Reference in a new issue