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

if statements problems
Hi. I'm trying to make a web form, but I kind of hit a dead end trying to figure out why it doesn't

gather checkbox data from form into email
Hello all,

First, i'd like to thank everyone who responded to my previous posts regarding set

MySQL noob question
hi guys

I have a simple mysql table set up, along the lines of

Col 1 - Col 2 - Date_l

IS this code correct
The reason i ask is everything underneath it appears to be alink as well, tis blimmin annoying

Word Trimming
Hi Guys & Gals!!

Hope you are all ok....

I need some help with the following

Problem with variable declaration in switch statement
Hello, I am having some trouble assigning a value to a variable inside a switch statement. What I a

Change Age automatically
hi guys . im new to php , is it possible to change age value in mysql automatically when year change

Not reloading page after php form submit
Hello helpful souls out there. You guys have come through for me in the recent past and I'm hoping s

Help with page encoding issue and weird characters
I'm trying to write a screen scraper and when I pull out the lines of the html file that I'm interes

cURL Upload Help
OK, I am creating a bridge from a local program to my website and I am trying to find the best way t

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