PHP 6 and differences with PHP 4 and 5
PHP 6 should still enhance web pages programming to achieve rich Web applications, even if an important step has already been accomplished with PHP 5. The main novelty in version 6 is namespaces that will facilitate the joint use of libraries from different sources.
Differences between PHP 6 and PHP 5
In a very long list of change, it may be noted in particular:
Unicode
The internal format of strings will become widespread in the language to better support foreign languages. This will have no discernible difference but in the length of strings.
Dynamic libraries
The dl () function which can load libraries at runtime will no longer be activated by default.
SOAP
The SOAP extension to communicate with Web services is present in PHP 5, but in the version 6, it will be enabled by default.
What will disappear from the language
To avoid compatibility problems, PHP programmers using version 4 or 5 have to change their habits.
- The operators continue and break will work with a constant parameter or without parameter.
- The ereg() function for regular expressions will be deleted. It will be replaced by preg_match() whose format is different but more generally used.
- The compatibility with older formats like GD 1 and Freetype 1 will no longer be supported.
- Magic_quotes, that was very decried as a source of security holes will no longer be supported.
- The same is true for register_global, safe_mode and register_long_arrays.
We must therefore modify the current applications to make them compatible. - The tags will no longer be recognized, if you use <?php ?>, there will be no change.
Additions in both PHP 6 and PHP 5.3
Some features seemed so useful that it was decided to incorporate them into PHP 5, and they appear from the version 5.3:
- namespaces.
- XMLReader.
- XMLWriter.
These two functions can read and write XML files in Sax mode, thus gradually with little use of memory. Note that the appearance of namespaces will not require to rewrite the current code, which operates in a global and implicit default namespace.
Documentation and Resources
- Download PHP 6. Executable for Windows.
- Install PHP 6. Compiling sources to get an interpreter on Linux.