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

Log $_POST
How would i log submits on a form, by everyone? I want to then echo the number of submissions.

data type in column definition
Hi,
I create a table with column called "Direction of Travel code ".
The travel codes in t

Display thumbnails as square while retaining aspect ratio
I am trying to figure out a way to make an image display as a square, for example 80x80 pixels, when

include function being weird?
I have a very simple system to grab an IP outputted by a PHP file.. (for a project I have) but it ou

Querying info from one table based on info in another
Hi, I am currently trying to make a part for my user driven website where one user can subscribe to

retrieving images from mysql database using php
So I've been trying to figure out how to store images in a mysql database, and as far as i can tell

cURL Upload Help
OK, I am creating a bridge from a local program to my website and I am trying to find the best way t

Comparing two dates
Hi Guys
I have two dates I want to compare. Below is my current implementation. The problem with

phph within href not showing php if change ? to &
Code: [Select]<a href="<?php echo $puser; ?>?m=<?php=(($m-1)&l

use an array from 1 class in a second class
I have a class that adds data to an array

Then I have a second class and I need to check if t

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