What are the differences between PHP3 and PHP4 versions?



What are the differences between PHP3 and PHP4 versions?..

Answer / rakesh kumar nautiyal

PHP4 is a complete rewrite of PHP3 at the heart of the
language's engine. But why did the language's authors
decide to completely rewrite it?

The manner in which PHP3's scripting engine works is not
adapted to the execution of rich, large-scale applications
such as Phorum or KeyStone. Indeed, this engine reads PHP
script instructions line-by-line and then executes them one-
by-one, which enables PHP3 to obtain good performance with
short and simple scripts, but yields rather mediocre
performance with larger applications. It is important to
understand that PHP3 was not designed to execute such
applications.

It is for this reason that PHP3's two creators decided to
implement a scripting engine that would be capable of
reading all PHP code and "compiling" it before executing
it: Zend. This was not an easy task. Although
incompatibilities could be conceived at the time of
migration from PHP2 to PHP3, such differences had to be
limited as much as possible between PHP3 and PHP4 due to
the installed base and the number of PHP3 scripts already
in use. We can congratulate PHP4's authors on a job well
done because the incompatibilities that do exist are only
minor.

Although Zend is an integral part of PHP4, it is in fact a
scripting/runtime engine that is independent of the PHP
language. On this account, it is possible to use Zend in
MySQL as the basis for the development of a stored
procedure language specific to this database system.

Without going into the details of internal implementation,
we can point out a few things about the Zend/PHP4 couple.

PHP4's new architecture allowed its authors to add an
abstraction layer in relation to the Web server at the
heart of its language. Up until now with PHP3, we had the
choice between using it as a specific module for the Apache
server or in CGI mode for all other HTTP servers. With PHP4
it is now possible to imagine better integration with Web
servers other than Apache. In fact, this is the case for
Microsoft's HTTP server, IIS. PHP4 now works as an ISAPI
filter for Microsoft's IIS server. For this reason,
different parts of PHP4 code had to be made compliant with
use in a multi-thread environment (PHP4 is "thread-safe").

There are many new features concerning PHP4's internal
implementation, but they don't really concern PHP
programmers directly. Nonetheless, it is worth noting one
of the most important points: memory allocation and
reference counting mechanisms, in other words those
mechanisms that free up resources which were no longer
used, were completely rethought. Performance and memory use
are thus improved, especially for objects and tables. The
more data the variables contain, the more memory is saved.

Is This Answer Correct ?    12 Yes 1 No

Post New Answer

More PHP Interview Questions

what is the best function that can be used to connect to mysql database and in what cases that we can use below functions ? 1. mysql_connect() 2. mysql_pconnect() please give your answer with all pros and cons

1 Answers  


What is php form validation?

0 Answers  


What is the use of token in php?

0 Answers  


What is the super method?

0 Answers  


What does accessing a class via :: means?

1 Answers  






Tell me what is the use of mysql_real_escape_string() function?

0 Answers  


How to create a text file in PHP?

0 Answers  


What is regular expression in javascript?

0 Answers  


Tell me what does pear stands for?

0 Answers  


Tell me how is it possible to remove escape characters from a string?

0 Answers  


What are the two main string operators?

0 Answers  


What is baseurl?

0 Answers  


Categories