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 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.

send message to the java application
Oracle 10g with Windows platform.

I have a java application that periodically pings the d

Open link with largest int string first
I have the following links i would like to open either all at once or one-by-one. How would i procee

captcha error
I have been trying to implement a captcha in php...

here is the code..
Code: (php) [Select

Newb advice
Hi all,

I'm a flash front end designer and I've taken on a project that needs some back end p

random generation
hi

i need help with generating this

numbers from 1-12

i want to generate in ran

PHP Display Telephone Number On Referrer
I have used the php below to show a different telephone number in the header of the site depending u

reorder sql query
ok so i have this very simple code:
Code: $query = "SELECT search_keywords, COUNT(search_key

Share admin accross websites
I'm using .net memberships and roles in one of my sites, but I need to be able to share logins and p

Alternate messaging
I have 4 strings in MySQL db1

$string1 : Hello
$string2 : Hi
$string3 : Great
$strin

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