philip Tue Jun 10 00:48:56 2003 EDT
Modified files:
/phpdoc/en/reference/misc/functions defined.xml
Log:
Implement user notes: use isset for variables, see also function_exists, and
make it clear the importance of passing in a string. Also some minor fixes.
Index: phpdoc/en/reference/misc/functions/defined.xml
diff -u phpdoc/en/reference/misc/functions/defined.xml:1.3
phpdoc/en/reference/misc/functions/defined.xml:1.4
--- phpdoc/en/reference/misc/functions/defined.xml:1.3 Sun Mar 30 21:05:12 2003
+++ phpdoc/en/reference/misc/functions/defined.xml Tue Jun 10 00:48:56 2003
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.3 $ -->
+<!-- $Revision: 1.4 $ -->
<!-- splitted from ./en/functions/misc.xml, last change in rev 1.2 -->
<refentry id="function.defined">
<refnamediv>
@@ -18,23 +18,35 @@
Returns &true; if the named constant given by
<parameter>name</parameter> has been defined,
&false; otherwise.
- <example>
+ </para>
+ <para>
+ <example>
<title>Checking Constants</title>
<programlisting role="php">
<![CDATA[
<?php
-if (defined("CONSTANT")){ // Note that it should be quoted
+// Note the use of quotes, this is important. This example is checking
+// if the string 'CONSTANT' is the name of a constant named CONSTANT
+if (defined('CONSTANT')) {
echo CONSTANT;
- }
+}
?>
]]>
</programlisting>
</example>
</para>
+ <note>
+ <para>
+ If you're wanting to see if a variable exists, use
+ <function>isset</function> as <function>defined</function> only
+ applies to <link linkend="language.constants">constants</link>.
+ </para>
+ </note>
<para>
See also <function>define</function>,
<function>constant</function>,
- <function>get_defined_constants</function> and the section on
+ <function>get_defined_constants</function>,
+ <function>function_exists</function>, and the section on
<link linkend="language.constants">Constants</link>.
</para>
</refsect1>
--
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php