svn: /phpdoc/en/trunk/ appendices/migration70/new-features.xml reference/misc/functions/define.xml
| From: | Adam Harvey | Date: | Sun, 09 Aug 2015 01:16:42 +0000 |
| Subject: | svn: /phpdoc/en/trunk/ appendices/migration70/new-features.xml reference/misc/functions/define.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-13545@lists.php.net to get a copy of this message | ||
aharvey Sun, 09 Aug 2015 01:16:42 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=337362
Log:
Update define() documentation.
Changed paths:
U phpdoc/en/trunk/appendices/migration70/new-features.xml
U phpdoc/en/trunk/reference/misc/functions/define.xml
Modified: phpdoc/en/trunk/appendices/migration70/new-features.xml
===================================================================
--- phpdoc/en/trunk/appendices/migration70/new-features.xml 2015-08-09 01:16:37 UTC (rev 337361)
+++ phpdoc/en/trunk/appendices/migration70/new-features.xml 2015-08-09 01:16:42 UTC (rev 337362)
@@ -77,20 +77,20 @@
<title>Constant arrays using <function>define</function></title>
<para>
- As of PHP 7.0.0 it is possible to define <type>array</type> constant using
- <function>define</function>. Defining <type>array</type> constant was
possible
- as of PHP 5.6, but only using <literal>const</literal> keyword.
+ <type>Array</type> constants can now be defined with
+ <function>define</function>. In PHP 5.6, they could only be defined with
+ &const;.
</para>
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
-define('ANIMALS', array(
+define('ANIMALS', [
'dog',
'cat',
'bird'
-));
+]);
echo ANIMALS[1]; // outputs "cat"
?>
@@ -98,6 +98,7 @@
</programlisting>
</informalexample>
</sect2>
+
<sect2 xml:id="migration70.new-features.scalar-type-declarations">
<title>Scalar Type Declarations</title>
Modified: phpdoc/en/trunk/reference/misc/functions/define.xml
===================================================================
--- phpdoc/en/trunk/reference/misc/functions/define.xml 2015-08-09 01:16:37 UTC (rev 337361)
+++ phpdoc/en/trunk/reference/misc/functions/define.xml 2015-08-09 01:16:42 UTC (rev 337362)
@@ -35,13 +35,17 @@
<term><parameter>value</parameter></term>
<listitem>
<para>
- The value of the constant; only scalar and <type>null</type> values are allowed.
- As of PHP 7 it also possible to use <type>array</type> value.
- Scalar values are <type>integer</type>,
- <type>float</type>, <type>string</type> or
<type>boolean</type> values. It is
- possible to define <type>resource</type> constants, however it is not
recommended
- and may cause unpredictable behavior.
+ The value of the constant. In PHP 5, <parameter>value</parameter> must
+ be a <type>scalar</type> value (<type>integer</type>,
+ <type>float</type>, <type>string</type>,
<type>boolean</type>, or
+ &null;). In PHP 7, <type>array</type> values are also accepted.
</para>
+ <warning>
+ <para>
+ While it is possible to define <type>resource</type> constants, it is
+ not recommended and may cause unpredictable behavior.
+ </para>
+ </warning>
</listitem>
</varlistentry>
<varlistentry>