language/control-structures/declare.xml
28529d3539b850e870e3aa97570f4db0e53daa03
...
...
@@ -2,7 +2,7 @@
2
2
<!-- $Revision$ -->
3
3

4
4
<sect1 xml:id="control-structures.declare" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5
-
<title><literal>declare</literal></title>
5
+
<title>declare</title>
6
6
<?phpdoc print-version-for="declare"?>
7
7
<para>
8
8
The <literal>declare</literal> construct is used to
...
...
@@ -32,38 +32,10 @@ declare (directive)
32
32
<link linkend="control-structures.declare.encoding">encoding</link>
33
33
directive) and the <literal>strict_types</literal> directive (See for more
34
34
information the
35
-
<link linkend="functions.arguments.type-declaration.strict">strict</link>
36
-
section on the Function arguments page)
37
-
</para>
38
-
<para>
39
-
<informaltable>
40
-
<tgroup cols="2">
41
-
<thead>
42
-
<row>
43
-
<entry>&Version;</entry>
44
-
<entry>&Description;</entry>
45
-
</row>
46
-
</thead>
47
-
<tbody>
48
-
<row>
49
-
<entry>7.0.0</entry>
50
-
<entry>Added <literal>strict_types</literal> directive</entry>
51
-
</row>
52
-
<row>
53
-
<entry>7.0.0</entry>
54
-
<entry>
55
-
The <literal>ticks</literal> directive does no longer leak into different
56
-
compilation units.
57
-
</entry>
58
-
</row>
59
-
<row>
60
-
<entry>5.3.0</entry>
61
-
<entry>Added <literal>encoding</literal> directive</entry>
62
-
</row>
63
-
</tbody>
64
-
</tgroup>
65
-
</informaltable>
35
+
<link linkend="language.types.declarations.strict">strict typing</link>
36
+
section on the type declarations page)
66
37
</para>
38
+

67
39
<para>
68
40
As directives are handled as the file is being compiled, only literals may
69
41
be given as directive values. Variables and constants cannot be used. To
...
...
@@ -150,42 +122,14 @@ function tick_handler()
150
122
echo "tick_handler() called\n";
151
123
}
152
124

153
-
register_tick_function('tick_handler');
154
-

155
-
$a = 1;
156
-

157
-
if ($a > 0) {
158
-
$a += 2;
159
-
print($a);
160
-
}
161
-

162
-
?>
163
-
]]>
164
-
</programlisting>
165
-
</example>
166
-
</para>
167
-
<para>
168
-
<example>
169
-
<title>Ticks usage example</title>
170
-
<programlisting role="php">
171
-
<![CDATA[
172
-
<?php
173
-

174
-
function tick_handler()
175
-
{
176
-
echo "tick_handler() called\n";
177
-
}
125
+
register_tick_function('tick_handler'); // causes a tick event
178
126

179
-
$a = 1;
180
-
tick_handler();
127
+
$a = 1; // causes a tick event
181
128

182
129
if ($a > 0) {
183
-
$a += 2;
184
-
tick_handler();
185
-
print($a);
186
-
tick_handler();
130
+
$a += 2; // causes a tick event
131
+
print $a; // causes a tick event
187
132
}
188
-
tick_handler();
189
133

190
134
?>
191
135
]]>
...
...
@@ -223,14 +167,6 @@ declare(encoding='ISO-8859-1');
223
167
</simpara>
224
168
</caution>
225
169
<para>
226
-
The encoding declare value is ignored in PHP 5.3 unless php is compiled with
227
-
<literal>--enable-zend-multibyte</literal>.
228
-
</para>
229
-
<para>
230
-
Note that PHP does not expose whether <literal>--enable-zend-multibyte</literal> was
231
-
used to compile PHP other than by <function>phpinfo</function>.
232
-
</para>
233
-
<para>
234
170
See also <link linkend="ini.zend.script-encoding">zend.script_encoding</link>.
235
171
</para>
236
172
</sect2>
237
173