goba Mon Feb 25 04:06:42 2002 EDT
Modified files:
/phpdoc/en/appendices migration4.xml
Log:
- <example> needs a title in it befor <programlisting> to work => build
braking error corrected
- PHP3 and PHP4 are PHP 3 and PHP 4
- linking in global references
- adding comment to example
Index: phpdoc/en/appendices/migration4.xml
diff -u phpdoc/en/appendices/migration4.xml:1.19
phpdoc/en/appendices/migration4.xml:1.20
--- phpdoc/en/appendices/migration4.xml:1.19 Sun Feb 24 12:03:54 2002
+++ phpdoc/en/appendices/migration4.xml Mon Feb 25 04:06:40 2002
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.19 $ -->
+<!-- $Revision: 1.20 $ -->
<appendix id="migration4">
<title>Migrating from PHP 3 to PHP 4</title>
@@ -427,24 +427,27 @@
<title>Handling of global variables</title>
<para>
While handling of global variables had the focus on to be easy in
- PHP3 and early versions of PHP4, the focus has changed to be more
- secure. While in PHP3 following example worked fine, in PHP4 it
+ PHP 3 and early versions of PHP 4, the focus has changed to be more
+ secure. While in PHP 3 the following example worked fine, in PHP 4 it
has to be unset($GLOBALS["id"]);. This is only one issue of global
variable handling. You should always have used $GLOBALS, with
- newer versions of PHP4 you are forced to do so in most cases.
+ newer versions of PHP 4 you are forced to do so in most cases.
+ Read more on this subject in the <link linkend="references.global">
+ <literal>global</literal> references section</link>.
</para>
<example>
+ <title>Migration of global variables</title>
<programlisting role="php">
<![CDATA[
<?php
-$id=1;
+$id = 1;
function test()
{
- global $id;
- unset($id);
+ global $id;
+ unset($id);
}
test();
-echo($id);
+echo($id); // This will print out 1 in PHP 4
]]>
</programlisting>
</example>