New Object Oriented Features - By PHP Expert


Interfaces
Gives the ability for a class to fulfill more than one is-a relationships. A class can inherit from one class only but may implement as many interfaces as it wants.

interface Display {
function display();
}

class Circle implements Display {
function display() {
print "Displaying circle ";
}
}

instanceof operator
Language level support for is-a relationship checking. The PHP 4 is_a() function is now deprecated.

if ($obj instance of Circle) {
print '$obj is a Circle';
}

No comments

Enter your email address:

Delivered by FeedBurner

OR

 Subscribe in a reader

 
Latest Blogs