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

show the direct link into href
I want to display link on the page. i am fetching the data(URL) from database,actually before that i

IS this code correct
The reason i ask is everything underneath it appears to be alink as well, tis blimmin annoying

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

how do i display data on a page from mysql
1 - do i use this code at the top of each of my page i wish to only alow access if there as been a s

How to find OS bit version
How can I tell the person browsing my site is running 32, or 64 bit operating system?

Print out contents of to Excel
I have got this script that gathers all the data that I need but I need it to send it to excel inste

Batch Related Pricing
Hi, I need some clarity on the batch related pricing

For example the following are the b

Warning message
I've put a website that I was doing live and I'm getting this warning message when I try to add a ne

Better Method of a Member Cloud
I assume most people know how tag clouds work, where the tags most used are bigger and the least use

Default TimeZone
The server I'm working with is hosted in America so all times inserted into the database are coming

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