mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
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
This commit is contained in:
parent
75c7e7613b
commit
9543a3e64d
1 changed files with 9 additions and 5 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue