PHP4 vs PHP5 | Difference between PHP4 and PHP5

PHP - Hypertext Preprocessor

PHP Hypertext Preprocessor
Developer Rasmus Ledorf
Year 1994

PHP, Hypertext Preprocessor , The Open Source Language which is trend in the 20th century for creating fast and dynamic web pages. This the Server Side Scripting Language, with a powerful tool for creating web pages. Lets see the revision of PHP version 4 and 5.

PHP4 vs PHP5 (Additional Features of PHP5)

Constructors and Destructors

  • In PHP4, Constructor have same name as the Class name.
  • In PHP5, name Constructors as _construct and Destructors as _destruct().

Passed by References

  • In PHP4, everything was passed by value.
  • In PHP5, all objects are passed by references.

Abstract

  • In PHP5, we can declare a class as abstract.

Static Methods and Properties

  • In PHP5, Static Methods and Properties are also available. When you declare a class as static, then you can access using :: operator without creating an instances of class

_autoload()

  • PHP5 introduces a special function called _autoload().

Final

  • PHP5 allows you to declare a class or method as final.

Magic Methods

  • PHP5 introduces magic methods such as _call, _get, _set and _tostring

Visibility

    PHP5 has 3 level of visibilities
  • Public: methods are accessible to everyone including objects outside the class
  • Private: methods are accessible to the class itself
  • Protected: methods are accessible to the class itself and inherited classes.

Exception

  • PHP5 introduces exceptions handling.

Interfaces

  • PHP5 introduces Interfaces.

E-Strict Error Level

  • PHP5 introduces new error level defined as E_STRICT.
  • E_STRICT will notify you when you use depreciated code.

Extensions

    PHP5 introduces new default extensions.
  • Simple XML
  • DOM and XSL
  • PDO
  • Hash
Get Related News: , ,

6 comments:

  1. Good article.
    Also good for few years experience person.

    Here is one article for PHP4 vs PHP5:
    http://www.namasteui.com/difference-between-php4-and-php5/

    ReplyDelete
  2. This is very interesting, You are a very skilled blogger. I have joined your rss feed and look forward to seeking more of your great post. Also, I have shared your site in my social networks! best 29er under 500

    ReplyDelete

Thanks for taking time to leave a comment