jeroen Mon Jul 9 18:11:16 2001 EDT
Removed files:
/phpdoc/nl/language oop.xml
Modified files:
/phpdoc/nl Translators
/phpdoc/nl/language control-structures.xml
Log:
Partially updated control-structures (with english text),
updated translators.
Now nearly builds, only the FAQ gives trouble.
oop.xml removed, was too out-of-date
Index: phpdoc/nl/Translators
diff -u phpdoc/nl/Translators:1.23 phpdoc/nl/Translators:1.24
--- phpdoc/nl/Translators:1.23 Mon Jul 9 17:54:10 2001
+++ phpdoc/nl/Translators Mon Jul 9 18:11:16 2001
@@ -122,7 +122,7 @@
functions.xml Derick 1.9 *
oop.xml Derick 1.5 ****
operators.xml
-references.xml Derick 1.6 *
+references.xml Derick 1.6 ***
types.xml
variables.xml
----------------------------------------------------------------------------
Index: phpdoc/nl/language/control-structures.xml
diff -u phpdoc/nl/language/control-structures.xml:1.13
phpdoc/nl/language/control-structures.xml:1.14
--- phpdoc/nl/language/control-structures.xml:1.13 Mon Jul 9 17:54:10 2001
+++ phpdoc/nl/language/control-structures.xml Mon Jul 9 18:11:16 2001
@@ -1,4 +1,5 @@
-<!-- up-to-date against phpdoc/en/language/control-structures.xml:1.22 -->
+<!-- up-to-date against phpdoc/en/language/control-structures.xml:1.22
+ (t/m regel 526 tot 1.33, en de declare section toegevoegd) -->
<chapter id="control-structures">
<title>Control Structures</title>
@@ -158,6 +159,18 @@
<sect1 id="control-structures.alternative-syntax">
<title>Alternatieve syntax voor control structures</title>
<para>
+ <warning>
+ <simpara>
+ Alternative syntax is deprecated as of PHP 4. Basically,
+ it just generates unreadable code, and it gets
+ very complicated when mixing it with the normal syntax.
+ Although there are no plans to break this syntax, it
+ cannot be ruled out that one day this will stop working.
+ You are warned.
+ </simpara>
+ </warning>
+ </para>
+ <para>
PHP bied een alternative syntax voor sommige control structures;
namelijk voor <literal>if</literal>, <literal>while</literal>,
<literal>for</literal>, <literal>foreach</literal> en
@@ -479,13 +492,20 @@
<para>
<note>
<para>
- Neem ook in gedachten dat <literal>foreach</literal> werkt op een
- kopie van de gespecificeerde array, en niet op de array zelf,
- hierdoor wordt de array pointer niet aangepast zoals met elke
- andere array operator wel gebeurd.
+ Also note that <literal>foreach</literal> operates on a copy of
+ the specified array, not the array itself, therefore the array
+ pointer is not modified as with the <function>each</function>
+ construct and changes to the array element returned are not
+ reflected in the original array.
</para>
</note>
</para>
+ <note>
+ <para>
+ <literal>foreach</literal> does not support the ability to
+ suppress error messages using '@'.
+ </para>
+ </note>
<para>
De volgende twee voorbeelden zijn functioneel identiek aan elkaar:
<informalexample>
@@ -793,6 +813,111 @@
</programlisting>
</informalexample>
</para>
+ </sect1>
+
+ <sect1 id="control-structures.declare">
+ <title><literal>declare</literal></title>
+ <para>
+ The <literal>declare</literal> construct is used to is
+ used to set execution directives for a block of code.
+ The syntax of <literal>declare</literal> is similiar to
+ the syntax of other flow control constructs:
+ <informalexample>
+ <programlisting>
+declare (directive) statement
+ </programlisting>
+ </informalexample>
+ </para>
+ <para>
+ The <literal>directive</literal> section allows the
+ behavior of the <literal>declare</literal> block to
+ be set.
+ Currently only one directive is recognized: the
+ <literal>ticks</literal> directive. (See below for more
+ information on the
+ <link linkend="control-structures.declare.ticks">ticks</link>
+ directive)
+ </para>
+ <para>
+ The <literal>statement</literal> part of the
+ <literal>declare</literal> block will be executed - how
+ it is executed and what side-effects occur during execution
+ may depend on the directive set in the
+ <literal>directive</literal> block.
+ </para>
+ <sect2 id="control-structures.declare.ticks">
+ <title>Ticks</title>
+ <para>A tick is an event that occurs for every
+ <replaceable>N</replaceable> low-level statements executed
+ by the parser within the <literal>declare</literal> block.
+ The value for <replaceable>N</replaceable> is specified
+ using <literal>ticks=<replaceable>N</replaceable></literal>
+ within the <literal>declare</literal> blocks's
+ <literal>directive</literal> section.
+ </para>
+ <para>
+ The event(s) that occurs on each tick is specified using the
+ <function>register_tick_function</function>. See the example
+ below for more details. Note that more than one event can occur
+ for each tick.
+ </para>
+ <para>
+ <example>
+ <title>Profile a section of PHP code</title>
+ <programlisting role="php">
+<pre>
+<?php
+// A function that records the time when it is called
+function profile ($dump = FALSE)
+{
+ static $profile;
+
+ // Return the times stored in profile, then erase it
+ if ($dump) {
+ $temp = $profile;
+ unset ($profile);
+ return ($temp);
+ }
+
+ $profile[] = microtime ();
+}
+
+// Set up a tick handler
+register_tick_function("profile");
+
+// Initialize the function before the declare block
+profile ();
+
+// Run a block of code, throw a tick every 2nd statement
+declare (ticks=2) {
+ for ($x = 1; $x < 50; ++$x) {
+ echo similar_text (md5($x), md5($x*$x)), "<br>";
+ }
+}
+
+// Display the data stored in the profiler
+print_r (profile (TRUE));
+?>
+</pre>
+ </programlisting>
+ </example>
+ The example profiles the PHP code within the 'declare'
+ block, recording the time at which every second low-level
+ statement in the block was executed. This information can
+ then be used to find the slow areas within particular
+ segments of code. This process can be performed using other
+ methods: using ticks is more convenient and easier to
+ implement.
+ </para>
+ <simpara>
+ Ticks are well suited for debugging, implementing simple
+ multitasking, backgrounded I/O and many other tasks.
+ </simpara>
+ <simpara>
+ See also <function>register_tick_function</function> and
+ <function>unregister_tick_function</function>.
+ </simpara>
+ </sect2>
</sect1>
<sect1 id="function.require">