PHP 4 Features
On May 22, 2000, roughly 18 months after the first official announcement of the new development effort, PHP 4.0 was released. Many considered the release of PHP 4 to be the language’s official debut within the enterprise development scene, an opinion backed by the language’s meteoric rise in popularity. Just a few months after the major release, Netcraft (http://www.netcraft.net/) estimated that PHP had been installed on over 3.6 million domains, making it one of the most popular scripting languages in the world.
Features
PHP 4 included several enterprise-level improvements, including the following:
- Improved resource handling: One of version 3.x’s primary drawbacks was scalability. This was largely because the designers underestimated how much the language would be used for large-scale applications. The language wasn’t originally intended to run enterprise-class Web sites, and subsequent attempts to do so caused the developers to rethink much of the language’s mechanics. The result was vastly improved resource-handling functionality in version 4.
- Object-oriented support: Version 4 incorporated a degree of object-oriented functionality, although it was largely considered an unexceptional implementation. Nonetheless, the new features played an important role in attracting users used to working with traditional object-oriented programming (OOP) languages. Standard class and object development methodologies were made available, in addition to object overloading, and run-time class information. A much more comprehensive OOP implementation has been made available in version 5, and is introduced in Chapter 5.
- Native session-handling support: HTTP session-handling, available to version 3.x users through the third-party package PHPLIB (http://phplib.sourceforge.net), was natively incorporated into version 4. This feature offers developers a means for tracking user/site interactions with unparalleled efficiency and ease. Chapter 13 covers PHP’s session-handling capabilities.
- Encryption: The MCrypt (http://mcrypt.sourceforge.net) library was incorporated into the default distribution, offering users both full and hash encryption using encryption algorithms including Blowfish, MD5, SHA1, and TripleDES, among others. Chapter 16 delves into PHP’s encryption capabilities.
- ISAPI support: ISAPI support offered users the ability to use PHP in conjunction with Microsoft’s IIS Web server as an ISAPI module, greatly increasing its performance and security.
- Native COM/DCOM support: Another bonus for Windows users is PHP 4’s ability to access and instantiate COM objects. This functionality opens up a wide range of interoperability with Windows applications.
- Native Java support: In another boost to PHP’s interoperability, support for binding to Java objects from a PHP application was made available in version 4.0.
- Perl Compatible Regular Expressions (PCRE) library: The Perl language has long been heralded as the reigning royalty of the string parsing kingdom. The developers knew that powerful regular expression functionality would play a major role in the widespread acceptance of PHP, and opted to simply incorporate Perl’s functionality rather than reproduce it, rolling the PCRE library package into PHP’s default distribution (as of version 4.2.0). Chapter 9 introduces this important feature in great detail, and offers a general introduction to the often confusing regular expression syntax.
In addition to these features, literally hundreds of functions were added to version 4, greatly enhancing the language’s capabilities. Throughout the course of this book, I’ll discuss much of this functionality, as it remains equally important in the version 5 release.
Drawbacks
PHP 4 represented a gigantic leap forward in the language’s maturity. The new functionality, power, and scalability offered by the new version swayed an enormous number of burgeoning and expert developers alike, resulting in its firm establishment among the Web scripting behemoths. Yet maintaining user adoration in the language business is a difficult task; programmers often hold a “what have you done for me lately” mindset. The PHP development team kept this notion close at hand, because it wasn’t too long before they began yet another monumental task, one that could establish PHP as the 800-pound gorilla of Web scripting languages: Version 5