cvs: /phpdoc/functions misc.sgml
| From: | Torben Wilson | Date: | Tue, 21 Sep 1999 10:37:22 +0000 |
| Subject: | cvs: /phpdoc/functions misc.sgml | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-11141@lists.php.net to get a copy of this message | ||
cslawi Tue Sep 21 06:37:22 1999 EDT
Modified files:
/phpdoc/functions misc.sgml
Log:
Documented define() and defined().
Index: phpdoc/functions/misc.sgml
diff -u phpdoc/functions/misc.sgml:1.6 phpdoc/functions/misc.sgml:1.7
--- phpdoc/functions/misc.sgml:1.6 Sun Sep 5 23:22:00 1999
+++ phpdoc/functions/misc.sgml Tue Sep 21 06:37:22 1999
@@ -69,6 +69,104 @@
</refsect1>
</refentry>
+ <refentry id="function.define">
+ <refnamediv>
+ <refname>define</refname>
+ <refpurpose>Defines a named constant.</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Description</title>
+ <funcsynopsis>
+ <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>
+ </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>
+ The name of the constant is given by <parameter>name</parameter>;
+ the value is given by <parameter>value</parameter>.
+
+ <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>
+ <example>
+ <title>Defining Constants</title>
+ <programlisting>
+<?php
+define("CONSTANT", "Hello world.");
+echo CONSTANT; // outputs "Hello world."
+?>
+ </programlisting>
+ </example>
+
+ <para>
+ <function>define</function> returns TRUE on success and FALSE if
+ an error occurs.
+
+ <para>
+ See also <function>defined</function> and the section on <link
+ linkend="language.constants">Constants</link>.
+
+ </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>
+ <funcdef>int <function>defined</function></funcdef>
+ <paramdef>string <parameter>name</parameter></paramdef>
+ </funcsynopsis>
+
+ <para>
+ Returns TRUE if the named constant given by
+ <parameter>name</parameter> has been defined, false otherwise.
+
+ <para>
+ See also <function>define</function> and the section on <link
+ linkend="language.constants">Constants</link>.
+
+ </refsect1>
+ </refentry>
+
<refentry id="function.die">
<refnamediv>
<refname>die</refname>