Clarify what types of values can be given to declare directives.

Fixes doc bug #68177 (declare() + named constant = "Cannot convert to ordinal
value").


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@335128 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Adam Harvey 2014-10-23 19:53:34 +00:00
parent 0b93d1fa3a
commit 285c8b2b89

View file

@ -36,6 +36,25 @@ declare (directive)
The encoding directive was added in PHP 5.3.0
</simpara>
</note>
<para>
As directives are handled as the file is being compiled, only literals may
be given as directive values. Variables and constants cannot be used. To
illustrate:
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
// This is valid:
declare(ticks=1);
// This is invalid:
const TICK_VALUE = 1;
declare(ticks=TICK_VALUE);
?>
]]>
</programlisting>
</informalexample>
</para>
<para>
The <literal>statement</literal> part of the
<literal>declare</literal> block will be executed - how