cvs: phpdoc /nl/language control-structures.xml

From: Date: Mon, 06 Nov 2000 23:12:18 +0000
Subject: cvs: phpdoc /nl/language control-structures.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969332809@lists.php.net to get a copy of this message
derick Mon Nov 6 15:12:18 2000 EDT Modified files: /phpdoc/nl/language control-structures.xml Log: - Translated a bunch #- Just stored it so that I can work on it while being not at home

Index: phpdoc/nl/language/control-structures.xml diff -u phpdoc/nl/language/control-structures.xml:1.3 phpdoc/nl/language/control-structures.xml:1.4 --- phpdoc/nl/language/control-structures.xml:1.3 Fri Oct 27 10:27:55 2000 +++ phpdoc/nl/language/control-structures.xml Mon Nov 6 15:12:18 2000 @@ -113,148 +113,146 @@ de <literal>else</literal>, breidt het de <literal>if</literal> uit met de mogelijkheid om een ander statement uit te voeren als de <literal>if</literal> expressie evalueerd naar - <literal>FALSE</literal>. However, unlike - <literal>else</literal>, it will execute that alternative - expression only if the <literal>elseif</literal> conditional - expression evaluates to <literal>TRUE</literal>. For example, the - following code would display <computeroutput>a is bigger than - b</computeroutput>, <computeroutput>a equal to b</computeroutput> - or <computeroutput>a is smaller than b</computeroutput>: + <literal>FALSE</literal>. In tegenstelling tot + <literal>else</literal> zal <literal>elseif</literal> het statement + alleen uitvoeren als de expressie evalueerd tot <literal>TRUE</literal>. + Als voorbeeld zal de code hieronder <computeroutput>a is groter dan + b</computeroutput>, <computeroutput>a is gelijk aan b</computeroutput> + of <computeroutput>a is kleiner dan b</computeroutput> tonen: <informalexample> <programlisting role="php"> if ($a &gt; $b) { - print "a is bigger than b"; + print "a is groter dan b"; } elseif ($a == $b) { - print "a is equal to b"; + print "a is gelijk aan b"; } else { - print "a is smaller than b"; + print "a is kleiner dan b"; } </programlisting> </informalexample> </para> <simpara> - There may be several <literal>elseif</literal>s within the same - <literal>if</literal> statement. The first - <literal>elseif</literal> expression (if any) that evaluates to - <literal>true</literal> would be executed. In PHP, you can also - write 'else if' (in two words) and the behavior would be identical - to the one of 'elseif' (in a single word). The syntactic meaning - is slightly different (if you're familiar with C, this is the same - behavior) but the bottom line is that both would result in exactly - the same behavior. - </simpara> - <simpara> - The <literal>elseif</literal> statement is only executed if the - preceding <literal>if</literal> expression and any preceding - <literal>elseif</literal> expressions evaluated to - <literal>FALSE</literal>, and the current - <literal>elseif</literal> expression evaluated to + Je kunt meerdere <literal>elseif</literal>s binnen hetzelfde + <literal>if</literal> statement gebruiken. De eerste + <literal>elseif</literal> expressie (indien aanwezig) die evalueerd + tot <literal>TRUE</literal> zal worden uitgevoerd. In PHP kun je ook + gebruken 'else if' (in twee woorden) en de werking zou precies identiek + zijn aan &eacute;&eacute;n 'elseif' (in &eacute;&eacute; woord). + De syntactische betekenis is heel iets anders (net zoals in C), + maar beide zullen precies hetzelfde resultaat opleveren. + </simpara> + <simpara> + Het <literal>elseif</literal> statement wordt alleen maar uitgevoerd indien + all voorgaande <literal>if</literal> expressies en alle voorafgaande + <literal>elseif</literal> expressies evalueren tot + <literal>FALSE</literal>, en de huidige + <literal>elseif</literal> expressie evalueerd tot <literal>TRUE</literal>. </simpara> </sect1> <sect1 id="control-structures.alternative-syntax"> - <title>Alternative syntax for control structures</title> + <title>Alternatieve syntax voor control structures</title> <para> - PHP offers an alternative syntax for some of its control - structures; namely, <literal>if</literal>, - <literal>while</literal>, <literal>for</literal>, - <literal>foreach</literal>, and <literal>switch</literal>. - In each case, the basic form of the alternate syntax is to change - the opening brace to a colon (:) and the closing brace to + PHP bied een alternative syntax voor sommige control structures; + namelijk voor <literal>if</literal>, <literal>while</literal>, + <literal>for</literal>, <literal>foreach</literal> en + <literal>switch</literal>. De alternatieve syntax verkrijg je + door het vervangen van de openingsaccolade door een dubbele + punt (:) en de sluit accolade door respectivelijk <literal>endif;</literal>, <literal>endwhile;</literal>, - <literal>endfor;</literal>, <literal>endforeach;</literal>, or - <literal>endswitch;</literal>, respectively. + <literal>endfor;</literal>, <literal>endforeach;</literal> of + <literal>endswitch;</literal>. <informalexample> <programlisting role="php"> &lt;?php if ($a == 5): ?&gt; - A is equal to 5 + A is gelijk aan 5 &lt;?php endif; ?&gt; </programlisting> </informalexample> </para> <simpara> - In the above example, the HTML block "A = 5" is nested within an - <literal>if</literal> statement written in the alternative syntax. - The HTML block would be displayed only if $a is equal to 5. + In het bovenstaande voorbeeld is het HTML block "A is gelijk aan 5" + genest binnen een <literal>if</literal> statement, dat geschreven is + in de alternative syntax. Het HTML blok wordt alleen getoond indien + $a gelijk is aan 5. </simpara> <para> - The alternative syntax applies to <literal>else</literal> and - <literal>elseif</literal> as well. The following is an - <literal>if</literal> structure with <literal>elseif</literal> and - <literal>else</literal> in the alternative format: + De alternatieve syntax is ook te gebruiken voor <literal>else</literal> + en <literal>elseif</literal>. Het volgende is een + <literal>if</literal> structuur met <literal>elseif</literal> en + <literal>else</literal> in het alternatieve formaat: <informalexample> <programlisting role="php"> if ($a == 5): - print "a equals 5"; + print "a is gelijk aan 5"; print "..."; elseif ($a == 6): - print "a equals 6"; + print "a is gelijk aan 6"; print "!!!"; else: - print "a is neither 5 nor 6"; + print "a is niet gelijk aan 5 of 6"; endif; </programlisting> </informalexample> </para> <para> - See also <link linkend="control-structures.while">while</link>, - <link linkend="control-structures.for">for</link>, and <link - linkend="control-structures.if">if</link> for further examples. + Zie ook <link linkend="control-structures.while">while</link>, + <link linkend="control-structures.for">for</link>, en <link + linkend="control-structures.if">if</link> voor meer voorbeelden. </para> </sect1> <sect1 id="control-structures.while"> <title><literal>while</literal></title> <para> - <literal>while</literal> loops are the simplest type of loop in - PHP. They behave just like their C counterparts. The basic form - of a <literal>while</literal> statement is: + <literal>while</literal> loops zijn de eenvoudigste manier van loops + in PHP. De gedragen precies gelijk aan de while loops in C. De basis + vorm van een <literal>while</literal> statement is: <informalexample> <programlisting> -while (expr) statement +while (expressie) statement </programlisting> </informalexample> </para> <simpara> - The meaning of a <literal>while</literal> statement is simple. It - tells PHP to execute the nested statement(s) repeatedly, as long - as the <literal>while</literal> expression evaluates to - <literal>TRUE</literal>. The value of the expression is checked - each time at the beginning of the loop, so even if this value - changes during the execution of the nested statement(s), execution - will not stop until the end of the iteration (each time PHP runs - the statements in the loop is one iteration). Sometimes, if the - <literal>while</literal> expression evaluates to - <literal>FALSE</literal> from the very beginning, the nested - statement(s) won't even be run once. + De bedoeling van het <literal>while</literal> statement is eenvoudig. + Het laat PHP de geneste statements herhaaldelijk uitvoeren, zo lang + als de <literal>while</literal> expressie evaluateerd tot + <literal>TRUE</literal>. De waarde van de expressie wordt elke keer + aan het begin van de loop gecontroleerd, dus zelfs als deze waarde + veranderd tijdens het uitvoeren van de geneste statement(s), zal de + uitvoer niet stoppen voordat de iteratie is afgelopen (elke keer dat + PHP de statements in de loop uitvoert is &eacute;&eacute;n iteratie). + Als wanneer voor de eerste keer de <literal>while</literal> + expressie evaluateerd tot <literal>FALSE</literal>, dan worden de + statement(s) niet &eacute;&eacute;n keer uitgevoerd. </simpara> <para> - Like with the <literal>if</literal> statement, you can group - multiple statements within the same <literal>while</literal> loop - by surrounding a group of statements with curly braces, or by - using the alternate syntax: + Net zoals met het <literal>if</literal> statement, kun je meerdere + statements uitvoeren binnen dezelfde <literal>while</literal> loop, + door een groep van statements te omvatten met accolades, of door de + alternatieve syntax te gebruiken: <informalexample> <programlisting> -while (expr): statement ... endwhile; +while (expressie): statement ... endwhile; </programlisting> </informalexample> </para> <para> - The following examples are identical, and both print numbers from - 1 to 10: + De volgende voorbeelden zijn identiek en zullen beide de getallen + van 1 tot 10 laten zien: <informalexample> <programlisting> -/* example 1 */ +/* voorbeeld 1 */ $i = 1; while ($i &lt;= 10) { - print $i++; /* the printed value would be - $i before the increment - (post-increment) */ + print $i++; /* De waarde wordt getoond voordat deze + wordt opgehoogt (post-increment) */ } -/* example 2 */ +/* voorbeeld 2 */ $i = 1; while ($i &lt;= 10): @@ -269,20 +267,22 @@ <sect1 id="control-structures.do.while"> <title><literal>do..while</literal></title> <simpara> - <literal>do..while</literal> loops are very similar to - <literal>while</literal> loops, except the truth expression is - checked at the end of each iteration instead of in the beginning. - The main difference from regular <literal>while</literal> loops is - that the first iteration of a <literal>do..while</literal> loop is - guarenteed to run (the truth expression is only checked at the end - of the iteration), whereas it's may not necessarily run with a - regular <literal>while</literal> loop (the truth expression is - checked at the beginning of each iteration, if it evaluates to - <literal>FALSE</literal> right from the beginning, the loop - execution would end immediately). + <literal>do..while</literal> loops lijken erg veel op + <literal>while</literal> loops, alleen wordt de vergelijking nu + gecontroleerd aan het einde van de interatie, in plaats van aan het + begin. + Het grootste verschil met normale <literal>while</literal> loops is + dat er altijd een iteratie van een <literal>do..while</literal> loop + wordt uitgevoerd (de expressie wordt namelijk pas aan het einde + van de iteratie geevalueerd), dit in tegenstelling tot de normale + <literal>while</literal> loop (waar de expressie aan het begin van + de iteratie wordt geevalueerd, als deze meteen aan het begin al + evauleerd tot <literal>FALSE</literal>, dan zal de loop niet worden + uitgevoerd). </simpara> <para> - There is just one syntax for <literal>do..while</literal> loops: + Er is maar &eacute;&eacute;n systax voor + <literal>do..while</literal> loops: <informalexample> <programlisting role="php"> @@ -294,49 +294,50 @@ </informalexample> </para> <simpara> - The above loop would run one time exactly, since after the first - iteration, when truth expression is checked, it evaluates to - <literal>FALSE</literal> ($i is not bigger than 0) and the loop - execution ends. + De bovenstaande loop wordt exact &ecaute;&eacute;n keer uitgevoerd, + als na de eerste iteratie, wanneer de expressie wordt geevalueerd, + de waarheids expressie evalueerd tot <literal>FALSE</literal> + ($i is niet groter dan 0) dan eindigd de loop. </simpara> <para> - Advanced C users may be familiar with a different usage of the - <literal>do..while</literal> loop, to allow stopping execution in - the middle of code blocks, by encapsulating them with - <literal>do..while</literal>(0), and using the <link + Grvorderde C programmeurd zullen bekend zijn met een ander gebruik + van de <literal>do..while</literal> loop, namelijk om de executie + in het midden van een blok code to stoppen door een groep statements + te omvatten met <literal>do..while</literal>(0), en dan het <link linkend="control-structures.break"><literal>break</literal></link> - statement. The following code fragment demonstrates this: + statement te gebruiken om naar het einde van de loop te springen. + Het volgende voorbeeld demonstreert dit: <informalexample> <programlisting role="php"> do { if ($i &lt; 5) { - print "i is not big enough"; + print "i is niet groot genoeg"; break; } $i *= $factor; - if ($i &lt; $minimum_limit) { + if ($i &lt; $minimum_limiet) { break; } print "i is ok"; - ...process i... + ...doe wat met i... } while(0); </programlisting> </informalexample> </para> <simpara> - Don't worry if you don't understand this right away or at all. - You can code scripts and even powerful scripts without using this - `feature'. + Vrees niet als je dit niet meteen bergijpt, of helemaal niet. Je + kunt zeer complexe PHP scripts schrijven zonder gebruik te maken van + deze `feature'. </simpara> </sect1> <sect1 id="control-structures.for"> <title><literal>for</literal></title> <para> - <literal>for</literal> loops are the most complex loops in PHP. - They behave like their C counterparts. The syntax of a + <literal>for</literal> loops zijn de meest complexe loops in PHP. + Ze gedragen zich net als de for-loops in C. De syntax van de <literal>for</literal> loop is: <informalexample> <programlisting> @@ -345,44 +346,42 @@ </informalexample> </para> <simpara> - The first expression (<replaceable>expr1</replaceable>) is - evaluated (executed) once unconditionally at the beginning of the - loop. + De eerste expressie (<replaceable>expr1</replaceable>) wordt + exact &eacute;&eacute;n keer uitgevoerd aan het begin van de loop. </simpara> <simpara> - In the beginning of each iteration, - <replaceable>expr2</replaceable> is evaluated. If it evaluates to - <literal>TRUE</literal>, the loop continues and the nested - statement(s) are executed. If it evaluates to - <literal>FALSE</literal>, the execution of the loop ends. + Aan het begin van elke iteratie wordt + <replaceable>expr2</replaceable> geevalueerd. Als de hij evalueert + tot <literal>TRUE</literal>, dan gaat de loop verder en worden de + geneste statement(s) uitgevoerd. De execute van de loop stopt + als de expressie evalueert tot <literal>FALSE</literal>. </simpara> <simpara> - At the end of each iteration, <replaceable>expr3</replaceable> is - evaluated (executed). + Aan het einde van elke iteratie wordt <replaceable>expr3</replaceable> + uitgevoerd. </simpara> <simpara> - Each of the expressions can be empty. - <replaceable>expr2</replaceable> being empty means the loop should - be run indefinitely (PHP implicitly considers it as - <literal>TRUE</literal>, like C). This may not be as useless as - you might think, since often you'd want to end the loop using a - conditional <link + Elk van de drie expressies mag leeg zijn. Als + <replaceable>expr2</replaceable> leeg is dan betekend dat dat de + loop oneindig zal lopen (PHP neemt aan dat als de tweede expressie + leeg is, de expressie de waarde <literal>TRUE</literal> heeft, net als + in C). Dit is niet zo nutteloos als je zult denken, het is immers + mogelijk dat de loop wordt onderbroken met een conditioneel <link linkend="control-structures.break"><literal>break</literal></link> - statement instead of using the <literal>for</literal> truth - expression. + statement in plaats van het gebruik van een waarheidsexpressie. </simpara> <para> - Consider the following examples. All of them display numbers from - 1 to 10: + Neem de volgende voorbeelden. Elk van deze zal de nummers 1 tot 10 + afdrukken: <informalexample> <programlisting role="php"> -/* example 1 */ +/* voorbeeld 1 */ for ($i = 1; $i &lt;= 10; $i++) { print $i; } -/* example 2 */ +/* voorbeeld 2 */ for ($i = 1;;$i++) { if ($i &gt; 10) { @@ -391,7 +390,7 @@ print $i; } -/* example 3 */ +/* voorbeeld 3 */ $i = 1; for (;;) { @@ -402,20 +401,19 @@ $i++; } -/* example 4 */ +/* voorbeeld 4 */ for ($i = 1; $i &lt;= 10; print $i, $i++) ; </programlisting> </informalexample> </para> <simpara> - Of course, the first example appears to be the nicest one (or - perhaps the fourth), but you may find that being able to use empty - expressions in <literal>for</literal> loops comes in handy in many - occasions. + Natuurlijk lijkt het eerste voorbeeld het netst (of misschien het + vierde), maar je zult zien dat het leeglaten van expressie in + de <literal>for</literal> loops toch vaak handig kan zijn. </simpara> <para> - PHP also supports the alternate "colon syntax" for + PHP heeft ook een "dubbele punt syntax" voor <literal>for</literal> loops. <informalexample> <programlisting> @@ -424,37 +422,39 @@ </informalexample> </para> <para> - Other languages have a <literal>foreach</literal> statement to - traverse an array or hash. PHP 3 has no such construct; PHP 4 does - (see <link - linkend="control-structures.foreach">foreach</link>). In PHP 3, you - can combine <link linkend="control-structures.while">while</link> - with the <function>list</function> and <function>each</function> - functions to achieve the same effect. See the documentation for - these functions for an example. + Andere talen hebben een <literal>foreach</literal> statement voor + het doorlopen van een array of hash. PHP 3 heeft niet zo'n + constructie; PHP 4 heeft deze wel (zie <link + linkend="control-structures.foreach">foreach</link>). In PHP 3 kun + je hetzelfde resultaat bereiken door een + <link linkend="control-structures.while">while</link> met een + <function>list</function> en een <function>each</function> + functions te combineren. Zie de documentatie bij deze functies + voor een voorbeeld. </para> </sect1> <sect1 id="control-structures.foreach"> <title><literal>foreach</literal></title> <para> - PHP 4 (not PHP 3) includes a <literal>foreach</literal> construct, - much like perl and some other languages. This simply gives an easy - way to iterate over arrays. There are two syntaxes; the second is - a minor but useful extension of the first: + PHP 4 (maar PHP 3 niet) heeft een <literal>foreach</literal> construct, + dat veel op die van PERL en sommige andere talen lijkt. Dit construct + geeft een makkelijke manier om door een array te lopen. Er zijn twee + syntaxes, de tweede is een kleine, maar handige, uitbreiding op de + eerst: <informalexample> <programlisting> -foreach(array_expression as $value) statement -foreach(array_expression as $key =&gt; $value) statement +foreach(array_expressie as $waarde) statement +foreach(array_expressie as $key =&gt; $waarde) statement </programlisting> </informalexample> </para> <simpara> - The first form loops over the array given by - <literal>array_expression</literal>. On each loop, the value of - the current element is assigned to <literal>$value</literal> and - the internal array pointer is advanced by one (so on the next - loop, you'll be looking at the next element). + De eerste vorm loopt door de array, aangegeven met + <literal>array_expressie</literal>. In elke iteratie wordt de waarde + van het huidige element in <literal>$waarde</literal> geplaatst en + wordt de interne array pointer &eacute;&eacute;n positie verder gezet + (zodat in de volgende iteratie het volgende element wordt opgehaald). </simpara> <simpara> The second form does the same thing, except that the current
« previous php.doc (#969332809) next »