Why use interfaces in PHP (OOP)


Posted on 16th Feb 2014 07:03 pm by admin

I am learning OOP in PHP and its been a pretty good learning experience so far. What I didn't understand at all is interfaces. I understand the implications of multiple inheritance, and interface is used just to solve that. But what's the use?
If we have to define the function in derived class why use interface, why not directly declare and define it inside the derived class?
Am I missing something or is it really useless?

No comments posted yet

Your Answer:

Login to answer
79 Like 36 Dislike
Previous forums Next forums
Other forums

Looking for help reading a .txt or .ini file and outputting the info.
I have a file called Info.ini and It has the following info:
Code: [General]
Online=0
I wou

2 decima places & How to reload my page
Hello There,

How do i put full-stop (.) after second figure from behind? ie if i have 123456

Custom list order
Hi there,

I have checked this tutorial and it's great till the point where I want to display

php problem?
I don't think I'm stupid, but maybe I am.

I am working on a sit for a friend I am try to put

EXplanation help
Hey all,

I am still fairly new to PHP programming and I am trying to put together a page wher

Validating time
Hi Guys

what do you think of the following approach to validate a 24hour time:

http://

How do I replace any number of character occurences with one occurrence?
How do I replace any number of character occurences with one occurrence?

Let's say I have:

problem with php mysql query
Hi guy's...

I'm totally lost here..because don't have any idea how to make a query for grab r

Stats of viewers
Hello. I have a website in php and people can login. I want to make an admin control panel where u c

PHP and Javascript
Hi Guys,

Im trying to load the contents of an html file into a text area for editing, this is

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash