cvs: phpdoc /nl Translators /nl/language control-structures.xml oop.xml
| From: | Derick Rethans | Date: | Tue, 07 Nov 2000 22:13:12 +0000 |
| Subject: | cvs: phpdoc /nl Translators /nl/language control-structures.xml oop.xml | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969332822@lists.php.net to get a copy of this message | ||
derick Tue Nov 7 14:13:12 2000 EDT
Modified files:
/phpdoc/nl Translators
/phpdoc/nl/language control-structures.xml oop.xml
Log:
- Some more translations
Index: phpdoc/nl/Translators diff -u phpdoc/nl/Translators:1.9 phpdoc/nl/Translators:1.10 --- phpdoc/nl/Translators:1.9 Fri Oct 27 00:20:27 2000 +++ phpdoc/nl/Translators Tue Nov 7 14:13:11 2000 @@ -117,7 +117,7 @@ control-structures.xml Derick started expressions.xml functions.xml -oop.xml +oop.xml Derick started operators.xml types.xml variables.xml Index: phpdoc/nl/language/control-structures.xml diff -u phpdoc/nl/language/control-structures.xml:1.4 phpdoc/nl/language/control-structures.xml:1.5 --- phpdoc/nl/language/control-structures.xml:1.4 Mon Nov 6 15:12:18 2000 +++ phpdoc/nl/language/control-structures.xml Tue Nov 7 14:13:12 2000 @@ -457,88 +457,88 @@ (zodat in de volgende iteratie het volgende element wordt opgehaald). </simpara> <simpara> - The second form does the same thing, except that the current - element's key will be assigned to the variable - <literal>$key</literal> on each loop. + De tweede vorm werkt precies zo, alleen zal de key van het element + ook nog eens aan de variabele <literal>$key</literal> gekoppeld. </simpara> <para> <note> <para> - When <literal>foreach</literal> first starts executing, the - internal array pointer is automatically reset to the first element - of the array. This means that you do not need to call - <function>reset</function> before a <literal>foreach</literal> - loop. + Als <literal>foreach</literal> begint met het doorlopen van de array, + dan wordt de interne array pointer automatisch gereset naar het + eerste element van de array. Dit betekend dat je niet eerst + <function>reset</function> hoeft te gebruiken voor een + <literal>foreach</literal> loop. </para> </note> </para> <para> <note> <para> - 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 like with the each construct. + Neem ook in gedachten dat <literal>foreach</literal> werkt op een + kopie van de gespecificeerde array, en niet op de arry zelf, + hierdoor wordt de array pointer niet aangepast als met elke + andere array operator. </para> </note> </para> <para> - You may have noticed that the following are functionally - identical: + De volgende twee voorbeelden zijn functioneelidentiek aan elkaar: <informalexample> <programlisting role="php"> reset ($arr); while (list(, $value) = each ($arr)) { - echo "Value: $value<br>\n"; + echo "Waarde: $value<br>\n"; } foreach ($arr as $value) { - echo "Value: $value<br>\n"; + echo "Waarde: $value<br>\n"; } </programlisting> </informalexample> - The following are also functionally identical: + De volgende zijn ook functioneel aan elkaar: <informalexample> <programlisting role="php"> reset ($arr); while (list($key, $value) = each ($arr)) { - echo "Key: $key; Value: $value<br>\n"; + echo "Key: $key; Waarde: $value<br>\n"; } foreach ($arr as $key => $value) { - echo "Key: $key; Value: $value<br>\n"; + echo "Key: $key; Waarde: $value<br>\n"; } </programlisting> </informalexample> </para> <para> - Some more examples to demonstrate usages: + Hier volgen nog wat meer voorbeelden van het gebruik van deze + functie: <informalexample> <programlisting role="php"> -/* foreach example 1: value only */ +/* foreach voorbeeld 1: alleen de waarde */ $a = array (1, 2, 3, 17); foreach ($a as $v) { - print "Current value of \$a: $v.\n"; + print "Huidige waarde van \$a: $v.\n"; } -/* foreach example 2: value (with key printed for illustration) */ +/* foreach voorbeeld 2: waarde (samen met de key ter illustratie) */ $a = array (1, 2, 3, 17); -$i = 0; /* for illustrative purposes only */ +$i = 0; /* alleen ter illustratie */ foreach($a as $v) { print "\$a[$i] => $k.\n"; } -/* foreach example 3: key and value */ +/* foreach voorbeeld 3: key en waarde */ $a = array ( - "one" => 1, - "two" => 2, - "three" => 3, - "seventeen" => 17 + "een" => 1, + "twee" => 2, + "drie" => 3, + "zeventien" => 17 ); foreach($a as $k => $v) { @@ -552,37 +552,37 @@ <sect1 id="control-structures.break"> <title><literal>break</literal></title> <simpara> - <literal>break</literal> ends execution of the current - <literal>for</literal>, <literal>while</literal>, or - <literal>switch</literal> structure. + <literal>break</literal> stopt de uitvoering van de huidige + <literal>for</literal>, <literal>while</literal>, of + <literal>switch</literal> structuur. </simpara> <simpara> - <literal>break</literal> accepts an optional numeric argument - which tells it how many nested enclosing structures are to be - broken out of. + <literal>break</literal> accepteerd een optioneel numeriek argument + waarmee wordt aangegeven uit hoeveel geneste blokken moet worden + teruggekeerd. </simpara> <para> <informalexample> <programlisting role="php"> -$arr = array ('one', 'two', 'three', 'four', 'stop', 'five'); +$arr = array ('een', 'twee', 'drie', 'vier', 'stop', 'vijf'); while (list (, $val) = each ($arr)) { if ($val == 'stop') { - break; /* You could also write 'break 1;' here. */ + break; /* Je had hier ook kunnen schrijven: 'break 1;' */ } echo "$val<br>\n"; } -/* Using the optional argument. */ +/* Gebruikmakend van het optionele argument. */ $i = 0; while (++$i) { switch ($i) { case 5: - echo "At 5<br>\n"; - break 1; /* Exit only the switch. */ + echo "Op 5<br>\n"; + break 1; /* Breek alleen uit de switch. */ case 10: - echo "At 10; quitting<br>\n"; - break 2; /* Exit the switch and the while. */ + echo "Op 10: stoppen<br>\n"; + break 2; /* Breek uit de switch en de while. */ default: break; } @@ -595,23 +595,23 @@ <sect1 id="control-structures.continue"> <title><literal>continue</literal></title> <simpara> - <literal>continue</literal> is used within looping structures to - skip the rest of the current loop iteration and continue execution - at the beginning of the next iteration. + <literal>continue</literal> wordt binnen loop structuren gebruikt om + de rest van de loop niet uit te voeren, en vervolgens de loop met + een nieuwe iteratie laten te beginnen. </simpara> <simpara> - <literal>continue</literal> accepts an optional numeric argument - which tells it how many levels of enclosing loops it should skip - to the end of. + <literal>continue</literal> accepteerd een optioneel argument dat + aangeeft voor hoeveel levels van geneste loops naar het einde moet + worden gesprongen. </simpara> <para> <informalexample> <programlisting role="php"> while (list ($key, $value) = each ($arr)) { - if (!($key % 2)) { // skip odd members + if (!($key % 2)) { // sla oneven cijfers over continue; } - do_something_odd ($value); + doe_iets_nuttigs ($value); } $i = 0; @@ -623,9 +623,9 @@ echo " Inner<br>\n"; continue 3; } - echo "This never gets output.<br>\n"; + echo "Dit wordt nooit uitgevoerd<br>\n"; } - echo "Neither does this.<br>\n"; + echo "En dit ook niet.<br>\n"; } </programlisting> </informalexample> @@ -635,98 +635,102 @@ <sect1 id="control-structures.switch"> <title><literal>switch</literal></title> <simpara> - The <literal>switch</literal> statement is similar to a series of - IF statements on the same expression. In many occasions, you may - want to compare the same variable (or expression) with many - different values, and execute a different piece of code depending - on which value it equals to. This is exactly what the - <literal>switch</literal> statement is for. + Het <literal>switch</literal> statement is gelijk aan een serie van + IF statements met dezelfde expressie. Op veel plaatsen zul dezelfde + variabele (of expressie) willen vergelijken met meerdere waardes, + en overeenkomstig een ander stuk code uit te voeren, ate afhangt + van de waarde waarmee de expressie overeenkomt. Die is precies waar + het <literal>switch</literal> statement voor is. </simpara> <para> - The following two examples are two different ways to write the - same thing, one using a series of <literal>if</literal> - statements, and the other using the <literal>switch</literal> - statement: + De volgende twee voorbeelden zijn twee verschillende manier om + hetzelfde te doen, de é&ecaute;n met een serie + <literal>if</literal> statements, de andere met gebruik makend + van het <literal>switch</literal> statement: <informalexample> <programlisting role="php"> if ($i == 0) { - print "i equals 0"; + print "i is gelijk aan 0"; } if ($i == 1) { - print "i equals 1"; + print "i is gelijk aan 1"; } if ($i == 2) { - print "i equals 2"; + print "i is gelijk aan 2"; } switch ($i) { case 0: - print "i equals 0"; + print "i is gelijk aan 0"; break; case 1: - print "i equals 1"; + print "i is gelijk aan 1"; break; case 2: - print "i equals 2"; + print "i is gelijk aan 2"; break; } </programlisting> </informalexample> </para> <para> - It is important to understand how the <literal>switch</literal> - statement is executed in order to avoid mistakes. The - <literal>switch</literal> statement executes line by line - (actually, statement by statement). In the beginning, no code is - executed. Only when a <literal>case</literal> statement is found - with a value that matches the value of the - <literal>switch</literal> expression does PHP begin to execute the - statements. PHP continues to execute the statements until the end - of the <literal>switch</literal> block, or the first time it sees - a <literal>break</literal> statement. If you don't write a - <literal>break</literal> statement at the end of a case's - statement list, PHP will go on executing the statements of the - following case. For example: + Het is belangrijk om te begrijpen hoe het <literal>switch</literal> + statement precies werkt om fouten te voorkomen. Het + <literal>switch</literal> statement voert lijn voor lijn + (eigenelijk, statement voor statement) uit. In het begin wordt er geen + code uitgevoerd. Alleen als er een <literal>case</literal> statement + wordt gevonden met een waarde die overeenkomt met de waarde van de + <literal>switch</literal> expressie begint PHP met het uitvoeren van + statements. PHP gaat net zolang door met het uitvoeren van statements + tot het einde van het <literal>switch</literal> blok, of totdat het + voor de eerste keer een <literal>break</literal> statement tegenkomt. + Als je geen <literal>break</literal> statement gebruikt aan het einde + van de statement list die bij de "case" hoort, zal PHP + doorgaan met het uitvoeren van statements die bij volgende cases + horen. Zie het volgende voorbeeld: <informalexample> <programlisting role="php"> switch ($i) { case 0: - print "i equals 0"; + print "i is gelijk aan 0"; case 1: - print "i equals 1"; + print "i is gelijk aan 1"; case 2: - print "i equals 2"; + print "i is gelijk aan 2"; } </programlisting> </informalexample> </para> <simpara> - Here, if $i equals to 0, PHP would execute all of the print - statements! If $i equals to 1, PHP would execute the last two - print statements, and only if $i equals to 2, you'd get the - 'expected' behavior and only 'i equals 2' would be displayed. So, - it's important not to forget <literal>break</literal> statements - (even though you may want to avoid supplying them on purpose under - certain circumstances). + Als in het bovenstaande voorbeeld $i gelijk is aan 0, zal PHP + alle print statements uitvoeren! Als $i gelijk is aan 1, dan + zal PHP de laatste twee print statements uitvoeren. Alleen als + $i gelijk is aan 2, krijg je het 'gewenste' resultaat, dan wordt + namelijk alleen het laaste print statement uitgevoerd. Het is dus + belangrijk om geen <literal>break</literal> statements te vergeten. + (Onder bepaalde omstandigeheden, kan het weglaten van de break + statements juist wel nuttig zijn, zoals het voorbeeld hieronder + laat zien. </simpara> <simpara> - In a <literal>switch</literal> statement, the condition is - evaluated only once and the result is compared to each - <literal>case</literal> statement. In an <literal>elseif</literal> - statement, the condition is evaluated again. If your condition is - more complicated than a simple compare and/or is in a tight loop, - a <literal>switch</literal> may be faster. + In een <literal>switch</literal> statement, wordt de conditie + maar één keer geevalueerd, vervolgends wordt de + uitkomst van deze evaluatie vergeleken met de verschillende + <literal>case</literal> statements. Bij een <literal>elseif</literal> + statement wordt de conditie per elsif geevalueerd. Dit betekend dat + als je een gecompliceerde evaluatie hebt, het gebruik van een + <literal>switch</literal> statement wellicht sneller zou werken. </simpara> <para> - The statement list for a case can also be empty, which simply - passes control into the statement list for the next case. + De statement list voor een case kan ook leeg zijn, op deze manier + zal de controle meteen worden doorgegeven aan de volgende case: <informalexample> <programlisting role="php"> switch ($i) { case 0: case 1: case 2: - print "i is less than 3 but not negative"; + print "i is kleiner dan 3 maar niet negatief"; break; case 3: print "i is 3"; @@ -735,51 +739,51 @@ </informalexample> </para> <para> - A special case is the default case. This case matches anything - that wasn't matched by the other cases. For example: + De default case is een speciale. Deze case matched met alles dat + niet is gematched door eerdere cases. Bij voorbeeld: <informalexample> <programlisting role="php"> switch ($i) { case 0: - print "i equals 0"; + print "i is gelijk aan 0"; break; case 1: - print "i equals 1"; + print "i is gelijk aan 1"; break; case 2: - print "i equals 2"; + print "i is gelijk aan 2"; break; default: - print "i is not equal to 0, 1 or 2"; + print "i is niet gelijk aan 0, 1 of 2"; } </programlisting> </informalexample> </para> <para> - The <literal>case</literal> expression may be any expression that - evaluates to a simple type, that is, integer or floating-point - numbers and strings. Arrays or objects cannot be used here unless - they are dereferenced to a simple type. + De <literal>case</literal> expressie mag elke expressie zijn die + evalueerd toe een simpel type, dit zijn integers, floating-point + getallen en strings. Array's en objecten kunnen hier niet voor + worden gebruikt. </para> <para> - The alternative syntax for control structures is supported with - switches. For more information, see <link - linkend="control-structures.alternative-syntax">Alternative syntax - for control structures</link> . + De alternative syntax voor control structures wordt ook ondersteund + voor switches. Voor meer informatie, zie <link + linkend="control-structures.alternative-syntax">Alternatieve syntax + voor control structures</link> . <informalexample> <programlisting role="php"> switch ($i): case 0: - print "i equals 0"; + print "i is gelijk aan 0"; break; case 1: - print "i equals 1"; + print "i is gelijk aan 1"; break; case 2: - print "i equals 2"; + print "i is gelijk aan 2"; break; default: - print "i is not equal to 0, 1 or 2"; + print "i is niet gelijk aan 0, 1 of 2"; endswitch; </programlisting> </informalexample> Index: phpdoc/nl/language/oop.xml diff -u phpdoc/nl/language/oop.xml:1.1 phpdoc/nl/language/oop.xml:1.2 --- phpdoc/nl/language/oop.xml:1.1 Tue Oct 10 15:07:54 2000 +++ phpdoc/nl/language/oop.xml Tue Nov 7 14:13:12 2000 @@ -1,71 +1,78 @@ <chapter id="language.oop"> - <title>Classes and Objects</title> + <title>Classen en Objecten</title> <sect1 id="keyword.class"> <title><literal>class</literal></title> <para> - A class is a collection of variables and functions working with - these variables. A class is defined using the following syntax: + Een class is een verzameling van variabelen en functies die gebruik + maken van deze variabelen. Een class wordt gedefineerd met de volgende + syntax: <informalexample> <programlisting role="php"> <?php class Cart { - var $items; // Items in our shopping cart + var $items; // Items in onze winkelwagen - // Add $num articles of $artnr to the cart + // Voeg $num artikelen met $artnr toe aan de winkelwagen function add_item ($artnr, $num) { - $this->items[$artnr] += $num; + $this->items[$artnr] += $num; } - // Take $num articles of $artnr out of the cart + // Haal $num artikelen met $artnr uit de winkelwagen function remove_item ($artnr, $num) { - if ($this->items[$artnr] > $num) { - $this->items[$artnr] -= $num; + if ($this->items[$artnr] > $num) { + $this->items[$artnr] -= $num; return true; } else { return false; } } } -?> +?> </programlisting> </informalexample> </para> <para> - This defines a class named Cart that consists of an associative - array of articles in the cart and two functions to add and remove - items from this cart. + Deze code defineerd een class "Cart" die bestaan uit een + associatieve array van artikelen in de winkelwagen en twee functies + om artikelen toe te voegen en te verwijderen. </para> <note><simpara> - In PHP 4, only constant initializers for <literal>var</literal> - variables are allowed. Use constructors for non-constant initializers. + In PHP 4 kunnen allen constant initializers voor <literal>var</literal> + variabelen worden gebruikt. Gebruik constructors voor niet-constante + initializaties. </simpara></note> <para> - Classes are types, that is, they are blueprints for actual - variables. You have to create a variable of the desired type with - the new operator. + Classes zijn types, dat wil zeggen dat het blueprints zijn voor echte + variabelen. Je moet een variabele van de classe defineren met de + new operator. De verkregen variabele is nu een instance van die + classe. </para> <informalexample> <programlisting role="php"> - $cart = new Cart; - $cart->add_item("10", 1); + $karretje = new Cart; + $karretje->gadd_item("10", 1); </programlisting> </informalexample> <para> - This creates an object $cart of the class Cart. The function - add_item() of that object is being called to add 1 item of article - number 10 to the cart. </para><para> Classes can be extensions of - other classes. The extended or derived class has all variables and - functions of the base class and what you add in the extended - definition. This is done using the extends keyword. Multiple - inheritance is not supported. + Deze code createerd het object $cart van de classe Cart. De functie + add_item() van het object wordt aangeroepen om 1 item met artikelnummer + 10 toe te voegen aan de winkelwagen. </para> + <para> + Classes kunnen uitbreidingen zijn op andere classes. Deze extended + of derived classes hebben beschikking over alle variabelen en + functies van de base class, en over alle extra variabelen en functies + die je toevoegd in de definitie. Het uitbreiden van classes doe je met + het extends keyword. Meervoudige overerving (zoals het uitbreiden van + classes ook wel eens genoemd wordt) wordt niet ondersteund. + </para> <informalexample> <programlisting role="php"> @@ -73,15 +80,15 @@ var $owner; function set_owner ($name) { - $this->owner = $name; + $this->owner = $name; } } </programlisting> </informalexample> <para> - This defines a class Named_Cart that has all variables and - functions of Cart plus an additional variable $owner and an + Deze code defineerd een class Named_Cart dat alle variabelen en + functies van de Cart plus an additional variable $owner and an additional function set_owner(). You create a named cart the usual way and can now set and get the carts owner. You can still use normal cart functions on named carts:
Index: phpdoc/nl/Translators diff -u phpdoc/nl/Translators:1.9 phpdoc/nl/Translators:1.10 --- phpdoc/nl/Translators:1.9 Fri Oct 27 00:20:27 2000 +++ phpdoc/nl/Translators Tue Nov 7 14:13:11 2000 @@ -117,7 +117,7 @@ control-structures.xml Derick started expressions.xml functions.xml -oop.xml +oop.xml Derick started operators.xml types.xml variables.xml Index: phpdoc/nl/language/control-structures.xml diff -u phpdoc/nl/language/control-structures.xml:1.4 phpdoc/nl/language/control-structures.xml:1.5 --- phpdoc/nl/language/control-structures.xml:1.4 Mon Nov 6 15:12:18 2000 +++ phpdoc/nl/language/control-structures.xml Tue Nov 7 14:13:12 2000 @@ -457,88 +457,88 @@ (zodat in de volgende iteratie het volgende element wordt opgehaald). </simpara> <simpara> - The second form does the same thing, except that the current - element's key will be assigned to the variable - <literal>$key</literal> on each loop. + De tweede vorm werkt precies zo, alleen zal de key van het element + ook nog eens aan de variabele <literal>$key</literal> gekoppeld. </simpara> <para> <note> <para> - When <literal>foreach</literal> first starts executing, the - internal array pointer is automatically reset to the first element - of the array. This means that you do not need to call - <function>reset</function> before a <literal>foreach</literal> - loop. + Als <literal>foreach</literal> begint met het doorlopen van de array, + dan wordt de interne array pointer automatisch gereset naar het + eerste element van de array. Dit betekend dat je niet eerst + <function>reset</function> hoeft te gebruiken voor een + <literal>foreach</literal> loop. </para> </note> </para> <para> <note> <para> - 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 like with the each construct. + Neem ook in gedachten dat <literal>foreach</literal> werkt op een + kopie van de gespecificeerde array, en niet op de arry zelf, + hierdoor wordt de array pointer niet aangepast als met elke + andere array operator. </para> </note> </para> <para> - You may have noticed that the following are functionally - identical: + De volgende twee voorbeelden zijn functioneelidentiek aan elkaar: <informalexample> <programlisting role="php"> reset ($arr); while (list(, $value) = each ($arr)) { - echo "Value: $value<br>\n"; + echo "Waarde: $value<br>\n"; } foreach ($arr as $value) { - echo "Value: $value<br>\n"; + echo "Waarde: $value<br>\n"; } </programlisting> </informalexample> - The following are also functionally identical: + De volgende zijn ook functioneel aan elkaar: <informalexample> <programlisting role="php"> reset ($arr); while (list($key, $value) = each ($arr)) { - echo "Key: $key; Value: $value<br>\n"; + echo "Key: $key; Waarde: $value<br>\n"; } foreach ($arr as $key => $value) { - echo "Key: $key; Value: $value<br>\n"; + echo "Key: $key; Waarde: $value<br>\n"; } </programlisting> </informalexample> </para> <para> - Some more examples to demonstrate usages: + Hier volgen nog wat meer voorbeelden van het gebruik van deze + functie: <informalexample> <programlisting role="php"> -/* foreach example 1: value only */ +/* foreach voorbeeld 1: alleen de waarde */ $a = array (1, 2, 3, 17); foreach ($a as $v) { - print "Current value of \$a: $v.\n"; + print "Huidige waarde van \$a: $v.\n"; } -/* foreach example 2: value (with key printed for illustration) */ +/* foreach voorbeeld 2: waarde (samen met de key ter illustratie) */ $a = array (1, 2, 3, 17); -$i = 0; /* for illustrative purposes only */ +$i = 0; /* alleen ter illustratie */ foreach($a as $v) { print "\$a[$i] => $k.\n"; } -/* foreach example 3: key and value */ +/* foreach voorbeeld 3: key en waarde */ $a = array ( - "one" => 1, - "two" => 2, - "three" => 3, - "seventeen" => 17 + "een" => 1, + "twee" => 2, + "drie" => 3, + "zeventien" => 17 ); foreach($a as $k => $v) { @@ -552,37 +552,37 @@ <sect1 id="control-structures.break"> <title><literal>break</literal></title> <simpara> - <literal>break</literal> ends execution of the current - <literal>for</literal>, <literal>while</literal>, or - <literal>switch</literal> structure. + <literal>break</literal> stopt de uitvoering van de huidige + <literal>for</literal>, <literal>while</literal>, of + <literal>switch</literal> structuur. </simpara> <simpara> - <literal>break</literal> accepts an optional numeric argument - which tells it how many nested enclosing structures are to be - broken out of. + <literal>break</literal> accepteerd een optioneel numeriek argument + waarmee wordt aangegeven uit hoeveel geneste blokken moet worden + teruggekeerd. </simpara> <para> <informalexample> <programlisting role="php"> -$arr = array ('one', 'two', 'three', 'four', 'stop', 'five'); +$arr = array ('een', 'twee', 'drie', 'vier', 'stop', 'vijf'); while (list (, $val) = each ($arr)) { if ($val == 'stop') { - break; /* You could also write 'break 1;' here. */ + break; /* Je had hier ook kunnen schrijven: 'break 1;' */ } echo "$val<br>\n"; } -/* Using the optional argument. */ +/* Gebruikmakend van het optionele argument. */ $i = 0; while (++$i) { switch ($i) { case 5: - echo "At 5<br>\n"; - break 1; /* Exit only the switch. */ + echo "Op 5<br>\n"; + break 1; /* Breek alleen uit de switch. */ case 10: - echo "At 10; quitting<br>\n"; - break 2; /* Exit the switch and the while. */ + echo "Op 10: stoppen<br>\n"; + break 2; /* Breek uit de switch en de while. */ default: break; } @@ -595,23 +595,23 @@ <sect1 id="control-structures.continue"> <title><literal>continue</literal></title> <simpara> - <literal>continue</literal> is used within looping structures to - skip the rest of the current loop iteration and continue execution - at the beginning of the next iteration. + <literal>continue</literal> wordt binnen loop structuren gebruikt om + de rest van de loop niet uit te voeren, en vervolgens de loop met + een nieuwe iteratie laten te beginnen. </simpara> <simpara> - <literal>continue</literal> accepts an optional numeric argument - which tells it how many levels of enclosing loops it should skip - to the end of. + <literal>continue</literal> accepteerd een optioneel argument dat + aangeeft voor hoeveel levels van geneste loops naar het einde moet + worden gesprongen. </simpara> <para> <informalexample> <programlisting role="php"> while (list ($key, $value) = each ($arr)) { - if (!($key % 2)) { // skip odd members + if (!($key % 2)) { // sla oneven cijfers over continue; } - do_something_odd ($value); + doe_iets_nuttigs ($value); } $i = 0; @@ -623,9 +623,9 @@ echo " Inner<br>\n"; continue 3; } - echo "This never gets output.<br>\n"; + echo "Dit wordt nooit uitgevoerd<br>\n"; } - echo "Neither does this.<br>\n"; + echo "En dit ook niet.<br>\n"; } </programlisting> </informalexample> @@ -635,98 +635,102 @@ <sect1 id="control-structures.switch"> <title><literal>switch</literal></title> <simpara> - The <literal>switch</literal> statement is similar to a series of - IF statements on the same expression. In many occasions, you may - want to compare the same variable (or expression) with many - different values, and execute a different piece of code depending - on which value it equals to. This is exactly what the - <literal>switch</literal> statement is for. + Het <literal>switch</literal> statement is gelijk aan een serie van + IF statements met dezelfde expressie. Op veel plaatsen zul dezelfde + variabele (of expressie) willen vergelijken met meerdere waardes, + en overeenkomstig een ander stuk code uit te voeren, ate afhangt + van de waarde waarmee de expressie overeenkomt. Die is precies waar + het <literal>switch</literal> statement voor is. </simpara> <para> - The following two examples are two different ways to write the - same thing, one using a series of <literal>if</literal> - statements, and the other using the <literal>switch</literal> - statement: + De volgende twee voorbeelden zijn twee verschillende manier om + hetzelfde te doen, de é&ecaute;n met een serie + <literal>if</literal> statements, de andere met gebruik makend + van het <literal>switch</literal> statement: <informalexample> <programlisting role="php"> if ($i == 0) { - print "i equals 0"; + print "i is gelijk aan 0"; } if ($i == 1) { - print "i equals 1"; + print "i is gelijk aan 1"; } if ($i == 2) { - print "i equals 2"; + print "i is gelijk aan 2"; } switch ($i) { case 0: - print "i equals 0"; + print "i is gelijk aan 0"; break; case 1: - print "i equals 1"; + print "i is gelijk aan 1"; break; case 2: - print "i equals 2"; + print "i is gelijk aan 2"; break; } </programlisting> </informalexample> </para> <para> - It is important to understand how the <literal>switch</literal> - statement is executed in order to avoid mistakes. The - <literal>switch</literal> statement executes line by line - (actually, statement by statement). In the beginning, no code is - executed. Only when a <literal>case</literal> statement is found - with a value that matches the value of the - <literal>switch</literal> expression does PHP begin to execute the - statements. PHP continues to execute the statements until the end - of the <literal>switch</literal> block, or the first time it sees - a <literal>break</literal> statement. If you don't write a - <literal>break</literal> statement at the end of a case's - statement list, PHP will go on executing the statements of the - following case. For example: + Het is belangrijk om te begrijpen hoe het <literal>switch</literal> + statement precies werkt om fouten te voorkomen. Het + <literal>switch</literal> statement voert lijn voor lijn + (eigenelijk, statement voor statement) uit. In het begin wordt er geen + code uitgevoerd. Alleen als er een <literal>case</literal> statement + wordt gevonden met een waarde die overeenkomt met de waarde van de + <literal>switch</literal> expressie begint PHP met het uitvoeren van + statements. PHP gaat net zolang door met het uitvoeren van statements + tot het einde van het <literal>switch</literal> blok, of totdat het + voor de eerste keer een <literal>break</literal> statement tegenkomt. + Als je geen <literal>break</literal> statement gebruikt aan het einde + van de statement list die bij de "case" hoort, zal PHP + doorgaan met het uitvoeren van statements die bij volgende cases + horen. Zie het volgende voorbeeld: <informalexample> <programlisting role="php"> switch ($i) { case 0: - print "i equals 0"; + print "i is gelijk aan 0"; case 1: - print "i equals 1"; + print "i is gelijk aan 1"; case 2: - print "i equals 2"; + print "i is gelijk aan 2"; } </programlisting> </informalexample> </para> <simpara> - Here, if $i equals to 0, PHP would execute all of the print - statements! If $i equals to 1, PHP would execute the last two - print statements, and only if $i equals to 2, you'd get the - 'expected' behavior and only 'i equals 2' would be displayed. So, - it's important not to forget <literal>break</literal> statements - (even though you may want to avoid supplying them on purpose under - certain circumstances). + Als in het bovenstaande voorbeeld $i gelijk is aan 0, zal PHP + alle print statements uitvoeren! Als $i gelijk is aan 1, dan + zal PHP de laatste twee print statements uitvoeren. Alleen als + $i gelijk is aan 2, krijg je het 'gewenste' resultaat, dan wordt + namelijk alleen het laaste print statement uitgevoerd. Het is dus + belangrijk om geen <literal>break</literal> statements te vergeten. + (Onder bepaalde omstandigeheden, kan het weglaten van de break + statements juist wel nuttig zijn, zoals het voorbeeld hieronder + laat zien. </simpara> <simpara> - In a <literal>switch</literal> statement, the condition is - evaluated only once and the result is compared to each - <literal>case</literal> statement. In an <literal>elseif</literal> - statement, the condition is evaluated again. If your condition is - more complicated than a simple compare and/or is in a tight loop, - a <literal>switch</literal> may be faster. + In een <literal>switch</literal> statement, wordt de conditie + maar één keer geevalueerd, vervolgends wordt de + uitkomst van deze evaluatie vergeleken met de verschillende + <literal>case</literal> statements. Bij een <literal>elseif</literal> + statement wordt de conditie per elsif geevalueerd. Dit betekend dat + als je een gecompliceerde evaluatie hebt, het gebruik van een + <literal>switch</literal> statement wellicht sneller zou werken. </simpara> <para> - The statement list for a case can also be empty, which simply - passes control into the statement list for the next case. + De statement list voor een case kan ook leeg zijn, op deze manier + zal de controle meteen worden doorgegeven aan de volgende case: <informalexample> <programlisting role="php"> switch ($i) { case 0: case 1: case 2: - print "i is less than 3 but not negative"; + print "i is kleiner dan 3 maar niet negatief"; break; case 3: print "i is 3"; @@ -735,51 +739,51 @@ </informalexample> </para> <para> - A special case is the default case. This case matches anything - that wasn't matched by the other cases. For example: + De default case is een speciale. Deze case matched met alles dat + niet is gematched door eerdere cases. Bij voorbeeld: <informalexample> <programlisting role="php"> switch ($i) { case 0: - print "i equals 0"; + print "i is gelijk aan 0"; break; case 1: - print "i equals 1"; + print "i is gelijk aan 1"; break; case 2: - print "i equals 2"; + print "i is gelijk aan 2"; break; default: - print "i is not equal to 0, 1 or 2"; + print "i is niet gelijk aan 0, 1 of 2"; } </programlisting> </informalexample> </para> <para> - The <literal>case</literal> expression may be any expression that - evaluates to a simple type, that is, integer or floating-point - numbers and strings. Arrays or objects cannot be used here unless - they are dereferenced to a simple type. + De <literal>case</literal> expressie mag elke expressie zijn die + evalueerd toe een simpel type, dit zijn integers, floating-point + getallen en strings. Array's en objecten kunnen hier niet voor + worden gebruikt. </para> <para> - The alternative syntax for control structures is supported with - switches. For more information, see <link - linkend="control-structures.alternative-syntax">Alternative syntax - for control structures</link> . + De alternative syntax voor control structures wordt ook ondersteund + voor switches. Voor meer informatie, zie <link + linkend="control-structures.alternative-syntax">Alternatieve syntax + voor control structures</link> . <informalexample> <programlisting role="php"> switch ($i): case 0: - print "i equals 0"; + print "i is gelijk aan 0"; break; case 1: - print "i equals 1"; + print "i is gelijk aan 1"; break; case 2: - print "i equals 2"; + print "i is gelijk aan 2"; break; default: - print "i is not equal to 0, 1 or 2"; + print "i is niet gelijk aan 0, 1 of 2"; endswitch; </programlisting> </informalexample> Index: phpdoc/nl/language/oop.xml diff -u phpdoc/nl/language/oop.xml:1.1 phpdoc/nl/language/oop.xml:1.2 --- phpdoc/nl/language/oop.xml:1.1 Tue Oct 10 15:07:54 2000 +++ phpdoc/nl/language/oop.xml Tue Nov 7 14:13:12 2000 @@ -1,71 +1,78 @@ <chapter id="language.oop"> - <title>Classes and Objects</title> + <title>Classen en Objecten</title> <sect1 id="keyword.class"> <title><literal>class</literal></title> <para> - A class is a collection of variables and functions working with - these variables. A class is defined using the following syntax: + Een class is een verzameling van variabelen en functies die gebruik + maken van deze variabelen. Een class wordt gedefineerd met de volgende + syntax: <informalexample> <programlisting role="php"> <?php class Cart { - var $items; // Items in our shopping cart + var $items; // Items in onze winkelwagen - // Add $num articles of $artnr to the cart + // Voeg $num artikelen met $artnr toe aan de winkelwagen function add_item ($artnr, $num) { - $this->items[$artnr] += $num; + $this->items[$artnr] += $num; } - // Take $num articles of $artnr out of the cart + // Haal $num artikelen met $artnr uit de winkelwagen function remove_item ($artnr, $num) { - if ($this->items[$artnr] > $num) { - $this->items[$artnr] -= $num; + if ($this->items[$artnr] > $num) { + $this->items[$artnr] -= $num; return true; } else { return false; } } } -?> +?> </programlisting> </informalexample> </para> <para> - This defines a class named Cart that consists of an associative - array of articles in the cart and two functions to add and remove - items from this cart. + Deze code defineerd een class "Cart" die bestaan uit een + associatieve array van artikelen in de winkelwagen en twee functies + om artikelen toe te voegen en te verwijderen. </para> <note><simpara> - In PHP 4, only constant initializers for <literal>var</literal> - variables are allowed. Use constructors for non-constant initializers. + In PHP 4 kunnen allen constant initializers voor <literal>var</literal> + variabelen worden gebruikt. Gebruik constructors voor niet-constante + initializaties. </simpara></note> <para> - Classes are types, that is, they are blueprints for actual - variables. You have to create a variable of the desired type with - the new operator. + Classes zijn types, dat wil zeggen dat het blueprints zijn voor echte + variabelen. Je moet een variabele van de classe defineren met de + new operator. De verkregen variabele is nu een instance van die + classe. </para> <informalexample> <programlisting role="php"> - $cart = new Cart; - $cart->add_item("10", 1); + $karretje = new Cart; + $karretje->gadd_item("10", 1); </programlisting> </informalexample> <para> - This creates an object $cart of the class Cart. The function - add_item() of that object is being called to add 1 item of article - number 10 to the cart. </para><para> Classes can be extensions of - other classes. The extended or derived class has all variables and - functions of the base class and what you add in the extended - definition. This is done using the extends keyword. Multiple - inheritance is not supported. + Deze code createerd het object $cart van de classe Cart. De functie + add_item() van het object wordt aangeroepen om 1 item met artikelnummer + 10 toe te voegen aan de winkelwagen. </para> + <para> + Classes kunnen uitbreidingen zijn op andere classes. Deze extended + of derived classes hebben beschikking over alle variabelen en + functies van de base class, en over alle extra variabelen en functies + die je toevoegd in de definitie. Het uitbreiden van classes doe je met + het extends keyword. Meervoudige overerving (zoals het uitbreiden van + classes ook wel eens genoemd wordt) wordt niet ondersteund. + </para> <informalexample> <programlisting role="php"> @@ -73,15 +80,15 @@ var $owner; function set_owner ($name) { - $this->owner = $name; + $this->owner = $name; } } </programlisting> </informalexample> <para> - This defines a class Named_Cart that has all variables and - functions of Cart plus an additional variable $owner and an + Deze code defineerd een class Named_Cart dat alle variabelen en + functies van de Cart plus an additional variable $owner and an additional function set_owner(). You create a named cart the usual way and can now set and get the carts owner. You can still use normal cart functions on named carts: