Fixed PHP bug #51340 (const keyword inside code blocks causes parse error)

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@296726 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Daniel Egeberg 2010-03-24 15:33:08 +00:00
parent 50dee02eea
commit 7df1c871ff

View file

@ -168,6 +168,16 @@ echo CONSTANT;
</example>
</para>
<note>
<para>
As opposed to defining constants using <function>define</function>,
constants defined using the <literal>const</literal> keyword must be
declared at the top-level scope because they are defined at compile-time.
This means that they cannot be declared inside functions, loops or
<literal>if</literal> statements.
</para>
</note>
<simpara>
See also <link linkend="language.oop5.constants">Class Constants</link>.
</simpara>