php developer Mumbai
php developer India
Website development Mumbai
website optimization seo
php freelancers India

php4-vs-php5

Though php4 is based on OOPS Standards, It does not support full OOPS concepts.
Thats why PHP5 comes up with all features of OOPS. Here I am explaining all differences in php4 and PHP5.
1.Constructors and distructors
PHP4 has constructors but doesn't have concept of distructors.
PHP5 supports both constructors and distructors.
Constructors ar used for initialization operations and the distructors are used for the finalizing operations like deallocation of memory and/or closing database connections etc.
Convention
PHP4 : Normally constructors are written with same name of the class name. so same convention is followed in php4 also.
PHP5: Introduced new convention of writing a constructor.

syntx of constructors:
function __constructor()
{
// initialize operations.
}

syntx of distructors:
function __distructor()
{
// finalizing operations.
}
Though php5 has introduced this new convention of writing constructors and descructors, it also support full backword compatibility.Means you can write in older syntax also.

2.Access Specifiers in php
PHP4: Not available
PHP5: Started using access specifiers.
Assess specifiers in php5 are listed below. Access specofoers are used for data hiding.
public
private
protected

So the important oops concepts like data hiding is available with PHP5 now. - HURRAY