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

how can i display php source code snippets ?
I am outputting some pho code .. and I want to display the source code so people can copy and paste

Writing to the middle of a file
Hi I have a bit of a problem. Is there any way i can write some text to a middle of a text file. For

How to generate a text file using php...?
Hi,
Can anyone give me code to generate a text file using php


Thanks in advance

Undefined offset
The following script checks to see if the user answer matches the correct answer.

Form Fiel

Code Review - SQL and Insertion Attacks (Warning: Not for Newbs)
Hey guys,

Its been a while, I know. Use to love coming here to answer peoples questions, but

get url?
how do i get the url of the page i'm currently on, on my website.. i think its get header.. how do i

Update not working ... please help
Hi,

I am trying to update a row using an edit form by passing id of the row .. but it is not

Exporting new records
Trying to figure out the best way to set this up.

People register my site.

Their prof

Search with relational database
Hey,

I have quite a complicated (for me anyway ) relational database for an apartments syste

Help with syntax
Hi all!

The $bridge variable is not getting passed while it is contained in the line below:

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