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

Error In Syntax
I got this error:

Code: Parse error: syntax error, unexpected '>' in /home/bucket/publ

Please help understand this code
I noticed the index page on my site was modified this morning and found this code inserted at the bo

Remove values in array2 from array1
I have two arrays.

Array 1 is where the array key holds various different numbers. For exampl

I need some help with the IF command...
I have a large number of images in one section of my website with the .jpg format. I'm adding a bun

Can I use a loop
Hi buddies!

Once again with my doubts here.

Right now I am using this sql stat

PHP header help!
Hi all I am trying to get this php page to refresh every 5 seconds on my phone which is an aastra 48

Adding meta tags under Zend FW
Hello there, recently has come to my hands the FTP of a website which is running under Zend, I would

Creating an invoice
Using fpdf I am trying to create an invoice to send to clients. The products are sold in pricing tie

use an array from 1 class in a second class
I have a class that adds data to an array

Then I have a second class and I need to check if t

fire away
i launched about 4 months ago as a lagit co. i have 2 paying clients, 1probono, 1 side progect, and

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