svn: /phpdoc/en/trunk/language/ constants.xml
| From: | Christoph Michael Becker | Date: | Tue, 05 Jul 2016 13:11:07 +0000 |
| Subject: | svn: /phpdoc/en/trunk/language/ constants.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-14285@lists.php.net to get a copy of this message | ||
cmb Tue, 05 Jul 2016 13:11:07 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=339565
Log:
Integrate user notes 116312 and 118639
We clarify the difference between define() and const wrt. to allowed values.
Changed paths:
U phpdoc/en/trunk/language/constants.xml
Modified: phpdoc/en/trunk/language/constants.xml
===================================================================
--- phpdoc/en/trunk/language/constants.xml 2016-07-05 08:57:56 UTC (rev 339564)
+++ phpdoc/en/trunk/language/constants.xml 2016-07-05 13:11:07 UTC (rev 339565)
@@ -64,11 +64,15 @@
You can define a constant by using the
<function>define</function>-function or by using the
<literal>const</literal> keyword outside a class definition as
- of PHP 5.3.0. Once a constant is defined, it can never be
+ of PHP 5.3.0. While <function>define</function> allows a constant to be
+ defined to an arbitrary expression, the <literal>const</literal> keyword has
+ restrictions as outlined in the next paragraph.
+ Once a constant is defined, it can never be
changed or undefined.
</simpara>
<simpara>
- Only scalar data (<type>boolean</type>, <type>integer</type>,
+ When using the <literal>const</literal> keyword,
+ only scalar data (<type>boolean</type>, <type>integer</type>,
<type>float</type> and <type>string</type>) can be contained
in constants prior to PHP 5.6. From PHP 5.6 onwards, it is possible to
define a constant as a scalar expression, and it is also possible