With the release of PHP 5.3, this open source dynamic language has received its most important update in the past two years. The new version of PHP has a long list of new features and greatly improved performance.
It should be said that PHP version 5.3 is a major version larger than developers expected, adding some features that were originally planned to appear in PHP 6. The new version of PHP will continue to play the role of an open source language competing with multiple technologies such as Ruby, Java and .net.
PHP core developer Ilia Alshanetsky said, “In terms of new features and functionality, PHP 5.3 can be said to be more comprehensive than anyone expected, mainly due to the delay in the release of PHP 6. So even though it is released The time interval is a bit long, but I think the wait is worth it. PHP 5.3 is an excellent work that has gathered the efforts of many developers. "
Alshanetsky said that, like most important versions of PHP, this version of PHP Numerous improvements have been introduced to make it easier for developers to use it.
One of the ways PHP 5.3 simplifies application deployment is its support for new namespaces, which are a way of encapsulating classes and other PHP objects.
Alshanetsky said that for PHP developers, namespaces can bring clearer code and simpler name conventions.
"Currently, most library authors are forced to prefix their class and function names with the library name to avoid naming conflicts, which sometimes results in rather awkward names. " Alshanetsky said. "This feature will also simplify the utilization of multiple libraries in a single application, which do not necessarily have to follow detailed naming conventions, such as prefixing their class/function names, etc."
Speed up the connection with MySQL
PHP is often used in conjunction with the open source database MySQL to develop Web applications. They are a very important part of the open source development tool combination LAMP. A new function called MySQLInd was added in PHP 5.3, which replaced the previous libmysql library and was used to connect PHP and MySQL, with the possibility of optimizing MySQL performance and memory utilization.
Alshanetsky said, “When it comes to databases, in most cases the main bottleneck is not the speed of the database interface, but the operation of the database. Using MySQLInd to replace the standard libmysql will definitely bring about speed improvements. But I don’t think it will make all applications run faster. In other words, people who use highly tuned MySQL applications will see speed improvements from the faster and more specialized interface in the new version of PHP. ”
Overall, Alshanetsky predicts that by moving from the current PHP 5.2 to PHP 5.3, users should see a 5% to 15% improvement in performance for most workflows, and some specific workflows may even see better performance. high yield.
E_DEPRECATED flags features that will be deprecated
While adding new features is a key part of any new technology release, PHP 5.3 has its own special - It clarifies which features may be eliminated.
This release provides a new error code called E_DEPRECATED to let developers know which specific features are about to disappear from the language.
Alshanetsky said, “We have encountered this problem before. We do not have a clear error code to indicate a feature that is no longer supported. It is difficult for people to judge at the error code level what features may eventually be moved. "
To solve this problem by creating a dedicated error code, developers can use PHP's error logging tool to identify which parts of their code base are still using the functionality that will be removed, so Developers can make adjustments accordingly.
According to Alshanetsky, there is a consensus among the PHP development team that functions currently marked as E_DEPRECATED will be removed in PHP 6.
【Related articles】