From 9543a3e64d6bf62337fe2056234bd249f9ed99fc Mon Sep 17 00:00:00 2001 From: Philip Olson <philip@php.net> Date: Tue, 10 Jun 2003 04:30:35 +0000 Subject: [PATCH] Clarify what it means to use undefined constants. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@130821 c90b9560-bf6c-de11-be94-00142212c4b1 --- language/constants.xml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/language/constants.xml b/language/constants.xml index dc7da1bbcb..f622ca90b3 100644 --- a/language/constants.xml +++ b/language/constants.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.32 $ --> +<!-- $Revision: 1.33 $ --> <chapter id="language.constants"> <title>Constants</title> @@ -66,10 +66,14 @@ </note> <simpara> If you use an undefined constant, PHP assumes that you mean - the name of the constant itself. A - <link linkend="ref.errorfunc">notice</link> will be issued - when this happens. Use the <function>defined</function>-function if - you want to know if a constant is set. + the name of the constant itself, just as if you called it as + a <type>string</type> (CONSTANT vs "CONSTANT"). An error of level + <link linkend="ref.errorfunc">E_NOTICE</link> will be issued + when this happens. See also the manual entry on why + <link linkend="language.types.array.foo-bar">$foo[bar]</link> is + wrong (unless you first <function>define</function> + <literal>bar</literal> as a constant). If you simply want to check if a + constant is set, use the <function>defined</function> function. </simpara> <para> These are the differences between constants and variables: