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?
Did you know?Explore Trending and Topic pages for more stories like this.
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

foreach help.
Hello all,

First time I'm attempting to use a foreach statement and was just wondering if my

preg_replace question
Hello!!

I hope someone can help me with preg_replace.

I load two tables from an extern

ob_ dynamic content
i was wondering about the potential to use ob to create a <div then remove it when the page

Keeping data in form
How can I keep whatever I write in the form?

Cannot Display Array from Select Statement + Login question
Hi,
I'm new to PHP but so far so goog. I was assigend a project and I'm very close to completion.

extending tidy
I have problem with type-hinting and extending tidy. This code creates error:
Code: class cMyTidy

update post issues
I am trying to create an update to a post function, while the update does occur, the page routing an

.htpasswd Registration Form
Hi,
I wanted to make an htpasswd registration form.
I found this code on the internet but have

Sequre login with cookies.
I want to build secure login with cookies. I just want your ideas about this, your suggestions. What

Login Functionality Working Different on IE
This is an odd one, I have a site which has an admin section. The admin pages unsurprisingly require

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