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 to calculate days from variable date?
This will be easy for one of you gurus. I want to fetch the date from a variable date, for example:<

Help with forum quoting?
Hi im working on a forum and I have alomost finished it but i want a user quote system like twitter

PHP Blog help
Need help with posting comments in a word press blog? I have a comments page where the comments are

How to secure my login data to my database?
Hi there,

It may be a stupid question but I don't know how to secure my login data to my data

PHP referral database. I would like this form to email the referrer.
Okay, Hello I've been trolling for years. This the first time I've ever asked for php help. Normally

this code is not working????
it says this error.. Warning: Division by zero in ..

the variables are correct, so why is th

Required to login help
I'm trying to set up my site so users have to be logged into the forum to access the site.I've been

Linkage between two scripts
Okay say I have this for a link in a script:

Code: <li><a href="#&q

Php - mysql select?
hi, i have this code:

Code: <?php
session_start();
// dBase file
include &quo

mySQL and PHP search
Hello,
I am trying to code a project and ran into a brick wall with one of my pages. I am pretty

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