From 9aece8fc6957cb38929e1cdc78936c9c7dc3bb9d Mon Sep 17 00:00:00 2001 From: Boris Bezrukov Date: Wed, 26 May 2004 12:29:17 +0000 Subject: [PATCH] Entity replaced with right value git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@159708 c90b9560-bf6c-de11-be94-00142212c4b1 --- appendices/migration5.xml | 100 +++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/appendices/migration5.xml b/appendices/migration5.xml index ef1bf5f6ef..f04426a525 100755 --- a/appendices/migration5.xml +++ b/appendices/migration5.xml @@ -1,15 +1,15 @@ - + Migrating from PHP 4 to PHP 5
What has changed in PHP 5 - &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 few differences and take care to test your code before switching versions in production @@ -20,7 +20,7 @@
Backward Incompatible Changes - 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: @@ -40,7 +40,7 @@ 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 CGI specification. Please refer to The T_ML_CONSTANT constant is no longer defined by the Tokenizer extension. If - error_reporting is set to E_ALL, &php; will generate a + error_reporting is set to E_ALL, PHP will generate a notice. Although the T_ML_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 T_COMMENT 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 T_DOC_COMMENT. @@ -148,19 +148,19 @@ class b implements c {
CLI and CGI - 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 php-cgi.exe (previously php.exe) and the CLI version now sits in the main directory (previously cli/php.exe). - In &php; 5 it was also introduced a new mode: + In PHP 5 it was also introduced a new mode: php-win.exe. 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. - 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.
@@ -190,7 +190,7 @@ LoadModule php5_module /php/php5apache2.dll - 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: @@ -214,7 +214,7 @@ Action application/x-httpd-php "/php/php-cgi.exe"
New Functions - 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: Arrays: @@ -533,7 +533,7 @@ Action application/x-httpd-php "/php/php-cgi.exe"
New Directives - 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: @@ -545,7 +545,7 @@ Action application/x-httpd-php "/php/php-cgi.exe" register_long_arrays - - allow/disallow &php; to register the deprecated long $HTTP_*_VARS + allow/disallow PHP to register the deprecated long $HTTP_*_VARS session.hash_function - @@ -558,7 +558,7 @@ Action application/x-httpd-php "/php/php-cgi.exe" binary hash data to something readable (from 4 to 6) - 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)
@@ -566,10 +566,10 @@ Action application/x-httpd-php "/php/php-cgi.exe"
Databases - There were some changes in &php; 5 regarding databases (MySQL and SQLite). + There were some changes in PHP 5 regarding databases (MySQL and SQLite). - 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 FAQ entry. @@ -578,8 +578,8 @@ Action application/x-httpd-php "/php/php-cgi.exe" MySQL), which is designed to work with MySQL 4.1 and above. - Since &php; 5, the SQLite extension is - built-in &php;. SQLite is an embeddable SQL database engine and is not a + Since PHP 5, the SQLite 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 @@ Action application/x-httpd-php "/php/php-cgi.exe"
New Object Model - 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 @@ Action application/x-httpd-php "/php/php-cgi.exe" object's identifier). - 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.
Private and Protected Members - &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. @@ -664,7 +664,7 @@ $obj->printHello();
Private and Protected Methods - With &php; 5, private and protected methods are also introduced. + With PHP 5, private and protected methods are also introduced. Protected methods example @@ -705,7 +705,7 @@ $o->aPublicMethod();
Abstract Classes and Methods - &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 @@ $o->test();
Interfaces - &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. @@ -771,7 +771,7 @@ class MyException implements Throwable {
Class Type Hints - 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. @@ -841,7 +841,7 @@ function foo($object) {
final - &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. @@ -892,8 +892,8 @@ final class Foo {
Objects Cloning - &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. @@ -914,7 +914,7 @@ final class Foo { __clone method cannot be called directly. - 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 __clone 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 __clone method is defined, then it @@ -963,22 +963,22 @@ print $obj_cloned->address . "\n";
Constructors - &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. - 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. - &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 __construct. @@ -1006,7 +1006,7 @@ $obj = new SubClass(); - For backwards compatibility, if &php; 5 cannot find a + For backwards compatibility, if PHP 5 cannot find a __construct 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 @@ $obj = new SubClass(); 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. - &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 __destruct that receives no parameters, is @@ -1063,7 +1063,7 @@ $obj = new MyDestructableClass();
Constants - &php; 5 introduces per-class constants: + PHP 5 introduces per-class constants: Class constant example @@ -1088,7 +1088,7 @@ echo "Foo::constant = " . Foo::constant . "\n";
Exceptions - &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. @@ -1127,8 +1127,8 @@ catch (Exception $exception) {
Dereferencing objects returned from functions - 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: @@ -1192,7 +1192,7 @@ print $obj->my_prop;
Static Methods - &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. @@ -1220,7 +1220,7 @@ Foo::aStaticMethod();
instanceof - &php; 5 introduces the instanceof keyword, that + PHP 5 introduces the instanceof 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. @@ -1408,7 +1408,7 @@ foreach ($obj as $prp_name => $prop_value) { The interfaces IteratorAggregate and Iterator - 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 getIterator which must return an array or an object that either implements the interface Iterator or is instantiated from an internal @@ -1544,7 +1544,7 @@ echo $obj; // call __toString()
Reflection API - &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. @@ -1586,7 +1586,7 @@ reflectionExtension::export('standard');
Error Reporting - 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