PHP4 and PHP5

Introductions –

First starts with PHP4 features. PHP4 started up with object-oriented concepts like as c++. PHP4 got almost all the OOPs features. With little difference in functionality…

Below are PHP4 added features –

class

extends

Constructors

Scope Resolution Operator (::)

parent

Serializing objects – objects in sessions

The magic functions __sleep and __wakeup

References inside the constructor

Comparing objects

PHP 5 now came up with new Object Model. Even php4 contains the object model functionalities but PHP5 handling of objects has been completely rewritten, allowing for better performance and more features.

Features Of PHP5 –

Constructors and Destructor

Visibility

Scope Resolution Operator (::)

Static Keyword

Class Constants

Class Abstraction

Object Interfaces

Overloading

Object Iteration

Patterns

Magic Methods

Final Keyword

Object cloning

Comparing objects

Reflection

Type Hinting

Late Static Binding

Some of the above features are in PHP4. But still PHP5 has got improved functionalities on above features. Some of the syntaxes are changed.