sander Sun May 26 12:52:40 2002 EDT Modified files: /phpdoc-nl/reference/strings/functions htmlspecialchars.xml levenshtein.xml metaphone.xml nl2br.xml ord.xml parse-str.xml print.xml printf.xml quoted-printable-decode.xml quotemeta.xml setlocale.xml similar-text.xml soundex.xml sprintf.xml sscanf.xml str-pad.xml str-repeat.xml str-replace.xml strcasecmp.xml strcmp.xml strcspn.xml strip-tags.xml stripcslashes.xml stripslashes.xml strlen.xml strnatcasecmp.xml strnatcmp.xml strpos.xml strrev.xml strrpos.xml strspn.xml strstr.xml strtok.xml strtolower.xml strtoupper.xml strtr.xml substr-count.xml substr-replace.xml substr.xml ucfirst.xml ucwords.xml Log: Sync'ed to EN and added revision tags
Index: phpdoc-nl/reference/strings/functions/htmlspecialchars.xml diff -u phpdoc-nl/reference/strings/functions/htmlspecialchars.xml:1.1 phpdoc-nl/reference/strings/functions/htmlspecialchars.xml:1.2 --- phpdoc-nl/reference/strings/functions/htmlspecialchars.xml:1.1 Sun Apr 14 21:37:34 2002 +++ phpdoc-nl/reference/strings/functions/htmlspecialchars.xml Sun May 26 12:52:40 +2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'htmlspecialchars' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.htmlspecialchars"> <refnamediv> <refname>htmlspecialchars</refname> @@ -66,7 +65,9 @@ <example> <title><function>htmlspecialchars</function> example</title> <programlisting role="php"> -$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES); +<![CDATA[ +$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES); +]]> </programlisting> </example> </para> @@ -75,6 +76,11 @@ converteert. Voor conversie van alle entities, zie <function>htmlentities</function>. Let op dat het optionele tweede argument toegevoegd is in PHP 3.0.17 en PHP 4.0.3. + </para> + <para> + Het derde argument definieert welke karakter set moet worden gebruikt in + de conversie. Standaard is dat ISO-8859-1. Dit derde argument was + toegevoegd in PHP 4.1.0. </para> <para> Zie ook <function>htmlentities</function> en Index: phpdoc-nl/reference/strings/functions/levenshtein.xml diff -u phpdoc-nl/reference/strings/functions/levenshtein.xml:1.1 phpdoc-nl/reference/strings/functions/levenshtein.xml:1.2 --- phpdoc-nl/reference/strings/functions/levenshtein.xml:1.1 Sun Apr 14 21:37:34 2002 +++ phpdoc-nl/reference/strings/functions/levenshtein.xml Sun May 26 12:52:40 +2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'levenshtein' in en/ tree in rev 1.12 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.levenshtein"> <refnamediv> <refname>levenshtein</refname> Index: phpdoc-nl/reference/strings/functions/metaphone.xml diff -u phpdoc-nl/reference/strings/functions/metaphone.xml:1.2 phpdoc-nl/reference/strings/functions/metaphone.xml:1.3 --- phpdoc-nl/reference/strings/functions/metaphone.xml:1.2 Mon May 20 12:39:42 2002 +++ phpdoc-nl/reference/strings/functions/metaphone.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'metaphone' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.metaphone"> <refnamediv> <refname>metaphone</refname> @@ -27,11 +26,6 @@ <[EMAIL PROTECTED]> Het is beschreven in ["Practical Algorithms for Programmers", Binstock & Rex, Addison Wesley, 1995]. - <note> - <para> - Deze functie is toegevoegd in PHP 4.0.0. - </para> - </note> </para> </refsect1> </refentry> Index: phpdoc-nl/reference/strings/functions/nl2br.xml diff -u phpdoc-nl/reference/strings/functions/nl2br.xml:1.1 phpdoc-nl/reference/strings/functions/nl2br.xml:1.2 --- phpdoc-nl/reference/strings/functions/nl2br.xml:1.1 Sun Apr 14 21:37:35 2002 +++ phpdoc-nl/reference/strings/functions/nl2br.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'nl2br' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.nl2br"> <refnamediv> <refname>nl2br</refname> @@ -16,6 +15,14 @@ Geeft <parameter>string</parameter> met '<BR>' ingevoegd voor alle newlines. </para> + <note> + <para> + Vanaf PHP 4.0.5 is <function>nl2br</function> XHTML compatible. + Alle versies voor 4.0.5 zullen <parameter>string</parameter> + teruggeven met '<br>' ingevoegd voor elke newline + in plaat van '<br />'. + </para> + </note> <para> Zie ook <function>htmlspecialchars</function>, <function>htmlentities</function> en Index: phpdoc-nl/reference/strings/functions/ord.xml diff -u phpdoc-nl/reference/strings/functions/ord.xml:1.1 phpdoc-nl/reference/strings/functions/ord.xml:1.2 --- phpdoc-nl/reference/strings/functions/ord.xml:1.1 Sun Apr 14 21:37:35 2002 +++ phpdoc-nl/reference/strings/functions/ord.xml Sun May 26 12:52:40 2002 @@ -19,11 +19,17 @@ <example> <title><function>ord</function> example</title> <programlisting role="php"> +<![CDATA[ if (ord ($str) == 10) { - echo "Het eerste karakter van \$str is een line feed.\n"; + echo "Het eerste karakter van \$str is een line feed.\n"; } +]]> </programlisting> </example> + </para> + <para> + Je kunt een ASCII tabel vinden op <ulink + url="&url.asciitable;">&url.asciitable;</ulink>. </para> <simpara> Zie ook <function>chr</function>. Index: phpdoc-nl/reference/strings/functions/parse-str.xml diff -u phpdoc-nl/reference/strings/functions/parse-str.xml:1.1 phpdoc-nl/reference/strings/functions/parse-str.xml:1.2 --- phpdoc-nl/reference/strings/functions/parse-str.xml:1.1 Sun Apr 14 21:37:35 2002 +++ phpdoc-nl/reference/strings/functions/parse-str.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'parse-str' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.parse-str"> <refnamediv> <refname>parse_str</refname> @@ -19,17 +18,28 @@ scope. Als de tweede parameter <parameter>arr</parameter> ook meegegeven wordt, worden de variabelen opgeslagen als array elementen. </para> + <note> + <para> + Het tweede, optionele parameter was toegevoegd in PHP 4.0.3. + </para> + </note> <para> <example> <title>Het gebruik van <function>parse_str</function></title> <programlisting role="php"> -$str = "first=waarde&second[]=dit+werkt&second[]=nogeen"; +<![CDATA[ +$str = "first=waarde&second[]=dit+werkt&second[]=nogeen"; parse_str($str); -echo $first; /* print "waarde" */ -echo $second[0]; /* print "dit werkt" */ -echo $second[1]; /* print "nogeen" */ +echo $first; /* print "waarde" */ +echo $second[0]; /* print "dit werkt" */ +echo $second[1]; /* print "nogeen" */ +]]> </programlisting> </example> + </para> + <para> + Zie ook <function>set_magic_quotes_runtime</function> en + <function>urldecode</function>. </para> </refsect1> </refentry> Index: phpdoc-nl/reference/strings/functions/print.xml diff -u phpdoc-nl/reference/strings/functions/print.xml:1.1 phpdoc-nl/reference/strings/functions/print.xml:1.2 --- phpdoc-nl/reference/strings/functions/print.xml:1.1 Sun Apr 14 21:37:35 2002 +++ phpdoc-nl/reference/strings/functions/print.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'print' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.print"> <refnamediv> <refname>print</refname> @@ -13,8 +12,54 @@ <methodparam><type>string</type><parameter>arg</parameter></methodparam> </methodsynopsis> <simpara> - Output <parameter>arg</parameter>. + Output <parameter>arg</parameter>. &return.success; </simpara> + <para> + <function>print</function> is eigenlijk geen functie (het is een language + construct) dus het is niet noodzakelijk om haakjes te gebruiken. In + tegenstelling tot <function>echo</function> kan <function>print</function> + worden aangeroepen als een <link + linkend="functions.variable-functions">variabele functie</link>. + </para> + <example> + <title><function>print</function> voorbeeld</title> + <programlisting role="php"> +<![CDATA[ +<?php +print("Hallo Wereld"); + +print "print() werkt ook zonder haakjes."; + +print "Dit overspant +meerdere regels. De newlines zullen ook +in de output worden opgenomen"; + +print "Dit overspant\nmeerdere regels. The newlines zullen ook in de\noutput worden +opgenomen."; + +print "het escapen van karakters doe je \"zo\"."; + +// Je kan ook variabelen in een echo statement gebruiken +$foo = "foobar"; +$bar = "barbaz"; + +print "foo is $foo"; // foo is foobar + +// Met enkele aanhalingstekens zal de variabelnaam worden geprint, en niet de waarde +print 'foo is $foo'; // foo is $foo + +// Als je niet andere tekens wil printen, kan je gewoon de variabelen echo-en +print $foo; // foobar + +print <<END +Hier wordt de "here document" syntax gebruikt om meerdere +regels met de $variabele vervangen door hun waarden. Merk op +dat the here document beëndiger alleen op één +regel moet staan met alleen een puntkomma zonder extra whitespace. +END; +?> +]]> + </programlisting> + </example> <simpara> Zie ook: <function>echo</function>, <function>printf</function>, en <function>flush</function>. Index: phpdoc-nl/reference/strings/functions/printf.xml diff -u phpdoc-nl/reference/strings/functions/printf.xml:1.1 phpdoc-nl/reference/strings/functions/printf.xml:1.2 --- phpdoc-nl/reference/strings/functions/printf.xml:1.1 Sun Apr 14 21:37:35 2002 +++ phpdoc-nl/reference/strings/functions/printf.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'printf' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.printf"> <refnamediv> <refname>printf</refname> Index: phpdoc-nl/reference/strings/functions/quoted-printable-decode.xml diff -u phpdoc-nl/reference/strings/functions/quoted-printable-decode.xml:1.1 phpdoc-nl/reference/strings/functions/quoted-printable-decode.xml:1.2 --- phpdoc-nl/reference/strings/functions/quoted-printable-decode.xml:1.1 Sun Apr 14 21:37:35 2002 +++ phpdoc-nl/reference/strings/functions/quoted-printable-decode.xml Sun May 26 +12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'quoted-printable-decode' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.quoted-printable-decode"> <refnamediv> <refname>quoted_printable_decode</refname> Index: phpdoc-nl/reference/strings/functions/quotemeta.xml diff -u phpdoc-nl/reference/strings/functions/quotemeta.xml:1.1 phpdoc-nl/reference/strings/functions/quotemeta.xml:1.2 --- phpdoc-nl/reference/strings/functions/quotemeta.xml:1.1 Sun Apr 14 21:37:35 2002 +++ phpdoc-nl/reference/strings/functions/quotemeta.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'quotemeta' in en/ tree in rev 1.139 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.quotemeta"> <refnamediv> <refname>quotemeta</refname> Index: phpdoc-nl/reference/strings/functions/setlocale.xml diff -u phpdoc-nl/reference/strings/functions/setlocale.xml:1.1 phpdoc-nl/reference/strings/functions/setlocale.xml:1.2 --- phpdoc-nl/reference/strings/functions/setlocale.xml:1.1 Sun Apr 14 21:37:35 2002 +++ phpdoc-nl/reference/strings/functions/setlocale.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'setlocale' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.setlocale"> <refnamediv> <refname>setlocale</refname> @@ -69,6 +68,22 @@ functionaliteit niet geimplementeerd is op het platform, de gespecifieerde locale niet bestaat of als de categorie naam incorrect is. Een incorrecte categorie naam zal ook een waarschuwingsboodschap genereren. + </para> + <para> + <example> + <title><function>setlocale</function> voorbeeld</title> + <programlisting role="php"> +<![CDATA[ +<?php + /* zet de locale op Dutch */ + setlocale (LC_ALL, 'nl_NL'); + + /* Output: vrijdag 22 december 1978 */ + echo strftime ("%A %e %B %Y", mktime (0, 0, 0, 12, 22, 1978)); +?> +]]> + </programlisting> + </example> </para> </refsect1> </refentry> Index: phpdoc-nl/reference/strings/functions/similar-text.xml diff -u phpdoc-nl/reference/strings/functions/similar-text.xml:1.1 phpdoc-nl/reference/strings/functions/similar-text.xml:1.2 --- phpdoc-nl/reference/strings/functions/similar-text.xml:1.1 Sun Apr 14 21:37:35 2002 +++ phpdoc-nl/reference/strings/functions/similar-text.xml Sun May 26 12:52:40 +2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'similar-text' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.similar-text"> <refnamediv> <refname>similar_text</refname> Index: phpdoc-nl/reference/strings/functions/soundex.xml diff -u phpdoc-nl/reference/strings/functions/soundex.xml:1.1 phpdoc-nl/reference/strings/functions/soundex.xml:1.2 --- phpdoc-nl/reference/strings/functions/soundex.xml:1.1 Sun Apr 14 21:37:36 2002 +++ phpdoc-nl/reference/strings/functions/soundex.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'soundex' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.soundex"> <refnamediv> <refname>soundex</refname> @@ -32,13 +31,15 @@ <example> <title>Soundex Voorbeelden</title> <programlisting role="php"> -soundex ("Euler") == soundex ("Ellery") == 'E460'; -soundex ("Gauss") == soundex ("Ghosh") == 'G200'; -soundex ("Hilbert") == soundex ("Heilbronn") == 'H416'; -soundex ("Knuth") == soundex ("Kant") == 'K530'; -soundex ("Lloyd") == soundex ("Ladd") == 'L300'; -soundex ("Lukasiewicz") == soundex ("Lissajous") == 'L222'; - </programlisting> +<![CDATA[ +soundex ("Euler") == soundex ("Ellery") == 'E460'; +soundex ("Gauss") == soundex (";Ghosh") == 'G200'; +soundex ("Hilbert") == soundex ("Heilbronn") == 'H416'; +soundex ("Knuth") == soundex ("Kant") == 'K530'; +soundex ("Lloyd") == soundex ("Ladd") == 'L300'; +soundex ("Lukasiewicz") == soundex ("Lissajous") == 'L222'; +]]> +</programlisting> </example> </para> </refsect1> Index: phpdoc-nl/reference/strings/functions/sprintf.xml diff -u phpdoc-nl/reference/strings/functions/sprintf.xml:1.1 phpdoc-nl/reference/strings/functions/sprintf.xml:1.2 --- phpdoc-nl/reference/strings/functions/sprintf.xml:1.1 Sun Apr 14 21:37:36 2002 +++ phpdoc-nl/reference/strings/functions/sprintf.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'sprintf' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.sprintf"> <refnamediv> <refname>sprintf</refname> @@ -111,6 +110,57 @@ </listitem> </orderedlist> </para> + <para> + Sinds PHP 4.0.6 wordt argument nummering/swapping ondersteund in de + format string. Hier is een voorbeeld: + <example> + <title>Argument swapping</title> + <programlisting role="php"> +<![CDATA[ +$format = "Er zijn %d apen in de %s"; +printf($format,$num,$plaats); +]]> + </programlisting> + </example> + Dit zou bijvoobeeld "Er zijn 5 apen in de boom" kunnen printen. Maar stel + nou dat we de format strings in een apart bestand zetten, bijvoorbeeld + omdat we het willen internationalizeren en we herschrijven het als: + <example> + <title>Argument swapping</title> + <programlisting role="php"> +<![CDATA[ +$format = "In de %s zitten %d apen"; +printf($format,$num,$plaats); +]]> + </programlisting> + </example> + Nu hebben we een probleem. De volgorde van de placeholders in de format + string komt niet overeen met de volgorde van de argumenten. We willen de + code ongewijzigd houden en simpelweg aangeven naar welke argumenten de + placeholders verwijzen. We kunnen dan de format string als volgt + schrijven: + <example> + <title>Argument swapping</title> + <programlisting role="php"> +<![CDATA[ +$format = "In de %2\$s zitten %1\$d apen"; +printf($format,$num,$plaats); +]]> + </programlisting> + </example> + En bijkomend voordeel is dat je de placeholders kan herhalen zonder meer + argumenten in de code toe te voegen. Bijvoorbeeld: + <example> + <title>Argument swapping</title> + <programlisting role="php"> +<![CDATA[ +$format = "In de %2\$s zitten %1\$d apen. + Dat is een mooie %2\$s vol met %1\$s apen."; +printf($format,$num,$plaats); +]]> + </programlisting> + </example> + </para> <simpara> Zie ook: <function>printf</function>, <function>sscanf</function>, <function>fscanf</function>, en <function>number_format</function>. @@ -122,18 +172,22 @@ <example> <title><function>sprintf</function>: nul-padded integers</title> <programlisting role="php"> -$isodate = sprintf ("%04d-%02d-%02d", $year, $month, $day); +<![CDATA[ +$isodate = sprintf("%04d-%02d-%02d", $jaar, $maand, $dag); +]]> </programlisting> </example> <example> <title><function>sprintf</function>: formatteren van valuta-eenheden</title> <programlisting role="php"> +<![CDATA[ $money1 = 68.75; $money2 = 54.35; $money = $money1 + $money2; -// echo $money zal geven "123.1"; -$formatted = sprintf ("%01.2f", $money); -// echo $formatted zal geven "123.10" +// echo $money zal geven "123.1"; +$formatted = sprintf ("%01.2f", $money); +// echo $formatted zal geven "123.10" +]]> </programlisting> </example> </para> Index: phpdoc-nl/reference/strings/functions/sscanf.xml diff -u phpdoc-nl/reference/strings/functions/sscanf.xml:1.1 phpdoc-nl/reference/strings/functions/sscanf.xml:1.2 --- phpdoc-nl/reference/strings/functions/sscanf.xml:1.1 Sun Apr 14 21:37:36 2002 +++ phpdoc-nl/reference/strings/functions/sscanf.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'sscanf' in en/ tree in rev 1.33 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.sscanf"> <refnamediv> <refname>sscanf</refname> @@ -18,18 +17,20 @@ De functie <function>sscanf</function> is de input analoog van <function>printf</function>. <function>sscanf</function> leest van de string <parameter>str</parameter> en interpreteert die volgens - de gespecificeerde format. Als alleen twee parameters zouden worden - meegegeven met deze functie, zal de geparste waarde worden teruggeven - als een array. + de gespecificeerde <parameter>format</parameter>. Als alleen twee parameters + zouden worden meegegeven met deze functie, zal de geparste waarde worden + teruggeven als een array. <example> - <title><function>sscanf</function> Example</title> + <title><function>sscanf</function> voorbeeld</title> <programlisting role="php"> +<![CDATA[ // ophalen van serial number -$serial = sscanf("SN/2350001","SN/%d"); +$serial = sscanf("SN/2350001","SN/%d"); // en de datum van productie $mandate = "January 01 2000"; -list($month, $day, $year) = sscanf($mandate,"%s %d %d"); -echo "Item $serial was gefabriceerd op: $year-".substr($month,0,3)."-$day\n"; +list($month, $day, $year) = sscanf($mandate,"%s %d %d";); +echo "Item $serial was gefabriceerd op: $year-".substr($month,0,3)."-$day\n"; +]]> </programlisting> </example> Als optionele parameters worden meegegeven, zal de functie het aantal @@ -38,13 +39,15 @@ <example> <title><function>sscanf</function> - using optional parameters</title> <programlisting role="php"> +<![CDATA[ // haal auteursinfo op en genereer DocBook entry -$auth = "24\tLewis Carroll"; -$n = sscanf($auth,"%d\t%s %s", &$id, &$first, &$last); -echo "<author id='$id'> -<firstname>$first</firstname> -<surname>$last</surname> -</author>\n"; +$auth = "24\tLewis Carroll"; +$n = sscanf($auth,"%d\t%s %s", &$id, &$first, &$last); +echo "<author id='$id'> +<firstname>$first<firstname> +<surname>$last</surname> +</author>\n"; +]]> </programlisting> </example> </para> Index: phpdoc-nl/reference/strings/functions/str-pad.xml diff -u phpdoc-nl/reference/strings/functions/str-pad.xml:1.1 phpdoc-nl/reference/strings/functions/str-pad.xml:1.2 --- phpdoc-nl/reference/strings/functions/str-pad.xml:1.1 Sun Apr 14 21:37:36 2002 +++ phpdoc-nl/reference/strings/functions/str-pad.xml Sun May 26 12:52:40 2002 @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'str-pad' in en/ tree in rev 1.26 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.str-pad"> <refnamediv> <refname>str_pad</refname> - <refpurpose>Pad een string naar een bepaalde lengte met een andere string</refpurpose> + <refpurpose>Vul een string naar een bepaalde lengte aan met een andere +string</refpurpose> </refnamediv> <refsect1> <title>Omschrijving</title> @@ -23,27 +22,26 @@ met spaties, anders wordt de string gepad met karakters van <parameter>pad_string</parameter> tot aan het opgegeven maximum. </para> - <para> Optioneel argument <parameter>pad_type</parameter> kan zijn STR_PAD_RIGHT, STR_PAD_LEFT, of STR_PAD_BOTH. Als <parameter>pad_type</parameter> niet is gegeven, wordt uitgegaan van STR_PAD_RIGHT. </para> - <para> Als de waarde van <parameter>pad_length</parameter> negatief is of kleiner dan de lengte van de input string, vindt er geen padding plaats. </para> - <para> <example> <title><function>str_pad</function> voorbeeld</title> <programlisting role="php"> -$input = "Alien"; -print str_pad($input, 10); // produceert "Alien " -print str_pad($input, 10, "-=", STR_PAD_LEFT); // produceert "-=-=-Alien" -print str_pad($input, 10, "_", STR_PAD_BOTH); // produceert "__Alien___" +<![CDATA[ +$input = "Alien"; +print str_pad($input, 10); // produceert "Alien " +print str_pad($input, 10, "-=", STR_PAD_LEFT); // produceert "-=-=-Alien" +print str_pad($input, 10, "_", STR_PAD_BOTH); // produceert "__Alien___" +]]> </programlisting> </example> </para> Index: phpdoc-nl/reference/strings/functions/str-repeat.xml diff -u phpdoc-nl/reference/strings/functions/str-repeat.xml:1.2 phpdoc-nl/reference/strings/functions/str-repeat.xml:1.3 --- phpdoc-nl/reference/strings/functions/str-repeat.xml:1.2 Mon May 20 12:39:42 2002 +++ phpdoc-nl/reference/strings/functions/str-repeat.xml Sun May 26 12:52:40 +2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'str-repeat' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.3 Maintainer: sander Status: ready --> <refentry id="function.str-repeat"> <refnamediv> <refname>str_repeat</refname> @@ -22,20 +21,18 @@ <title><function>str_repeat</function> voorbeeld</title> <programlisting role="php"> <![CDATA[ -<?php echo str_repeat ('-=', 10); -?> ]]> </programlisting> </example> <para> Dit geeft "-=-=-=-=-=-=-=-=-=-=". </para> - <note> - <para> - Deze functie is toegevoegd in PHP 4.0.0. - </para> - </note> + <para> + Zie ook <link linkend="control-structures.for">for</link>, + <function>str_pad</function> en + <function>substr_count</function>. + </para> </refsect1> </refentry> Index: phpdoc-nl/reference/strings/functions/str-replace.xml diff -u phpdoc-nl/reference/strings/functions/str-replace.xml:1.2 phpdoc-nl/reference/strings/functions/str-replace.xml:1.3 --- phpdoc-nl/reference/strings/functions/str-replace.xml:1.2 Mon May 20 12:39:42 2002 +++ phpdoc-nl/reference/strings/functions/str-replace.xml Sun May 26 12:52:40 +2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'str-replace' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.str-replace"> <refnamediv> <refname>str_replace</refname> @@ -11,22 +10,45 @@ <refsect1> <title>Omschrijving</title> <methodsynopsis> - <type>string</type><methodname>str_replace</methodname> - <methodparam><type>string</type><parameter>needle</parameter></methodparam> - <methodparam><type>string</type><parameter>str</parameter></methodparam> - <methodparam><type>string</type><parameter>haystack</parameter></methodparam> + <type>mixed</type><methodname>str_replace</methodname> + <methodparam><type>mixed</type><parameter>needle</parameter></methodparam> + <methodparam><type>mixed</type><parameter>str</parameter></methodparam> + <methodparam><type>mixed</type><parameter>haystack</parameter></methodparam> </methodsynopsis> <para> Deze functie vervangt alle voorkomens van <parameter>needle</parameter> in <parameter>haystack</parameter> met de gegeven <parameter>str</parameter>. Als je geen al te toffe vervangingsregels nodig hebt, wordt aangeraden - om altijd deze functie te gebruiken in plaats van <function>ereg_replace</function>. + om altijd deze functie te gebruiken in plaats van +<function>ereg_replace</function> + or <function>preg_replace</function>. + </para> + <para> + Vanaf PHP 4.0.5 kan elk parameter van str_replace een array zijn. + </para> + <para> + Als <parameter>subject</parameter> een array is, dan wordt de + vervangoperatie uitgevoerd met elk onderdeel van + <parameter>subject</parameter>, en zal dan een array teruggeven. + </para> + <para> + Als <parameter>search</parameter> en <parameter>replace</parameter> + arrays zijn, dan zal <function>str_replace</function> een waarde van + beide arrays worden genomen en zal de vervangoperatie met die waarden + plaatsvinden op <parameter>subject</parameter>. Als + <parameter>replace</parameter> minder waarden heeft dan + <parameter>search</parameter>, dan zal een lege string worden gebruikt + voor de rest van de vervangingswaarden. Als <parameter>search</parameter> + een array is, en <parameter>replace</parameter> is een string, dan zal + die string worden gebruikt voor elke waarde van + <parameter>search</parameter>. </para> <para> <example> <title><function>str_replace</function> voorbeeld</title> <programlisting role="php"> -$bodytag = str_replace ("%body%", "black", "<body text=%body%>"); +<![CDATA[ +$bodytag = str_replace ("%body%", "black", "<body text=%body%>"); +]]> </programlisting> </example> </para> @@ -40,8 +62,8 @@ </para> </note> <para> - Zie ook <function>ereg_replace</function> en - <function>strtr</function>. + Zie ook <function>ereg_replace</function>, + <function>preg_replace</function> en <function>strtr</function>. </para> </refsect1> </refentry> Index: phpdoc-nl/reference/strings/functions/strcasecmp.xml diff -u phpdoc-nl/reference/strings/functions/strcasecmp.xml:1.3 phpdoc-nl/reference/strings/functions/strcasecmp.xml:1.4 --- phpdoc-nl/reference/strings/functions/strcasecmp.xml:1.3 Mon May 20 12:39:42 2002 +++ phpdoc-nl/reference/strings/functions/strcasecmp.xml Sun May 26 12:52:40 +2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'strcasecmp' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.strcasecmp"> <refnamediv> <refname>strcasecmp</refname> Index: phpdoc-nl/reference/strings/functions/strcmp.xml diff -u phpdoc-nl/reference/strings/functions/strcmp.xml:1.2 phpdoc-nl/reference/strings/functions/strcmp.xml:1.3 --- phpdoc-nl/reference/strings/functions/strcmp.xml:1.2 Mon May 20 07:32:22 2002 +++ phpdoc-nl/reference/strings/functions/strcmp.xml Sun May 26 12:52:40 2002 @@ -23,8 +23,8 @@ <simpara> Zie ook <function>ereg</function>, <function>strcasecmp</function>, <function>substr</function>, - <function>stristr</function>, <function>strncmp</function>, - en <function>strstr</function>. + <function>stristr</function>, <function>strncasecmp</function>, + <function>strncmp</function>, en <function>strstr</function>. </simpara> </refsect1> </refentry> Index: phpdoc-nl/reference/strings/functions/strcspn.xml diff -u phpdoc-nl/reference/strings/functions/strcspn.xml:1.1 phpdoc-nl/reference/strings/functions/strcspn.xml:1.2 --- phpdoc-nl/reference/strings/functions/strcspn.xml:1.1 Sun Apr 14 21:37:38 2002 +++ phpdoc-nl/reference/strings/functions/strcspn.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'strcspn' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.strcspn"> <refnamediv> <refname>strcspn</refname> Index: phpdoc-nl/reference/strings/functions/strip-tags.xml diff -u phpdoc-nl/reference/strings/functions/strip-tags.xml:1.2 phpdoc-nl/reference/strings/functions/strip-tags.xml:1.3 --- phpdoc-nl/reference/strings/functions/strip-tags.xml:1.2 Mon May 20 12:39:42 2002 +++ phpdoc-nl/reference/strings/functions/strip-tags.xml Sun May 26 12:52:40 +2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'strip-tags' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.strip-tags"> <refnamediv> <refname>strip_tags</refname> @@ -24,10 +23,29 @@ <note> <para> De <parameter>allowable_tags</parameter> parameter is toegevoegd in PHP - 3.0.13, PHP4B3. + 3.0.13 en PHP 4.0B3. </para> </note> </para> + <para> + <example> + <title><function>strip_tags</function> voorbeeld</title> + <programlisting role="php"> +<![CDATA[ +$string = strip_tags($string, '<a><b><i><u>'); +]]> + </programlisting> + </example> + </para> + <warning> + <para> + Deze functie verandert geen attributen in de tags die je toestaat met + <parameter>allowable_tags</parameter>, waaronder de + <literal>style</literal> and <literal>onmouseover</literal> attributen + die een slechtwillende gerbuiken kan misbruiken bij het posten van tekst + dat gezien kan worden door andere bezoekers. + </para> + </warning> </refsect1> </refentry> Index: phpdoc-nl/reference/strings/functions/stripcslashes.xml diff -u phpdoc-nl/reference/strings/functions/stripcslashes.xml:1.1 phpdoc-nl/reference/strings/functions/stripcslashes.xml:1.2 --- phpdoc-nl/reference/strings/functions/stripcslashes.xml:1.1 Sun Apr 14 21:37:38 2002 +++ phpdoc-nl/reference/strings/functions/stripcslashes.xml Sun May 26 12:52:40 +2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'stripcslashes' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.stripcslashes"> <refnamediv> <refname>stripcslashes</refname> @@ -18,11 +17,6 @@ Geeft een string terug met backslashes gestript. Herkent C-achtige <literal>\n</literal>, <literal>\r</literal> ..., octale en hexadecimale representatie. - <note> - <simpara> - Toegevoegd in PHP4b3-dev. - </simpara> - </note> </para> <simpara> Zie ook <function>addcslashes</function>. Index: phpdoc-nl/reference/strings/functions/stripslashes.xml diff -u phpdoc-nl/reference/strings/functions/stripslashes.xml:1.1 phpdoc-nl/reference/strings/functions/stripslashes.xml:1.2 --- phpdoc-nl/reference/strings/functions/stripslashes.xml:1.1 Sun Apr 14 21:37:38 2002 +++ phpdoc-nl/reference/strings/functions/stripslashes.xml Sun May 26 12:52:40 +2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'stripslashes' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.stripslashes"> <refnamediv> <refname>stripslashes</refname> Index: phpdoc-nl/reference/strings/functions/strlen.xml diff -u phpdoc-nl/reference/strings/functions/strlen.xml:1.1 phpdoc-nl/reference/strings/functions/strlen.xml:1.2 --- phpdoc-nl/reference/strings/functions/strlen.xml:1.1 Sun Apr 14 21:37:39 2002 +++ phpdoc-nl/reference/strings/functions/strlen.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'strlen' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.strlen"> <refnamediv> <refname>strlen</refname> Index: phpdoc-nl/reference/strings/functions/strnatcasecmp.xml diff -u phpdoc-nl/reference/strings/functions/strnatcasecmp.xml:1.1 phpdoc-nl/reference/strings/functions/strnatcasecmp.xml:1.2 --- phpdoc-nl/reference/strings/functions/strnatcasecmp.xml:1.1 Sun Apr 14 21:37:39 2002 +++ phpdoc-nl/reference/strings/functions/strnatcasecmp.xml Sun May 26 12:52:40 +2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'strnatcasecmp' in en/ tree in rev 1.38 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.strnatcasecmp"> <refnamediv> <refname>strnatcasecmp</refname> Index: phpdoc-nl/reference/strings/functions/strnatcmp.xml diff -u phpdoc-nl/reference/strings/functions/strnatcmp.xml:1.1 phpdoc-nl/reference/strings/functions/strnatcmp.xml:1.2 --- phpdoc-nl/reference/strings/functions/strnatcmp.xml:1.1 Sun Apr 14 21:37:39 2002 +++ phpdoc-nl/reference/strings/functions/strnatcmp.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'strnatcmp' in en/ tree in rev 1.38 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.strnatcmp"> <refnamediv> <refname>strnatcmp</refname> @@ -23,36 +22,40 @@ computer string sorting algoritmes (gebruikt in <function>strcmp</function>) kan je hieronder vinden. <informalexample> - <programlisting> -$arr1 = $arr2 = array ("img12.png","img10.png","img2.png","img1.png"); -echo "Standard string vergelijking\n"; -usort($arr1,"strcmp"); + <programlisting role="php"> +<![CDATA[ +$arr1 = $arr2 = array ("img12.png","img10.png","img2.png","img1.png"); +echo "Standard string vergelijking\n"; +usort($arr1,"strcmp"); print_r($arr1); -echo "\nNatural order string vergelijking\n"; -usort($arr2,"strnatcmp"); +echo "\nNatural order string vergelijking\n"; +usort($arr2,"strnatcmp"); print_r($arr2); +]]> </programlisting> </informalexample> De code hierboven zal de volgende output genereren: <informalexample> <programlisting> +<![CDATA[ Standaard string vergelijking Array ( - [0] => img1.png - [1] => img10.png - [2] => img12.png - [3] => img2.png + [0] => img1.png + [1] => img10.png + [2] => img12.png + [3] => img2.png ) Natural order string vergelijking Array ( - [0] => img1.png - [1] => img2.png - [2] => img10.png - [3] => img12.png + [0] => img1.png + [1] => img2.png + [2] => img10.png + [3] => img12.png ) +]]> </programlisting> </informalexample> Voor meer informatie zie: Martin Pool's <ulink @@ -72,9 +75,9 @@ Zie ook <function>ereg</function>, <function>strcasecmp</function>, <function>substr</function>, <function>stristr</function>, <function>strcmp</function>, - <function>strncmp</function>, <function>strnatcasecmp</function>, - <function>strstr</function>, <function>natsort</function> en - <function>natcasesort</function>. + <function>strncmp</function>, <function>strncasecmp</function> + <function>strnatcasecmp</function>, <function>strstr</function>, + <function>natsort</function> en <function>natcasesort</function>. </simpara> </refsect1> </refentry> Index: phpdoc-nl/reference/strings/functions/strpos.xml diff -u phpdoc-nl/reference/strings/functions/strpos.xml:1.3 phpdoc-nl/reference/strings/functions/strpos.xml:1.4 --- phpdoc-nl/reference/strings/functions/strpos.xml:1.3 Mon May 20 12:39:42 2002 +++ phpdoc-nl/reference/strings/functions/strpos.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'strpos' in en/ tree in rev 1.8 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.strpos"> <refnamediv> <refname>strpos</refname> Index: phpdoc-nl/reference/strings/functions/strrev.xml diff -u phpdoc-nl/reference/strings/functions/strrev.xml:1.1 phpdoc-nl/reference/strings/functions/strrev.xml:1.2 --- phpdoc-nl/reference/strings/functions/strrev.xml:1.1 Sun Apr 14 21:37:40 2002 +++ phpdoc-nl/reference/strings/functions/strrev.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'strrev' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.strrev"> <refnamediv> <refname>strrev</refname> @@ -14,6 +13,16 @@ </methodsynopsis> <para> Geeft <parameter>string</parameter> omgekeerd. + <example> + <title>Een string omdraaien met <function>strrev</function></title> + <programlisting role="php"> +<![CDATA[ +<php +echo strrev("Hallo wereld!"); // outputs "!dlerew ollaH" +?> +]]> + </programlisting> + </example> </para> </refsect1> </refentry> Index: phpdoc-nl/reference/strings/functions/strrpos.xml diff -u phpdoc-nl/reference/strings/functions/strrpos.xml:1.1 phpdoc-nl/reference/strings/functions/strrpos.xml:1.2 --- phpdoc-nl/reference/strings/functions/strrpos.xml:1.1 Sun Apr 14 21:37:40 2002 +++ phpdoc-nl/reference/strings/functions/strrpos.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'strrpos' in en/ tree in rev 1.8 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.strrpos"> <refnamediv> <refname>strrpos</refname> @@ -25,6 +24,30 @@ <para> Als <parameter>needle</parameter> niet wordt gevonden retourneert deze functie &false;. + <note> + <para> + De return waardes "karakter gevonden op plaats 0" en + "karakter niet gevonden" worden nogal eens door elkaar + gehaald. Hier is de code om het verschil te detecteren: + <informalexample> + <programlisting role="php"> +<![CDATA[ +// in PHP 4.0b3 en nieuwer: +$pos = strrpos($mystring, "b"); +if ($pos === false) { // opmerking: drie gelij aan tekens + // niet gevonden... +} + +// in versies ouder dan 4.0b3: +$pos = strrpos($mystring, "b"); +if (is_string($pos) && !$pos) { + // niet gevonden... +} +]]> + </programlisting> + </informalexample> + </para> + </note> </para> <para> Als <parameter>needle</parameter> geen string is, wordt het Index: phpdoc-nl/reference/strings/functions/strspn.xml diff -u phpdoc-nl/reference/strings/functions/strspn.xml:1.1 phpdoc-nl/reference/strings/functions/strspn.xml:1.2 --- phpdoc-nl/reference/strings/functions/strspn.xml:1.1 Sun Apr 14 21:37:41 2002 +++ phpdoc-nl/reference/strings/functions/strspn.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'strspn' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.strspn"> <refnamediv> <refname>strspn</refname> @@ -23,10 +22,13 @@ <para> <informalexample> <programlisting role="php"> -strspn ("42 is het antwoord, wat is de vraag ...", "1234567890"); +<![CDATA[ +$var = strspn ("42 is het antwoord, wat is de vraag ...", "1234567890"); +]]> </programlisting> <para> - zal 2 als resultaat geven. + zal 2 in <varname>$var</varname> stoppen, omdat de string "42" het + langste segment bestaande uit de tekens "1234567890" is. </para> </informalexample> </para> Index: phpdoc-nl/reference/strings/functions/strstr.xml diff -u phpdoc-nl/reference/strings/functions/strstr.xml:1.1 phpdoc-nl/reference/strings/functions/strstr.xml:1.2 --- phpdoc-nl/reference/strings/functions/strstr.xml:1.1 Sun Apr 14 21:37:41 2002 +++ phpdoc-nl/reference/strings/functions/strstr.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'strstr' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.strstr"> <refnamediv> <refname>strstr</refname> @@ -38,16 +37,19 @@ <example> <title><function>strstr</function> voorbeeld</title> <programlisting role="php"> -$email = '[EMAIL PROTECTED]'; +<![CDATA[ +$email = '[EMAIL PROTECTED]'; $domain = strstr ($email, '@'); -print $domain; // print @designmultimedia.com +print $domain; // zal @example.com printen +]]> </programlisting> </example> </para> <para> - Zie ook <function>stristr</function>, - <function>strrchr</function>, <function>substr</function>, en - <function>ereg</function>. + Zie ook <function>ereg</function>, <function>preg_match</function>, + <function>strchr</function>, <function>stristr</function>, + <function>strpos</function>, <function>strrchr</function> en + <function>substr</function>. </para> </refsect1> </refentry> Index: phpdoc-nl/reference/strings/functions/strtok.xml diff -u phpdoc-nl/reference/strings/functions/strtok.xml:1.1 phpdoc-nl/reference/strings/functions/strtok.xml:1.2 --- phpdoc-nl/reference/strings/functions/strtok.xml:1.1 Sun Apr 14 21:37:41 2002 +++ phpdoc-nl/reference/strings/functions/strtok.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'strtok' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.strtok"> <refnamediv> <refname>strtok</refname> @@ -14,19 +13,25 @@ <methodparam><type>string</type><parameter>arg2</parameter></methodparam> </methodsynopsis> <para> - <function>strtok</function> wordt gebruikt om een string in - tokens te verdelen. Bijvoorbeeld als je een string hebt als + <function>strtok</function> wordt gebruikt om een string + (<parameter>arg1</parameter>) in kortere strings (tokens) te verdelen, + waarvan elk token gescheiden wordt elk teken uit + <parameter>arg2</parameter>. + Bijvoorbeeld als je een string hebt als "Dit is een voorbeeld string" zou je deze kunnen verdelen in individuele woorden door de spatie als token te geven. <example> <title><function>strtok</function> voorbeeld</title> <programlisting role="php"> -$string = "Dit is een voorbeeld string"; -$tok = strtok ($string," "); +<![CDATA[ +$string = "Dit is\teen voorbeeld\nstring"; +/* Gebruik ook tabs en newlines als verdeeltekens */ +$tok = strtok ($string, " \n\t"); while ($tok) { echo "Word=$tok<br>"; $tok = strtok (" "); } +]]> </programlisting> </example> </para> @@ -40,6 +45,44 @@ meerdere tokens in de token parameter megeven. De string zal verdeeld worden wanneer ook maar 1 karakter in het argument gevonden is. + </para> + <para> + Het resultaat als een leeg gedeelte werd gevonden is veranderd in PHP + 4.1.0. Het oude gedrag was dat dan een lege string terug werd gegeven, + maar het nieuwe, juiste gedrag negeert gewoon dat lege gedeelte. + The behavior when an empty part was found changed with PHP 4.1.0. The old + behavior returned an empty string, while the new, correct, behavior + simply skips the part of the string: + <example> + <title>Oude <function>strtok</function> gedrag</title> + <programlisting role="php"> +<![CDATA[ + $first_token = strtok('/iets', '/'); + $second_token = strtok('/'); + var_dump ($first_token, $second_token); + +/* Output: + string(0) "" + string(4) "iets" +*/ +]]> + </programlisting> + </example> + <example> + <title>Nieuwe <function>strtok</function> gedrag</title> + <programlisting role="php"> +<![CDATA[ + $first_token = strtok('/iets', '/'); + $second_token = strtok('/'); + var_dump ($first_token, $second_token); + +/* Output: + string(4) "iets" + bool(false) +*/ +]]> + </programlisting> + </example> </para> <para> Wees trouwens voorzichtig met gevallen wanneer je tokens gelijk Index: phpdoc-nl/reference/strings/functions/strtolower.xml diff -u phpdoc-nl/reference/strings/functions/strtolower.xml:1.1 phpdoc-nl/reference/strings/functions/strtolower.xml:1.2 --- phpdoc-nl/reference/strings/functions/strtolower.xml:1.1 Sun Apr 14 21:37:41 2002 +++ phpdoc-nl/reference/strings/functions/strtolower.xml Sun May 26 12:52:40 +2002 @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'strtolower' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.strtolower"> <refnamediv> <refname>strtolower</refname> - <refpurpose>Maak een string lowercase</refpurpose> + <refpurpose>Maak een string volledig in kleine letters</refpurpose> </refnamediv> <refsect1> <title>Omschrijving</title> @@ -14,7 +13,7 @@ </methodsynopsis> <para> Geeft <parameter>string</parameter> met alle alfabetische - karakters geconverteerd naar lowercase. + karakters geconverteerd naar kleine letters. </para> <para> Weet dat 'alfabetisch' wordt bepaald door de huidige locale. Dit @@ -24,9 +23,11 @@ <example> <title><function>strtolower</function> voorbeeld</title> <programlisting role="php"> -$str = "Mary Had A Little Lamb and She LOVED It So"; +<![CDATA[ +$str = "Mary Had A Little Lamb and She LOVED It So"; $str = strtolower($str); -print $str; # Print mary had a little lamb and she loved it so +print $str; # Zou printen: mary had a little lamb and she loved it so +]]> </programlisting> </example> <para> Index: phpdoc-nl/reference/strings/functions/strtoupper.xml diff -u phpdoc-nl/reference/strings/functions/strtoupper.xml:1.1 phpdoc-nl/reference/strings/functions/strtoupper.xml:1.2 --- phpdoc-nl/reference/strings/functions/strtoupper.xml:1.1 Sun Apr 14 21:37:41 2002 +++ phpdoc-nl/reference/strings/functions/strtoupper.xml Sun May 26 12:52:40 +2002 @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'strtoupper' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.strtoupper"> <refnamediv> <refname>strtoupper</refname> - <refpurpose>Maak een string uppercase</refpurpose> + <refpurpose>Maak een string volledig in hoofdletters</refpurpose> </refnamediv> <refsect1> <title>Omschrijving</title> @@ -14,7 +13,7 @@ </methodsynopsis> <para> Geeft <parameter>string</parameter> met alle alfabetische - karakters geconverteerd naar uppercase. + karakters geconverteerd naar hoofdletters. </para> <para> Weet dat 'alfabetisch' wordt bepaald door de huidige locale. Dit @@ -24,9 +23,11 @@ <example> <title><function>strtoupper</function> voorbeeld</title> <programlisting role="php"> -$str = "Mary Had A Little Lamb and She LOVED It So"; +<![CDATA[ +$str = "Mary Had A Little Lamb and She LOVED It So"; $str = strtoupper ($str); -print $str; # Print MARY HAD A LITTLE LAMB AND SHE LOVED IT SO +print $str; # Zou printen: MARY HAD A LITTLE LAMB AND SHE LOVED IT SO +]]> </programlisting> </example> <para> Index: phpdoc-nl/reference/strings/functions/strtr.xml diff -u phpdoc-nl/reference/strings/functions/strtr.xml:1.2 phpdoc-nl/reference/strings/functions/strtr.xml:1.3 --- phpdoc-nl/reference/strings/functions/strtr.xml:1.2 Mon May 20 12:39:42 2002 +++ phpdoc-nl/reference/strings/functions/strtr.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'strtr' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.strtr"> <refnamediv> <refname>strtr</refname> @@ -27,7 +26,9 @@ <example> <title><function>strtr</function> voorbeeld</title> <programlisting role="php"> -$addr = strtr($addr, "δεφ", "aao"); +<![CDATA[ +$addr = strtr($addr, "δεφ", "aao"); +]]> </programlisting> </example> </para> @@ -42,7 +43,7 @@ al behandeld is. </para> <para> - Examples: + Voorbeelden: <informalexample> <programlisting role="php"> <![CDATA[ @@ -57,7 +58,8 @@ </para> <note> <simpara> - Deze feature (twee argumenten) is toegevoegd in PHP 4.0. + Deze optionele parameters <parameter>to</parameter> en + <parameter>from</parameter> zijn toegevoegd in PHP 4.0.0. </simpara> </note> <para> Index: phpdoc-nl/reference/strings/functions/substr-count.xml diff -u phpdoc-nl/reference/strings/functions/substr-count.xml:1.1 phpdoc-nl/reference/strings/functions/substr-count.xml:1.2 --- phpdoc-nl/reference/strings/functions/substr-count.xml:1.1 Sun Apr 14 21:37:41 2002 +++ phpdoc-nl/reference/strings/functions/substr-count.xml Sun May 26 12:52:40 +2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'substr-count' in en/ tree in rev 1.27 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.substr-count"> <refnamediv> <refname>substr_count</refname> @@ -22,8 +21,10 @@ <para> <example> <title><function>substr_count</function> voorbeeld</title> - <programlisting> -print substr_count("This is a test", "is"); // geeft 2 + <programlisting role="php"> +<![CDATA[ +print substr_count("This is a test", "is";); // geeft 2 +]]> </programlisting> </example> </para> Index: phpdoc-nl/reference/strings/functions/substr-replace.xml diff -u phpdoc-nl/reference/strings/functions/substr-replace.xml:1.2 phpdoc-nl/reference/strings/functions/substr-replace.xml:1.3 --- phpdoc-nl/reference/strings/functions/substr-replace.xml:1.2 Mon May 20 12:39:42 2002 +++ phpdoc-nl/reference/strings/functions/substr-replace.xml Sun May 26 12:52:40 +2002 @@ -46,24 +46,26 @@ <example> <title><function>substr_replace</function> voorbeeld</title> <programlisting role="php"> -<?php +<![CDATA[ +<?php $var = 'ABCDEFGH:/MNRPQR/'; -echo "Original: $var<hr>\n"; +echo "Original: $var<hr>\n"; -/* Deze twee voorbeelden vervangen alles van $var with 'bob'. */ -echo substr_replace ($var, 'bob', 0) . "<br>\n"; -echo substr_replace ($var, 'bob', 0, strlen ($var)) . "<br>\n"; +/* Deze twee voorbeelden vervangen alles van $var met 'bob'. */ +echo substr_replace ($var, 'bob', 0) . "<br>\n"; +echo substr_replace ($var, 'bob', 0, strlen ($var)) . "<br>\n"; /* Voegt 'bob' aan het begin van $var. */ -echo substr_replace ($var, 'bob', 0, 0) . "<br>\n"; +echo substr_replace ($var, 'bob', 0, 0) . "<br>\n"; /* Deze volgende twee vervangen 'MNRPQR' in $var met 'bob'. */ -echo substr_replace ($var, 'bob', 10, -1) . "<br>\n"; -echo substr_replace ($var, 'bob', -7, -1) . "<br>\n"; +echo substr_replace ($var, 'bob', 10, -1) . "<br>\n"; +echo substr_replace ($var, 'bob', -7, -1) . "<br>\n"; /* Verwijder 'MNRPQR' van $var. */ -echo substr_replace ($var, '', 10, -1) . "<br>\n"; -?> +echo substr_replace ($var, '', 10, -1) . "<br>\n"; +?> +]]> </programlisting> </example> </para> Index: phpdoc-nl/reference/strings/functions/substr.xml diff -u phpdoc-nl/reference/strings/functions/substr.xml:1.1 phpdoc-nl/reference/strings/functions/substr.xml:1.2 --- phpdoc-nl/reference/strings/functions/substr.xml:1.1 Sun Apr 14 21:37:41 2002 +++ phpdoc-nl/reference/strings/functions/substr.xml Sun May 26 12:52:40 2002 @@ -1,6 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'substr' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.substr"> <refnamediv> <refname>substr</refname> @@ -32,8 +31,12 @@ Voorbeeld: <informalexample> <programlisting role="php"> -$rest = substr ("abcdef", 1); // geeft "bcdef" -$rest = substr ("abcdef", 1, 3); // geeft "bcd" +<![CDATA[ +$rest = substr ("abcdef", 1); // geeft "bcdef" +$rest = substr ("abcdef", 1, 3); // geeft "bcd" +$rest = substr ("abcdef", 0, 4); // geeft "abcd" +$rest = substr ("abcdef", 0, 8); // geeft "abcdef" +]]> </programlisting> </informalexample> </para> @@ -45,9 +48,9 @@ Voorbeelden: <informalexample> <programlisting role="php"> -$rest = substr ("abcdef", -1); // geeft "f" -$rest = substr ("abcdef", -2); // geeft "ef" -$rest = substr ("abcdef", -3, 1); // geeft "d" +$rest = substr ("abcdef", -1); // geeft "f" +$rest = substr ("abcdef", -2); // geeft "ef" +$rest = substr ("abcdef", -3, 1); // geeft "d" </programlisting> </informalexample> </para> @@ -71,7 +74,12 @@ Voorbeelden: <informalexample> <programlisting role="php"> -$rest = substr ("abcdef", 1, -1); // geeft "bcde" +<![CDATA[ +$rest = substr("abcdef", 1, -1); // geeft "bcde" +$rest = substr("abcdef", 2, -1); // geeft "cde" +$rest = substr("abcdef", 4, -4); // geeft "" +$rest = substr("abcdef", -3, -1); // geeft "de" +]]> </programlisting> </informalexample> </para> Index: phpdoc-nl/reference/strings/functions/ucfirst.xml diff -u phpdoc-nl/reference/strings/functions/ucfirst.xml:1.1 phpdoc-nl/reference/strings/functions/ucfirst.xml:1.2 --- phpdoc-nl/reference/strings/functions/ucfirst.xml:1.1 Sun Apr 14 21:37:41 2002 +++ phpdoc-nl/reference/strings/functions/ucfirst.xml Sun May 26 12:52:40 2002 @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'ucfirst' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.ucfirst"> <refnamediv> <refname>ucfirst</refname> - <refpurpose>Maakt het eerste karakter van een string uppercase</refpurpose> + <refpurpose>Maakt van het eerste karakter van een string een +hoofdletter</refpurpose> </refnamediv> <refsect1> <title>Omschrijving</title> @@ -22,16 +21,21 @@ als umlaut-a (δ) niet geconverteerd. <example> <title><function>ucfirst</function> example</title> - <programlisting role="php"> -$text = 'mary had a little lamb and she loved it so.'; -$text = ucfirst ($text); // $text is nu Mary had a little lamb - // and she loved it so. + <programlisting role="php"> +<![CDATA[ +$foo = 'hello world!'; +$foo = ucfirst($foo); // Hello world! + +$bar = 'HELLO WORLD!'; +$bar = ucfirst($bar); // HELLO WORLD! +$bar = ucfirst(strtolower($bar)); // Hello world! +]]> </programlisting> </example> </para> <para> - Zie ook <function>strtoupper</function> en - <function>strtolower</function>. + Zie ook <function>strtoupper</function>, <function>strtolower</function>, + en <function>ucwords</function>. </para> </refsect1> </refentry> Index: phpdoc-nl/reference/strings/functions/ucwords.xml diff -u phpdoc-nl/reference/strings/functions/ucwords.xml:1.1 phpdoc-nl/reference/strings/functions/ucwords.xml:1.2 --- phpdoc-nl/reference/strings/functions/ucwords.xml:1.1 Sun Apr 14 21:37:42 2002 +++ phpdoc-nl/reference/strings/functions/ucwords.xml Sun May 26 12:52:40 2002 @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- splitted from ./nl/functions/strings.xml, last change in rev 1.1 --> -<!-- last change to 'ucwords' in en/ tree in rev 1.2 --> +<!-- EN-Revision: 1.2 Maintainer: sander Status: ready --> <refentry id="function.ucwords"> <refnamediv> <refname>ucwords</refname> <refpurpose> - Maakt van het eerste karakter van elk woord in een string een uppercase + Maakt van het eerste karakter van elk woord in een string een hoofdletter </refpurpose> </refnamediv> <refsect1> @@ -16,16 +15,28 @@ </methodsynopsis> <para> Maakt van het eerste karakter van elk woord in - <parameter>str</parameter> als dit karakter alfabetisch + <parameter>str</parameter> een hoofdlteer als dit karakter alfabetisch is. <example> <title><function>ucwords</function> voorbeeld</title> <programlisting role="php"> -$text = "mary had a little lamb and she loved it so."; -$text = ucwords($text); // $text is now: Mary Had A Little - // Lamb And She Loved It So. +<![CDATA[ +$foo = 'hello world!'; +$foo = ucwords($foo); // Hello World! + +$bar = 'HELLO WORLD!'; +$bar = ucwords($bar); // HELLO WORLD! +$bar = ucwords(strtolower($bar)); // Hello World! +]]> </programlisting> </example> + <note> + <simpara> + De definitie van een woord is een reeks van karakters dat wordt gevolgd + door een whitespace-teken (dat zijn: spatie, form-feed, newline, + carriage return, horizontale tab en verticale tab). + </simpara> + </note> </para> <para> Zie ook <function>strtoupper</function>,