mk Tue Mar 12 04:28:12 2002 EDT
Modified files:
/phpdoc/de/appendices migration.xml
Log:
More work on migration.xml
Index: phpdoc/de/appendices/migration.xml
diff -u phpdoc/de/appendices/migration.xml:1.7 phpdoc/de/appendices/migration.xml:1.8
--- phpdoc/de/appendices/migration.xml:1.7 Wed Dec 12 15:46:03 2001
+++ phpdoc/de/appendices/migration.xml Tue Mar 12 04:28:12 2002
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- $Revision: 1.8 $ -->
+<!-- EN-Revision: 1.10 Maintainer: mk Status: working -->
<appendix id="migration">
- <title>Migrating von PHP/FI 2.0 zu PHP 3.0</title>
+ <title>Migration von PHP/FI 2.0 zu PHP 3.0</title>
<sect1 id="migration-about">
<title>�ber die Inkompatbilit�ten in 3.0</title>
@@ -26,7 +28,9 @@
<simpara>
Ein Konvertierungsprogramm, welches Ihre PHP/FI 2.0 Scripts konvertieren kann,
steht zur Verf�gung.
Zu finden ist es im <filename class="directory">convertor</filename> Verzeichnis
der PHP 3.0 Distribution. Dieses Programm ber�cksichtigt nur Syntax�nderungen,
- also sollten Sie dieses Kapitel aufmerksam lesen.</simpara></sect1>
+ also sollten Sie dieses Kapitel aufmerksam lesen.
+ </simpara>
+ </sect1>
<sect1 id="migration-startendtags">
<title>Start-/End-Tags</title>
@@ -37,15 +41,20 @@
neue M�glichkeiten ersetzt:
<example>
<title>Migration: Alte Start-/End-Tags</title>
- <programlisting>
-<? echo "Das ist PHP/FI 2.0 Code.\n"; >
-</programlisting></example>
+ <programlisting role="php">
+<![CDATA[
+<? echo "Das ist PHP/FI 2.0 Code.\n"; ?>
+]]>
+</programlisting>
+</example>
Ab Version 2.0 unterst�tzt PHP/FI auch diese M�glichkeit:
<example><title>Migration: Erste neue Start-/End-Tags</title>
- <programlisting>
-<? echo "Das ist PHP 3.0 Ccode!\n"; ?>
+ <programlisting role="php">
+<![CDATA[
+<? echo "Das ist PHP 3.0 Ccode!\n"; ?>
+]]>
</programlisting></example>
Beachten Sie, da� das End-Tag jetzt ein Fragzeichen und ein "Gr��er-als"-Zeichen
beinhaltet anstatt
@@ -56,8 +65,10 @@
folgende Variante eingef�hrt:
<example><title>Migration: Zweite neue Start-/End-Tags</title>
- <programlisting>
-<?php echo "Das ist PHP 3.0 Code!\n"; ?>
+ <programlisting role="php">
+<![CDATA[
+<?php echo "Das ist PHP 3.0 Code!\n"; ?>
+]]>
</programlisting></example>
Manche Leute hatten Probleme mit Editoren, die die Tags gar nicht
@@ -66,12 +77,14 @@
eingef�hrt:
<example><title>Migration: third new start/end tags</title>
- <programlisting>
-<script language="php">
+ <programlisting role="php">
+<![CDATA[
+<script language="php">
echo "Das ist PHP 3.0 Code!\n";
-</script>
+</script>
+]]>
</programlisting></example></para></sect1>
@@ -85,7 +98,8 @@
wurde die Syntax ge�ndert:
<example>
<title>Migration: Alte if..endif Syntax</title>
- <programlisting>
+ <programlisting role="php">
+<![CDATA[
if ($foo);
echo "jau\n";
elseif ($bar);
@@ -93,10 +107,12 @@
else;
echo "n�\n";
endif;
+]]>
</programlisting></example>
<example>
<title>Migration: Neue if..endif Syntax</title>
- <programlisting>
+ <programlisting role="php">
+<![CDATA[
if ($foo):
echo "jau\n";
elseif ($bar):
@@ -104,6 +120,7 @@
else:
echo "n�\n";
endif;
+]]>
</programlisting></example>
Beachten Sie, da� Semikolons in allen Anweisungen durch Doppelpunkte
@@ -115,16 +132,20 @@
wie auch bei if..endif hat sich auch die Syntax von while..endwhile
ge�ndert:
<example><title>Migration: Alte while..endwhile Syntax</title>
- <programlisting>
+ <programlisting role="php">
+<![CDATA[
while ($noch_mehr);
...
endwhile;
+]]>
</programlisting></example>
<example><title>Migration: Neue while..endwhile Syntax</title>
- <programlisting>
+ <programlisting role="php">
+<![CDATA[
while ($noch_mehr):
...
endwhile;
+]]>
</programlisting></example>
</para>
<warning>
@@ -145,7 +166,9 @@
<para>
Betrachten Sie dieses Beispiel:
- <informalexample><programlisting>
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
$a[0]=5;
$a[1]=7;
@@ -154,6 +177,7 @@
echo "$keyn";
next($a);
}
+]]>
</programlisting></informalexample>
In PHP/FI 2.0 w�rde dies beide Kennziffern von $a anzeigen. In PHP
@@ -161,18 +185,21 @@
aufgrund des "linken" Arguments des Strings, ein Vergleich des Strings
gemacht wurde, <literal>""</literal> ist in der Tat nicht das selbe
wie <literal>"0"</literal>, was dazu f�hrt, das die Schleife durchl�uft.
- In PHP 3.0, when a string is compared with an integer, an integer comparison is
- made (the string is converted to an integer). This results in
- comparing <literal>atoi("")</literal> which is
- <literal>0</literal>, and <literal>variablelist</literal> which is
- also <literal>0</literal>, and since <literal>0==0</literal>, the
- loop doesn't go through even once.
+ Wenn man in PHP 3.0 einen String mit einem Integer vergleicht, so wird ein
+Vergleich zweier Interger vorgenommen
+ (der String wir in einen Integer umgewandelt). Dies f�hrt dazu, da�
+ <literal>atoi("")</literal>, was
+ <literal>0</literal> ist, und <literal>variablelist</literal>, was genauso
+ <literal>0</literal> ist, vergleichen werden. Und weil <literal>0==0</literal>,
+w�rde die
+ Schleife nicht ein einziges Mal durchlaufen.
</para>
<para>
Dies zu reparieren ist einfach. Ersetzen Sie das While-Statement mit:
- <informalexample><programlisting>
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
while ((string)$key != "") {
+]]>
</programlisting></informalexample></para></sect1>
@@ -214,17 +241,21 @@
<para>
<example>
<title>Migration von 2.0: R�ckgabewerte, alter Code</title>
- <programlisting>
+ <programlisting role="php">
+<![CDATA[
$fp = fopen($file, "r");
if ($fp == -1);
echo("Konnte $file zum lesen nicht öffnen<br>\n");
endif;
+]]>
</programlisting>
</example>
<example>
<title>Migration von 2.0: R�ckgabewerte, neuer Code</title>
- <programlisting>
-$fp = @fopen($file, "r") or print("Konnte $file zum lesen nicht
öffnen<br>\n");
+ <programlisting role="php">
+<![CDATA[
+$fp = @fopen($file, "r") or print("Konnte $file zum lesen nicht öffnen<br>;\n");
+]]>
</programlisting>
</example></para></sect1>
@@ -271,33 +302,40 @@
<example>
<title>Migration from 2.0: concatenation for strings</title>
- <programlisting>
+ <programlisting role="php">
+<![CDATA[
echo "1" + "1";
+]]>
</programlisting>
<para>
- In PHP 2.0 this would echo 11, in PHP 3.0 it would echo 2. Instead
- use:
+ In PHP 2.0 w�rde dies 11 ausgeben, in PHP 3.0 2. Verwenden Sie stattdessen:
- <programlisting>
+ <programlisting role="php">
+<![CDATA[
echo "1"."1";
+]]>
</programlisting>
- <programlisting>
+ <programlisting role="php">
+<![CDATA[
$a = 1;
$b = 1;
echo $a + $b;
+]]>
</programlisting></para>
<para>
- This would echo 2 in both PHP 2.0 and 3.0.
+ Dies w�rde sowohl in PHP 2.0 als auch in 3.0 2 ausgeben.
- <programlisting>
+ <programlisting role="php">
+<![CDATA[
$a = 1;
$b = 1;
echo $a.$b;
+]]>
</programlisting>
- This will echo 11 in PHP 3.0.</para>
+ Dies gibt in PHP 3.0 11 aus.</para>
</example></sect1>
</appendix>
@@ -313,9 +351,12 @@
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
-sgml-default-dtd-file:"../manual.ced"
+sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
+vim600: syn=xml fen fdm=syntax fdl=2 si
+vim: et tw=78 syn=sgml
+vi: ts=1 sw=1
-->