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

PHP code needed to get/post form fields and request mysql query results.
I'm new to PHP

I've created an html form to allow the user to request a basic telephone dire

Calling strings from other php class
I have test1.php{
$string1;
$string2;
....
... //10 strings in this class <

Inserting a variable in a link
I have this code that I want to insert for my own variable but I have no idea how. This is what I wa

Unifying logins of two different scripts
I have two different game scripts which I want to embed on my own site. The problem is I don't want

Where am I going wrong
Been trying to work this out for hours

I have two tables called 'Genres' and 'Films'. Genre

Code error with Index.php
Error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/runevid/public_

values not being entered into table
hi. I;ve created a form, so that when a user enters data into it, it gets added to a table in a data

bind error during socket programming
i am kinda new to socket programming. wrote the below code for a server. but getting the bind error

Loops and Classes
I am making a template system and everything seems to be going well up until I have to loop in a var

unoconv doc convert to pdf code prob
PHP/5.3.1

Hi. I am trying to use this code to convert docs to .pdf utilizing unoconv. Howe

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