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

pls clear my confusion
Hi friends,

Pls solve my query .

what is the exact use of Scope Resolution Operator( i

Question about the upload of large files
Hi there,

I have a question about the upload of large files, like videos (files generally abo

Not sure why this script is not working?
Hi I am new to php programing and I was trying to make up a simple script like a captcha but I canno

Warning message
I've put a website that I was doing live and I'm getting this warning message when I try to add a ne

Sharing PHP Sessions Across Domains
I am in the process of writing a script to share a php session across various domains I have.
The

PHP error on MySQL insert
I'm sure it's the simplest of issues, but I can't recall why this isn't working.

Code: [Selec

Filtering an Array Based on Value
I have a very simple script set up that pulls data from a database and is output using this code:

PHP and Javascript
Hi Guys,

Im trying to load the contents of an html file into a text area for editing, this is

database design
Hi,

I got a page which allow candidate to type in their previous working experience,
I let

Include ("Absolute Path") of a file?
I'm not sure what I'm doing wrong. I am writing my php code in the same directory of the file that

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