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

preg-match with a string and numbers
Hi, I can't get the expression to work for my preg_match, what I'd like is for it to match the strin

extending tidy
I have problem with type-hinting and extending tidy. This code creates error:
Code: class cMyTidy

Oracle Connectivity
Hi Every One,

Can we access SAP from oracle database.If it possible then please spec

Searching keywords from array
Hello everyone, Im just wondering if someone could help me with another issue im having. Im still le

urldecode question
How would I format this line of code properly?

<?php echo urldecode($_GET['Title']); ?

Basic Question Regarding PHP Includes
Hi

Just starting out with PHP.

Working on a site that uses some basic includes, these

simple ping code
been searchin the site/web and found code thats simple but doesnt work.

I have a personal we

Putting double spaces instead of single spaces
Im looking at trying to replace all single spacing between fields with double spacing

At pres

strptime() equivalent for php4 ?!
Greetings!

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

Well, the ti

Operating System
How in PHP or other language can I detect Operating system, ie Windows XP Home, Windows 7 Ultimate,

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