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

Count
Getting the same count everytime

Code:
$visitquery = mysql_query("SELECT COUNT(*) FR

C++ API to Oracle dB
I need to perform a select command to the Oracle dB to obtain information from a table.
What libr

Xml parsing
I need a suggestion about parsing xml with multiply parts like pervious...
i.e. different device

Insert Failing.
Hey,
I am making a Sign up page for a website, but the insert query into the Database does not se

$_GET problem
Hi all,

Have a bit of a problem with a little piece of code, I am not sure if this should be

The control with ID 'ace' requires a ScriptManager on the page
I'm trying to add a simple AlwaysVisibleControlExtender to my page, but it's not working. I get the

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

Connecion issue
Hi,

For some reason, I keep getting this error when trying to connect:

Warning: mysql_

strptime() equivalent for php4 ?!
Greetings!

this is my first post, thank you in advance for your replies.

Well, the ti

Storing Values taken from a DB...
Using this code it will generate a short list from my database

<?php
mysql_connect

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