Subscribe

RSS Feed (xml)

What you should know about PHP6

PHP developers should be aware of this, so that your scripts will be able to upgrade if needed, when the time comes. Although the PHP 6 development process has been a slow one, it is coming.

Original Article:
The Future of PHP

Some of the most important things to know is that most of the bad language features, such as:

* magic_quotes
* register_globals
* register_long_arrays
* safe_mode

are being taken out completely. It is well known that using these features in PHP 5 are a bad practice.

Some good things that are being added:

* Improved Unicode Support
* Namespaces (!)

Also, the SOAP extension will be enabled by default.

Short ASP style tags will be taken out completely. You must use PHP tags if you want your scripts to work.

The ereg family of functions will not be included by default! You must use perl-compatible regular expressions if you want to use regular expressions in your scripts, unless you enable the POSIX package.

In short, PHP6 is going to be cleaner, leaner, and better that its predecessors.

PHP 6 features being ported to PHP 5.3.x
Much of what is going to be a part of PHP 6 is actually being implemented now in PHP 5.3.x. Here is a guide to new features from the official PHP site, that may be used with the current version:

* Support for namespaces has been added.
* Support for Late Static Bindings has been added.
* Support for jump labels (limited goto) has been added.
* Support for native Closures (Lambda/Anonymous functions) has been added.
* There are two new magic methods, __callStatic and __invoke.
* Nowdoc syntax is now supported, similar to Heredoc syntax, but with single quotes.
* It is now possible to use Heredocs to initialize static variables and class properties/constants.
* Heredocs may now be declared using double quotes, complementing the Nowdoc syntax.
* Constants can now be declared outside a class using the const keyword.
* The ternary operator now has a shorthand form: ?:.
* The HTTP stream wrapper now considers all status codes from 200 to 399 to be successful.
* Dynamic access to static methods is now possible.
* Exceptions can now be nested.
* A garbage collector has been added, and is enabled by default.

0 comments:

Related Posts with Thumbnails