Difference between PHP and PHP5

Key difference: PHP a server-side scripting language that has its main implementation in web development. However, it can be used as a general-purpose programming language. On July 13, 2004, PHP5 was released. It is the latest version of PHP. It is powered by Zend Engine II. It was an improvement over PHP4 and included various new features.

PHP is a server-side scripting language that has its main implementation in web development. However, it can be used as a general-purpose programming language. PHP was originally created by Rasmus Lerdorf in 1995 and it is currently managed by The PHP Group. PHP originally stood for Personal Home Page, however it was later renamed. It now stands for PHP: Hypertext Preprocessor, a recursive acronym. PHP is free software released under the PHP License, as is incompatible with the GNU General Public License (GPL) due to restrictions on the usage of the term PHP.

PHP is an open source, server-side, HTML embedded scripting language. It can basically perform any task that other CGI programs can, but it is mainly used to create dynamic Web pages. Its main advantage is that it is compatible with many types of databases. Furthermore, PHP can talk across networks using IMAP, SNMP, NNTP, POP3, or HTTP.

PHP includes a command-line interface capability and can be used in standalone graphical applications. PHP commands can be embedded directly into an HTML source document rather than calling an external file to process data. In the HTML document, the PHP script is enclosed within special PHP tags. Due to these tags, the programmer can alternate between HTML and PHP instead of having to rely on heavy amounts of code to output HTML. Also, as PHP is executed on the server, the client cannot view the PHP code.

On July 13, 2004, PHP5 was released. It is currently the latest version of PHP. It was powered by Zend Engine II. It was an improvement over PHP4 and included various new features, such as improved support for object-oriented programming, the PHP Data Objects (PDO) extension and numerous performance enhancements. The PDO extension defines a lightweight and consistent interface for accessing databases. Late static binding was added in version 5.3. PHP5 was also designed to be backward compatible with earlier versions of PHP and hence should result in little functionality being broken while converting from PHP4 to PHP5.

As compared to previous PHP versions, PHP 5 differs in the following ways:

  • PHP5 removes register_globals, magic quotes, and safe mode. This is due to the fact that register_globals had opened security holes by intentionally allowing runtime data injection and the use of magic quotes had an unpredictable nature.
  • PHP4 was powered by Zend Engine 1.0, while PHP5 is powered by Zend Engine II.
  • PHP5 replaces magic quotes with the addslashes() function in order to escape characters.
  • PHP5 is more object-oriented than previous versions.
  • In PHP5, one can declare a class as Abstract.
  • PHP5 incorporates static methods and properties.
  • PHP5 introduces a special function called __autoload()
  • PHP5 allows one to declare a class or method as Final
  • PHP5 introduces a number of magic methods, such as __call, __get, __set and __toString
  • In PHP5, there are 3 levels of visibilities: Public, private and protected.
  • PHP5 introduced exceptions.
  • In PHP5, all objects are passed by reference.
  • PHP5 introduces interfaces. All the methods defined in an interface must be public.
  • PHP5 introduces new error level defined as ‘E_STRICT’
  • PHP5 introduces new default extensions such as SimpleXML, DOM and XSL, PDO, and Hash.
  • PHP5 introduces new functions.
  • PHP5 introduces some new reserved keywords.
  • PHP5 includes additional OOP concepts than php4, like access specifiers , inheritance etc.
  • PHP5 includes improved support of current content management systems.
  • PHP5 includes reduced consumption of RAM.
  • PHP5 introduces increased security against exploitation of vulnerabilities in PHP scripts.
  • PHP5 introduces easier programming through new functions and extensions.
  • PHP5 introduces a new MySQL extension named MySQLi for developers using MySQL 4.1 and later.
  • In PHP5, SQLite has been bundled with PHP.
  • PHP5 introduces a brand new built-in SOAP extension for interoperability with Web Services.
  • PHP5 introduces a new SimpleXML extension for easily accessing and manipulating XML as PHP objects. It can also interface with the DOM extension and vice-versa.
  • In PHP5, streams have been greatly improved, including the ability to access low-level socket operations on streams.

Image Courtesy: itvedant.com, php5.phpmagazine.net

Most Searched in Business and Finance Most Searched in Cars and Transportation
Most Searched in Environment Most Searched in Society and Culture
MP3 vs MP4
Food Allergy vs Food Intolerance
Google Pixel vs Pixel XL
Insulator vs Dielectric

Add new comment

Plain text

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.