what is differences between PHP4 and PHP5

PHP4 and PHP5:
  • PHP5 removed register_globals, magic quotes, and safe mode. This was 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 was powered by Zend Engine II.
  • PHP5 replaced magic quotes with the addslashes() function in order to escape characters.
  • PHP4 is more of a procedure language while PHP5 is object oriented.
  • 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 PHP4, everything was passed by value, including objects. Whereas 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.