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,31 +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>5.3.0</entry>
54
-
<entry>Added <literal>encoding</literal> directive</entry>
55
-
</row>
56
-
</tbody>
57
-
</tgroup>
58
-
</informaltable>
35
+
<link linkend="language.types.declarations.strict">strict typing</link>
36
+
section on the type declarations page)
59
37
</para>
38
+

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

146
-
register_tick_function('tick_handler');
147
-

148
-
$a = 1;
149
-

150
-
if ($a > 0) {
151
-
$a += 2;
152
-
print($a);
153
-
}
154
-

155
-
?>
156
-
]]>
157
-
</programlisting>
158
-
</example>
159
-
</para>
160
-
<para>
161
-
<example>
162
-
<title>Ticks usage example</title>
163
-
<programlisting role="php">
164
-
<![CDATA[
165
-
<?php
166
-

167
-
function tick_handler()
168
-
{
169
-
echo "tick_handler() called\n";
170
-
}
125
+
register_tick_function('tick_handler'); // causes a tick event
171
126

172
-
$a = 1;
173
-
tick_handler();
127
+
$a = 1; // causes a tick event
174
128

175
129
if ($a > 0) {
176
-
$a += 2;
177
-
tick_handler();
178
-
print($a);
179
-
tick_handler();
130
+
$a += 2; // causes a tick event
131
+
print $a; // causes a tick event
180
132
}
181
-
tick_handler();
182
133

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