4.0.6

Latest release in branch 4.0
Released 24 years ago (June 23, 2001)

Software PHP
Branch 4.0
Status
End of life
End of bug fixes June 23, 2000
End of security fixes June 23, 2001
First official release version 4.0.0
First official release date 25 years ago (May 22, 2000)
Release notes https://www.php.net/ChangeLog-4.php#4.0.6
Source code https://github.com/php/php-src/tree/php-4.0.6
Documentation https://www.php.net/manual/en/
Download https://www.php.net/releases/4.0.6
PHP 4.0 Releases View full list

What Is New in PHP 4.0

Category Key Changes
Core Engine New Zend Engine, Reference Counting, Output Buffering
Web Features Sessions, Output Buffering, HTTP Session Management
Language Features Boolean Type, print() as construct, Expanded for loop
General Improvements Performance, COM Support, Build System (autoconf, libtool)

How did the core engine improve in PHP 4.0?

The biggest change was the new Zend Engine, which completely replaced the old PHP 3.0 engine. This new core introduced a much more efficient memory management system using reference counting. In practice, this meant scripts ran faster and used less memory, which was a massive win for building larger applications.

Output buffering was another game-changer. It allowed developers to capture output before sending it to the browser. This is essential for tasks like sending HTTP headers after some HTML has already been generated or for implementing custom output filters.

What new web features were introduced?

Built-in session support was a headline feature. Before PHP 4, you had to handle user sessions manually with cookies or hidden form fields. The new session functions made state management across page views trivial and secure.

The improved HTTP session management made it easier to handle cookies and headers. This provided a more robust foundation for building interactive web applications that needed to track users.

What language syntax was added?

PHP finally got a proper boolean type with the TRUE and FALSE constants. This cleaned up a lot of logic that previously relied on integers (1 and 0) for truthy and falsy values.

The print() language construct was added, giving developers another option for output besides echo. The for loop also became more powerful, supporting more complex iterative expressions.

Were there any other general improvements?

Performance was a major focus, and the Zend Engine delivered significant speed boosts across the board. The build system was modernized with autoconf and libtool, making it easier to compile PHP on various Unix-like systems.

Support for COM on Windows opened up new possibilities for scripting Microsoft Office applications and other Windows-specific components directly from PHP scripts.

FAQ

Was PHP 4.0 a major breaking change from PHP 3.0?
It was a major rewrite under the hood, but it maintained a high degree of backward compatibility. Most PHP 3 scripts continued to run without modification, which made adoption smooth for existing projects.

Why was the Zend Engine such a big deal?
It provided a modern foundation for the language with better memory management and performance. This directly enabled the development of more complex and resource-intensive applications that weren't practical before.

How did output buffering change development?
It solved the "headers already sent" error by letting you buffer all output. This allowed developers to set cookies or redirect pages at any point in the script, not just at the very beginning.

Did the new boolean type fix comparison issues?
It was a step in the right direction for type consistency. However, the loose type comparison system remained, so developers still had to be careful with comparisons between different data types.

What was the most impactful feature for web developers?
The built-in session management. It eliminated the need for custom session handling code and provided a standardized, secure way to maintain user state across multiple requests.

Releases In Branch 4.0

Version Release date
4.0.6 24 years ago
(June 23, 2001)
4.0.5 24 years ago
(April 30, 2001)
4.0.4 25 years ago
(December 19, 2000)
4.0.3 25 years ago
(October 11, 2000)
4.0.2 25 years ago
(August 29, 2000)
4.0.1 25 years ago
(June 28, 2000)
4.0.0 25 years ago
(May 22, 2000)