language/control-structures/declare.xml
5499acf9df7e1338d540bde207acc859792cd139
5499acf9df7e1338d540bde207acc859792cd139
...
...
@@ -23,17 +23,12 @@ declare (directive)
23
23
The <literal>directive</literal> section allows the
24
24
behavior of the <literal>declare</literal> block to
25
25
be set.
26
-
Currently only three directives are recognized: the
27
-
<literal>ticks</literal> directive (See below for more
28
-
information on the
29
-
<link linkend="control-structures.declare.ticks">ticks</link>
30
-
directive), the <literal>encoding</literal> directive (See below for more
31
-
information on the
32
-
<link linkend="control-structures.declare.encoding">encoding</link>
33
-
directive) and the <literal>strict_types</literal> directive (See for more
34
-
information the
35
-
<link linkend="language.types.declarations.strict">strict</link>
36
-
section on the Function arguments page)
26
+
Currently only three directives are recognized:
27
+
<simplelist>
28
+
<member><link linkend="control-structures.declare.ticks"><literal>ticks</literal></link></member>
29
+
<member><link linkend="control-structures.declare.encoding"><literal>encoding</literal></link></member>
30
+
<member><link linkend="language.types.declarations.strict"><literal>strict_types</literal></link></member>
31
+
</simplelist>
37
32
</para>
38
33
39
34
<para>
...
...
@@ -122,43 +117,15 @@ function tick_handler()
122
117
echo "tick_handler() called\n";
123
118
}
124
119
125
-
register_tick_function('tick_handler');
120
+
register_tick_function('tick_handler'); // causes a tick event
126
121
127
-
$a = 1;
122
+
$a = 1; // causes a tick event
128
123
129
124
if ($a > 0) {
130
-
$a += 2;
131
-
print($a);
125
+
$a += 2; // causes a tick event
126
+
print $a; // causes a tick event
132
127
}
133
128
134
-
?>
135
-
]]>
136
-
</programlisting>
137
-
</example>
138
-
</para>
139
-
<para>
140
-
<example>
141
-
<title>Ticks usage example</title>
142
-
<programlisting role="php">
143
-
<![CDATA[
144
-
<?php
145
-
146
-
function tick_handler()
147
-
{
148
-
echo "tick_handler() called\n";
149
-
}
150
-
151
-
$a = 1;
152
-
tick_handler();
153
-
154
-
if ($a > 0) {
155
-
$a += 2;
156
-
tick_handler();
157
-
print($a);
158
-
tick_handler();
159
-
}
160
-
tick_handler();
161
-
162
129
?>
163
130
]]>
164
131
</programlisting>
...
...
@@ -174,7 +141,7 @@ tick_handler();
174
141
<para>
175
142
A script's encoding can be specified per-script using the <literal>encoding</literal> directive.
176
143
<example>
177
-
<title>Declaring an encoding for the script.</title>
144
+
<title>Declaring an encoding for the script</title>
178
145
<programlisting role="php">
179
146
<![CDATA[
180
147
<?php
181
148