From 7df1c871ff246378060dfacccf25331b9c9b6546 Mon Sep 17 00:00:00 2001 From: Daniel Egeberg <degeberg@php.net> Date: Wed, 24 Mar 2010 15:33:08 +0000 Subject: [PATCH] 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 --- language/constants.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/language/constants.xml b/language/constants.xml index 7d68dd2d42..e5bb26d5fe 100644 --- a/language/constants.xml +++ b/language/constants.xml @@ -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>