philip Tue Jun 10 00:30:36 2003 EDT
Modified files:
/phpdoc/en/language constants.xml
Log:
Clarify what it means to use undefined constants.
Index: phpdoc/en/language/constants.xml
diff -u phpdoc/en/language/constants.xml:1.32 phpdoc/en/language/constants.xml:1.33
--- phpdoc/en/language/constants.xml:1.32 Sun Jun 1 13:17:43 2003
+++ phpdoc/en/language/constants.xml Tue Jun 10 00:30:35 2003
@@ -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:
--
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php