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

$_POST variable un-useable
I'm trying to use a $_POST variable in a mysql update statement but i can't use it for some unknown

first few characters only
hi, does anyone know how to use PHP to take the first few words of a text and limit them? i have see

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

for loop without same $i digits?
Hi,

Can some guru please advise how can I accomplish this with a simple for loop ?

I

PHP and MySQL Question/Help
I have a MySQL db with all my servers and all their details like server name, IP, OS, RAM etc etc 26

Email with Attachments in PHP
Hi Friends

How to send email in PHP with attachment.
I know simple mail can be sent with

Writing to the middle of a file
Hi I have a bit of a problem. Is there any way i can write some text to a middle of a text file. For

php calculate
this code echoes correctly the sum but the inserted result is 0??
Code: <?php
$TotalNum

PHP Multiples of 2, Show posts...not working (wordpress)
I have been using this code to show div.example with 6 li columns inside it, each li is a post with

mail() problem
Hi Guys,

I've set up a contact email form. It sends the information fine, but it sends it to

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