Home Top Ad


ADLABS

Share this Page.


PHP4 and PHP5 Comparison

Source: http://nextresources.blogspot.in/2012/11/php4-vs-php5-difference-between-php4.html

PHP - Hypertext Preprocessor

PHPHypertext Preprocessor
DeveloperRasmus Ledorf
Year1994

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
- See more at: http://nextresources.blogspot.in/2012/11/php4-vs-php5-difference-between-php4.html#sthash.ilBtREyZ.dpuf
PHP4 and PHP5 Comparison PHP4 and PHP5 Comparison Reviewed by Ajinkya Deshpande on 12:47 PM Rating: 5

No comments