lovchy Wed May 26 08:29:18 2004 EDT
Modified files: /phpdoc/en/appendices migration5.xml Log: Entity replaced with right value
http://cvs.php.net/diff.php/phpdoc/en/appendices/migration5.xml?r1=1.19&r2=1.20&ty=u Index: phpdoc/en/appendices/migration5.xml diff -u phpdoc/en/appendices/migration5.xml:1.19 phpdoc/en/appendices/migration5.xml:1.20 --- phpdoc/en/appendices/migration5.xml:1.19 Mon May 24 10:27:49 2004 +++ phpdoc/en/appendices/migration5.xml Wed May 26 08:29:17 2004 @@ -1,15 +1,15 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.19 $ --> +<!-- $Revision: 1.20 $ --> <appendix id="migration5"> <title>Migrating from PHP 4 to PHP 5</title> <section id='migration5.changes'> <title>What has changed in PHP 5</title> <para> - &php; 5 and the integrated Zend Engine 2 have greatly improved PHP's + PHP 5 and the integrated Zend Engine 2 have greatly improved PHP's performance and capabilities, but great care has been taken to break as - little existing code as possible. So migrating your code from &php; 4 to 5 - should be very easy. Most existing &php; 4 code should be ready to run + little existing code as possible. So migrating your code from PHP 4 to 5 + should be very easy. Most existing PHP 4 code should be ready to run without changes, but you should still know about the <link linkend="migration5.incompatible">few differences</link> and take care to test your code before switching versions in production @@ -20,7 +20,7 @@ <section id="migration5.incompatible"> <title>Backward Incompatible Changes</title> <para> - Although most existing &php; 4 code should work without changes, you should + Although most existing PHP 4 code should work without changes, you should pay attention to the following backward incompatible changes: </para> <itemizedlist> @@ -40,7 +40,7 @@ </simpara></listitem> <listitem><simpara> PATH_TRANSLATED server variable is no longer set implicitly under - Apache2 SAPI in contrast to the situation in &php; 4, where it is set to + Apache2 SAPI in contrast to the situation in PHP 4, where it is set to the same value as the SCRIPT_FILENAME server variable when it is not populated by Apache. This change was made to comply with the <ulink url="&url.cgispecs;">CGI specification</ulink>. Please refer to <ulink @@ -49,11 +49,11 @@ <listitem><simpara> The <constant>T_ML_CONSTANT</constant> constant is no longer defined by the <link linkend="ref.tokenizer">Tokenizer</link> extension. If - error_reporting is set to <constant>E_ALL</constant>, &php; will generate a + error_reporting is set to <constant>E_ALL</constant>, PHP will generate a notice. Although the <constant>T_ML_CONSTANT</constant> was never used - at all, it was defined in &php; 4. In both &php; 4 and &php; 5 // and /* */ + at all, it was defined in PHP 4. In both PHP 4 and PHP 5 // and /* */ are resolved as the <constant>T_COMMENT</constant> constant. However the - PHPDoc style comments /** */ ,which starting &php; 5 are parsed by &php;, are + PHPDoc style comments /** */ ,which starting PHP 5 are parsed by PHP, are recognized as <constant>T_DOC_COMMENT</constant>. </simpara></listitem> <listitem><simpara> @@ -148,19 +148,19 @@ <section id="migration5.cli-cgi"> <title>CLI and CGI</title> <para> - In &php; 5 there were some changes in CLI and CGI filenames. In &php; 5, the + In PHP 5 there were some changes in CLI and CGI filenames. In PHP 5, the CGI version was renamed to <literal>php-cgi.exe</literal> (previously <literal>php.exe</literal>) and the CLI version now sits in the main directory (previously <literal>cli/php.exe</literal>). </para> <para> - In &php; 5 it was also introduced a new mode: + In PHP 5 it was also introduced a new mode: <literal>php-win.exe</literal>. This is equal to the CLI version, except that php-win doesn't output anything and thus provides no console (no "dos box" appears on the screen). This behavior is similar to php-gtk. </para> <para> - In &php; 5, the CLI version will always populate the global $argv and $argc + In PHP 5, the CLI version will always populate the global $argv and $argc variables. </para> </section> @@ -190,7 +190,7 @@ </informalexample> </para> <para> - If your webserver is running &php; in CGI mode, you should note that the + If your webserver is running PHP in CGI mode, you should note that the CGI version has changed its name from php.exe to php-cgi.exe. In Apache you should do something like this: <informalexample> @@ -214,7 +214,7 @@ <section id="migration5.functions"> <title>New Functions</title> <para> - In &php; 5 there are some new functions. Here is the list of them: + In PHP 5 there are some new functions. Here is the list of them: </para> <para>Arrays:</para> <itemizedlist> @@ -533,7 +533,7 @@ <section id="migration5.newconf"> <title>New Directives</title> <para> - There were some new &php.ini; directives introduced in &php; 5. Here is a + There were some new &php.ini; directives introduced in PHP 5. Here is a list of them: </para> <itemizedlist> @@ -545,7 +545,7 @@ </simpara></listitem> <listitem><simpara> <link linkend="ini.register-long-arrays">register_long_arrays</link> - - allow/disallow &php; to register the deprecated long $HTTP_*_VARS + allow/disallow PHP to register the deprecated long $HTTP_*_VARS </simpara></listitem> <listitem><simpara> <link linkend="ini.session.hash-function">session.hash_function</link> - @@ -558,7 +558,7 @@ binary hash data to something readable (from 4 to 6) </simpara></listitem> <listitem><simpara> - zend.ze1_compatibility_mode - Enable compatibility mode with Zend Engine 1 (&php; 4) + zend.ze1_compatibility_mode - Enable compatibility mode with Zend Engine 1 (PHP 4) </simpara></listitem> </itemizedlist> </section> @@ -566,10 +566,10 @@ <section id="migration5.databases"> <title>Databases</title> <para> - There were some changes in &php; 5 regarding databases (MySQL and SQLite). + There were some changes in PHP 5 regarding databases (MySQL and SQLite). </para> <para> - In &php; 5 the MySQL client libraries are not bundled, because of license + In PHP 5 the MySQL client libraries are not bundled, because of license problems and some others. For more information, read the <link linkend="faq.databases.mysql.php5">FAQ entry</link>. </para> @@ -578,8 +578,8 @@ MySQL)</link>, which is designed to work with MySQL 4.1 and above. </para> <para> - Since &php; 5, the <link linkend="ref.sqlite">SQLite</link> extension is - built-in &php;. SQLite is an embeddable SQL database engine and is not a + Since PHP 5, the <link linkend="ref.sqlite">SQLite</link> extension is + built-in PHP. SQLite is an embeddable SQL database engine and is not a client library used to connect to a big database server (like MySQL or PostgreSQL). The SQLite library reads and writes directly to and from the database files on disk. @@ -590,9 +590,9 @@ <section id='migration5.oop'> <title>New Object Model</title> <para> - In &php; 5 there is a new Object Model. PHP's handling of objects has been + In PHP 5 there is a new Object Model. PHP's handling of objects has been completely rewritten, allowing for better performance and more features. - In previous versions of &php;, objects were handled like primitive types + In previous versions of PHP, objects were handled like primitive types (for instance integers and strings). The drawback of this method was that semantically the whole object was copied when a variable was assigned, or pass as a parameter to a method. In the new approach, objects are @@ -600,15 +600,15 @@ object's identifier). </para> <para> - Many &php; programmers aren't even aware of the copying quirks of the old - object model and, therefore, the majority of &php; applications will work + Many PHP programmers aren't even aware of the copying quirks of the old + object model and, therefore, the majority of PHP applications will work out of the box, or with very few modifications. </para> <section id='migration.oop.members'> <title>Private and Protected Members</title> <para> - &php; 5 introduces private and protected member variables, they allow you + PHP 5 introduces private and protected member variables, they allow you to define the visibility of class properties. </para> <example> @@ -664,7 +664,7 @@ <section id='migration.oop.methods'> <title>Private and Protected Methods</title> <para> - With &php; 5, private and protected methods are also introduced. + With PHP 5, private and protected methods are also introduced. </para> <example> <title>Protected methods example</title> @@ -705,7 +705,7 @@ <section id='migration.oop.abstract'> <title>Abstract Classes and Methods</title> <para> - &php; 5 also introduces abstract classes and methods. An abstract method + PHP 5 also introduces abstract classes and methods. An abstract method only declares the method's signature and does not provide an implementation. A class that contains abstract methods needs to be declared abstract. @@ -741,7 +741,7 @@ <section id='migration.oop.interfaces'> <title>Interfaces</title> <para> - &php; 5 introduces interfaces. A class may implement an arbitrary list of + PHP 5 introduces interfaces. A class may implement an arbitrary list of interfaces. </para> <example> @@ -771,7 +771,7 @@ <section id='migration.oop.typehints'> <title>Class Type Hints</title> <para> - While remaining loosely typed &php; 5 introduces the ability to use class + While remaining loosely typed PHP 5 introduces the ability to use class type hints to declare the expected class of objects that are passed as parameters to a method. </para> @@ -841,7 +841,7 @@ <section id='migration5.oop.final'> <title>final</title> <para> - &php; 5 introduces the "final" keyword to declare final members and + PHP 5 introduces the "final" keyword to declare final members and methods. Methods and members declared final cannot be overridden by sub-classes. </para> @@ -892,8 +892,8 @@ <section id='migration5.oop.cloning'> <title>Objects Cloning</title> <para> - &php; 4 offered no way a user could decide what copy constructor to run - when an object is duplicated. During duplication, &php; 4 did a bit for bit + PHP 4 offered no way a user could decide what copy constructor to run + when an object is duplicated. During duplication, PHP 4 did a bit for bit copy making an identical replica of all the object's properties. </para> <para> @@ -914,7 +914,7 @@ <function>__clone</function> method cannot be called directly. </para> <para> - When the developer asks to create a new copy of an object, &php; 5 will + When the developer asks to create a new copy of an object, PHP 5 will check if a <function>__clone</function> method has been defined or not. If not, it will call a default __clone() which will copy all of the object's properties. If a <function>__clone</function> method is defined, then it @@ -963,22 +963,22 @@ <section id='migration5.oop.constructors'> <title>Constructors</title> <para> - &php; 5 allows developers to declare constructor methods for classes. + PHP 5 allows developers to declare constructor methods for classes. Classes which have a constructor method call this method on each newly-created object, so it is suitable for any initialization that the object may need before it is used. </para> <para> - With &php; 4, constructor methods were class methods that had the same name + With PHP 4, constructor methods were class methods that had the same name as the class itself. Since it is very common to call parent constructors - from derived classes, the way &php; 4 worked made it a bit cumbersome to + from derived classes, the way PHP 4 worked made it a bit cumbersome to move classes around in a large class hierarchy. If a class is moved to reside under a different parent, the constructor name of that parent changes as well, and the code in the derived class that calls the parent constructor has to be modified. </para> <para> - &php; 5 introduces a standard way of declaring constructor methods by + PHP 5 introduces a standard way of declaring constructor methods by calling them by the name <function>__construct</function>. </para> <example> @@ -1006,7 +1006,7 @@ </programlisting> </example> <para> - For backwards compatibility, if &php; 5 cannot find a + For backwards compatibility, if PHP 5 cannot find a <function>__construct</function> function for a given class, it will search for the old-style constructor function, by the name of the class. Effectively, it means that the only case that would have compatibility @@ -1021,11 +1021,11 @@ Having the ability to define destructors for objects can be very useful. Destructors can log messages for debugging, close database connections and do other clean-up work. No mechanism for object destructors existed - in &php; 4, although &php; had already support for registering functions + in PHP 4, although PHP had already support for registering functions which should be run on request shutdown. </para> <para> - &php; 5 introduces a destructor concept similar to that of other + PHP 5 introduces a destructor concept similar to that of other object-oriented languages, such as Java: When the last reference to an object is destroyed the object's destructor, which is a class method named <function>__destruct</function> that receives no parameters, is @@ -1063,7 +1063,7 @@ <section id='migration5.oop.constants'> <title>Constants</title> <para> - &php; 5 introduces per-class constants: + PHP 5 introduces per-class constants: </para> <example> <title>Class constant example</title> @@ -1088,7 +1088,7 @@ <section id='migration5.oop.exceptions'> <title>Exceptions</title> <para> - &php; 4 had no exception handling. &php; 5 introduces a exception model + PHP 4 had no exception handling. PHP 5 introduces a exception model similar to that of other programming languages. Note that there is support for "catch all" but not for the "finally" clause. </para> @@ -1127,8 +1127,8 @@ <section id='migration5.oop.dereferencing'> <title>Dereferencing objects returned from functions</title> <para> - In &php; 4 it wasn't possible to dereference objects returned by functions - and make further method calls on those objects. With &php; 5, the following + In PHP 4 it wasn't possible to dereference objects returned by functions + and make further method calls on those objects. With PHP 5, the following is now possible: </para> <example> @@ -1192,7 +1192,7 @@ <section id='migration5.oop.staticmethods'> <title>Static Methods</title> <para> - &php; 5 introduces the 'static' keyword to declare a method static, thus + PHP 5 introduces the 'static' keyword to declare a method static, thus callable from outside the object context. </para> <example> @@ -1220,7 +1220,7 @@ <section id='migration5.oop.instanceof'> <title>instanceof</title> <para> - &php; 5 introduces the <literal>instanceof</literal> keyword, that + PHP 5 introduces the <literal>instanceof</literal> keyword, that allows you to ascertain whether or not an object is an instance of a class, or extends a class, or implements an interface. </para> @@ -1408,7 +1408,7 @@ </para> <para> The interfaces <literal>IteratorAggregate</literal> and <literal>Iterator</literal> - allows you to specify how class objects are iterated in &php; code. The first + allows you to specify how class objects are iterated in PHP code. The first of them simply has a method <function>getIterator</function> which must return an array or an object that either implements the interface <literal>Iterator</literal> or is instantiated from an internal @@ -1544,7 +1544,7 @@ <section id='migrating5.oop.reflection'> <title>Reflection API</title> <para> - &php; 5 comes with a complete reflection API that adds the ability to + PHP 5 comes with a complete reflection API that adds the ability to reverse-engineer classes, interfaces, functions and methods as well as extensions. </para> @@ -1586,7 +1586,7 @@ <section id='migrating5.errorrep'> <title>Error Reporting</title> <para> - As of &php; 5 new error reporting constant E_STRICT was introduced with + As of PHP 5 new error reporting constant E_STRICT was introduced with value 2048. It enables run-time PHP suggestions on your code interoperability and forward compatibility, that will help you to keep latest and greatest suggested method of coding. E.g. STRICT message will