cvs: phpdoc /de/appendices migration.xml
| From: | Mark Kronsbein | Date: | Tue, 12 Mar 2002 09:28:12 +0000 |
| Subject: | cvs: phpdoc /de/appendices migration.xml | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969342973@lists.php.net to get a copy of this message | ||
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
-->