mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
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. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@130822 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
9543a3e64d
commit
b35d824ee0
1 changed files with 17 additions and 5 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue