diff --git a/language/constants.xml b/language/constants.xml index ea99cf3dfb..6632641b41 100644 --- a/language/constants.xml +++ b/language/constants.xml @@ -70,9 +70,10 @@ define("__FOO__", "something"); Only scalar data (boolean, integer, float and string) can be contained - in constants. It is possible to define constants as a - resource, but it should be avoided, as it can cause - unexpected results. + in constants prior to PHP 5.6. From PHP 5.6 onwards, it is also possible + to define an array constant. It is possible to define + constants as a resource, but it should be avoided, as it can + cause unexpected results. You can get the value of a constant by simply specifying its name. @@ -131,7 +132,8 @@ define("__FOO__", "something"); - Constants may only evaluate to scalar values. + Constants may only evaluate to scalar values, or scalar or array values + in PHP 5.6 and later. @@ -162,6 +164,11 @@ echo Constant; // outputs "Constant" and issues a notice. const CONSTANT = 'Hello World'; echo CONSTANT; + +// Works as of PHP 5.6.0 +const ANOTHER_CONST = CONSTANT.'; Goodbye World'; + +echo ANOTHER_CONST; ?> ]]>