diff --git a/appendices/migration53.xml b/appendices/migration53.xml index e8a771a2b4..fdaa8c2998 100644 --- a/appendices/migration53.xml +++ b/appendices/migration53.xml @@ -1,5 +1,5 @@ - + Migrating from PHP 5.2.x to PHP 5.3.x @@ -19,20 +19,26 @@ versions in production environments. - If the system is being upgraded from PHP 5.1.x, the manual section titled - Upgrade Notes for PHP 5.2.x - should also be read. - - - If the system is being upgraded from PHP 5.0.x, the manual section titled - Upgrade Notes for PHP 5.1.x - should also be read. - - - Similarly, if the system is being upgraded from PHP 4, the manual section - titled Migrating from PHP 4 to PHP 5 - should be read as well. + If the system is being upgraded from an older version of PHP, then the + relevant documentation is available below: + + + + Upgrade Notes for PHP 5.2.x. + + + + + Upgrade Notes for PHP 5.1.x. + + + + + Migrating from PHP 4 to PHP 5. + + +
@@ -112,14 +118,6 @@ -
- -
- New features - - PHP 5.3.0 contains a wide set of new features, below lists - new features available to the language and syntax. - The following keywords are now reserved and may not be used in function, class etc. names. @@ -136,211 +134,78 @@ +
+ +
+ New features - Support for namespaces has been - added. + PHP 5.3.0 contains a wide set of new features, below lists new features + available to the language and syntax. - - Support for Late Static Bindings - has been added. - - - Support for a jump label (limited goto) has been added. Its only possible to jump - in the same context and out of loops, but not into loops, or other scopes/contexts. - - - - -]]> - - - - PHP now contains support for native closures - (Lambda, Anonymous functions). These are implemented using a new reserved class, - Closure. Closures can be used in any function that takes a - callback as parameter. - - - - -]]> - - - - Theres two new magic methods, - __callStatic and - __invoke. The magic - __invoke method makes it possible for a class instance - to be callable, thrus making it possible to pass it to a parameter of the - callback type. - - - - -]]> - - - - NOWDOC syntax is now - supported, and works like HEREDOC but with single quotes: - - - - -]]> - - - - Static HEREDOCs can be used to initialize static variables, class members - or class constants: - - - - -]]> - - - - Its now possible to declare constants using the const - keyword: - - - - -]]> - - - - The ternary operator - now have a shorthand syntax: - - - - - - + + + + Support for namespaces has been + added. + + + + + Support for Late Static Bindings + has been added. + + + + + Support for a jump label (limited goto) + has been added. + + + + + Support for native Closures + (Lambda/Anonymous functions) has been added. + + + + + Theres two new magic methods, + __callStatic and + __invoke has been added. + + + + + Nowdoc syntax is now + supported, and works like Heredoc + but with single quotes. + + + + + Its not possible to use Heredoc + to initialize static variables and class members/constants. + + + + + Heredoc syntax may now be declared + using double quotes. + + + + + Constants can now be declared outside a class + declaring using the const keyword. + + + + + The ternary operator + now have a shorthand operator ?:. + + +
@@ -1094,7 +959,7 @@ var_dump(0 ?: 'Hello!'); PDO::setAttribute - - Set an attribute. + - Sets an attribute. @@ -1156,6 +1021,48 @@ var_dump(0 ?: 'Hello!');
+
+ New Extensions + + The following are new extensions added (by default) as of PHP 5.3.0: + + + + + Fileinfo + - Improved and more solid replacement for the + Mimetype extension. + + + + + INTL + - Internationalization extension. INTL is a wrapper around the + ICU library. + + + + + Phar + - Implementation of PHP-Archive files. + + + + + SQLite3 + - Support for SQLite version 3 databases. + + + + + mysqlnd is a new core library shipped with PHP. It is a PHP-specific + replacement for libmysql. mysqlnd will be used to build the + mysql, mysqli + and PDO_MYSQL if libmysql isnt found + on the system, but it may also be used instead of libmysql. + +
+
Removed Extensions @@ -1210,40 +1117,6 @@ var_dump(0 ?: 'Hello!');
-
- New Extensions - - The following are new extensions added (by default) as of PHP 5.3.0: - - - - - Fileinfo - - Improved and more solid replacement for the - Mimetype extension. - - - - - INTL - - Internationalization extension. INTL is a wrapper around the - ICU library. - - - - - Phar - - Implementation of PHP-Archive files. - - - - - SQLite3 - - Support for SQLite version 3 databases. - - - -
Other changes to extensions @@ -1305,10 +1178,6 @@ var_dump(0 ?: 'Hello!'); - - mysqlnd is a new core library shipped with PHP. It is a PHP-specific - replacement for libmysql. -
@@ -1903,7 +1772,6 @@ var_dump(0 ?: 'Hello!'); -
diff --git a/language/functions.xml b/language/functions.xml index 68aca97572..0173ec8cdb 100644 --- a/language/functions.xml +++ b/language/functions.xml @@ -1,5 +1,5 @@ - + Functions @@ -623,6 +623,85 @@ echo preg_replace_callback('~-([a-z])~', function ($match) { }, 'hello-world'); // outputs helloWorld ?> +]]> + + + + + Closures can also be declared to values of variables, which PHP magiclly + turns into an object instance of the Closure + class. When assigning a closure to a variable, its done by a basic + assignment to a function declaring with an ending semicolon like any + other assignments + + + + Anonymous function variable assignment example + + +]]> + + + + + Closures may also inherit variables from the parent scope, to do so it + must be declared in the function header, unlike regular functions that + uses the global keyword. + + + + Closures and scoping + + ]]> @@ -637,6 +716,12 @@ echo preg_replace_callback('~-([a-z])~', function ($match) { Anonymous functions are available since PHP 5.3.0. + + + Its possible to use the func_get_args and + family functions within a closure. + + diff --git a/language/types/string.xml b/language/types/string.xml index 10b78db6d7..36a78f8d50 100644 --- a/language/types/string.xml +++ b/language/types/string.xml @@ -1,5 +1,5 @@ - + Strings @@ -319,6 +319,58 @@ EOD + + As of PHP 5.3.0, its possible to initialize static variables and class + members/constants using the Heredoc syntax: + + + + Using Heredoc to initialize static values + + +]]> + + + + + PHP 5.3.0 also introduces the possibility for Heredoc's to + use double quotes in declarings: + + + + Using double quotes in Heredoc + + +]]> + + + Heredoc support was added in PHP 4.