mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Update constants documentation for 5.6.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@333675 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
8932dc479a
commit
0ee8eea304
1 changed files with 11 additions and 4 deletions
|
@ -70,9 +70,10 @@ define("__FOO__", "something");
|
|||
<simpara>
|
||||
Only scalar data (<type>boolean</type>, <type>integer</type>,
|
||||
<type>float</type> and <type>string</type>) can be contained
|
||||
in constants. It is possible to define constants as a
|
||||
<type>resource</type>, 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 <type>array</type> constant. It is possible to define
|
||||
constants as a <type>resource</type>, but it should be avoided, as it can
|
||||
cause unexpected results.
|
||||
</simpara>
|
||||
<simpara>
|
||||
You can get the value of a constant by simply specifying its name.
|
||||
|
@ -131,7 +132,8 @@ define("__FOO__", "something");
|
|||
</listitem>
|
||||
<listitem>
|
||||
<simpara>
|
||||
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.
|
||||
</simpara>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
@ -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;
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
|
Loading…
Reference in a new issue