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

Need help to modify php ELSE code
I'm trying to find a way to have the php code display a message if there is no inventory listed in t

Mail functionality from localhost to server
Hi

I am facing problem of mail functionality.

When i tested mail functionality in my

need to add "sizes" to shopping cart
Hey guys, I am trying to figure out a way to add a "size" selector on to this bit of code.

List/Menu Box
On an edit page when you want something to select what a user has previously selected from the datab

PHP Login
Hey!
I got this shopcart code online, am trying to modify it but am getting an error when i try a

IP Based Cron Jobs
I run cronjobs on my website. After one of my visitors got curious and tinkered around he realized h

Applet JTextField Size Problem
Hello,

I recently started making an applet to calculate certain values for airplanes. However

Shuffle Array
Hi,

I am writing a script for a game that needs players to randomly be assigned a target (ano

Number Format
Hi All,

I have number '000000000050085' I want to format it to 500.85 Can any one give me

Call Screen statement Error
Dear Experts,

is there any setting that needs to be done before creating any dialog progr

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