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?
Did you know?Explore Trending and Topic pages for more stories like this.
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 HELP] Php order form.
Hello to everyone @ phpfreaks. Im new to this site and hope to learn lots of things here.

Fir

weird problem
last time, i did post a topic concerning why my page sometime will load as blank page when using IE.

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

Simple Variable Question
Hi everyone.... again,

I am really getting into php still. Learning more every day. I love it

Database 'Validation'
Hi everyone,
I'm trying to validate the password entered by the user with the password in the dat

Internal Server Error issues
This has been bothering me for weeks and I've been trying to solve it without asking for help, but e

Problem with HTML form
Hello,

I made a HTML form with some fields and check box.
Everything works fine except whe

Error when call dll from oracle
Hi all, please help me!

I have dll write C language, I want call it from oracle procedur

multipart emiail forms
Hi All,

I am new to the boards and I've been working on a form (which is rather massive, imo

query based on 2 conditions
I want to select if the doc_type is either s OR f but this doesn't work:

Code: [Select]$query

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