2002-04-15 00:12:54 +00:00
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
2007-06-20 22:25:43 +00:00
|
|
|
<!-- $Revision: 1.11 $ -->
|
|
|
|
<refentry xml:id="function.define" xmlns="http://docbook.org/ns/docbook">
|
2007-02-19 00:04:48 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>define</refname>
|
|
|
|
<refpurpose>Defines a named constant</refpurpose>
|
|
|
|
</refnamediv>
|
2007-02-19 00:04:49 +00:00
|
|
|
|
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2007-02-19 00:04:48 +00:00
|
|
|
<methodsynopsis>
|
|
|
|
<type>bool</type><methodname>define</methodname>
|
|
|
|
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
|
|
|
<methodparam><type>mixed</type><parameter>value</parameter></methodparam>
|
|
|
|
<methodparam choice="opt"><type>bool</type><parameter>case_insensitive</parameter></methodparam>
|
|
|
|
</methodsynopsis>
|
|
|
|
<para>
|
2007-02-19 00:04:49 +00:00
|
|
|
Defines a named constant at runtime.
|
2007-02-19 00:04:48 +00:00
|
|
|
</para>
|
2007-02-19 00:04:49 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
2007-02-19 00:04:48 +00:00
|
|
|
<para>
|
2007-02-19 00:04:49 +00:00
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>name</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The name of the constant.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>value</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2007-04-27 11:10:29 +00:00
|
|
|
The value of the constant; only scalar and <type>null</type> values are allowed.
|
|
|
|
Scalar values are <type>integer</type>,
|
|
|
|
<type>float</type>, <type>string</type> or <type>boolean</type> values.
|
2007-02-19 00:04:49 +00:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>case_insensitive</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
If set to &true;, the constant will be defined case-insensitive.
|
|
|
|
The default behaviour is case-sensitive; i.e.
|
|
|
|
<literal>CONSTANT</literal> and <literal>Constant</literal> represent
|
|
|
|
different values.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
2007-02-19 00:04:48 +00:00
|
|
|
</para>
|
2007-02-19 00:04:49 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
2007-02-19 00:04:48 +00:00
|
|
|
<para>
|
2007-02-19 00:04:49 +00:00
|
|
|
&return.success;
|
2007-02-19 00:04:48 +00:00
|
|
|
</para>
|
2007-02-19 00:04:49 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
2007-02-19 00:04:48 +00:00
|
|
|
<para>
|
|
|
|
<example>
|
|
|
|
<title>Defining Constants</title>
|
|
|
|
<programlisting role="php">
|
2002-04-15 00:12:54 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
2003-12-15 16:55:22 +00:00
|
|
|
define("CONSTANT", "Hello world.");
|
2002-04-15 00:12:54 +00:00
|
|
|
echo CONSTANT; // outputs "Hello world."
|
|
|
|
echo Constant; // outputs "Constant" and issues a notice.
|
|
|
|
|
2003-12-15 16:55:22 +00:00
|
|
|
define("GREETING", "Hello you.", true);
|
2002-04-15 00:12:54 +00:00
|
|
|
echo GREETING; // outputs "Hello you."
|
|
|
|
echo Greeting; // outputs "Hello you."
|
|
|
|
|
|
|
|
?>
|
|
|
|
]]>
|
2007-02-19 00:04:48 +00:00
|
|
|
</programlisting>
|
|
|
|
</example>
|
|
|
|
</para>
|
2007-02-19 00:04:49 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
2007-02-19 00:04:48 +00:00
|
|
|
<para>
|
2007-02-19 00:04:49 +00:00
|
|
|
<simplelist>
|
|
|
|
<member><function>defined</function></member>
|
|
|
|
<member><function>constant</function></member>
|
|
|
|
<member>The section on <link linkend="language.constants">Constants</link></member>
|
|
|
|
</simplelist>
|
2007-02-19 00:04:48 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
2007-02-19 00:04:49 +00:00
|
|
|
|
2007-02-19 00:04:48 +00:00
|
|
|
</refentry>
|
2002-04-15 00:12:54 +00:00
|
|
|
|
|
|
|
<!-- 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
|
|
|
|
-->
|