Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6603057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:57:22+00:00 2026-05-25T18:57:22+00:00

As you know, we can use Interface and Implements in PHP5. I used Interface

  • 0

As you know, we can use Interface and Implements in PHP5.
I used Interface in Java SE but It’s useful there only for listener or … but I can’t find any benefit of Interface in PHP5.

Please help me understand benefits of Interface in PHP5.

Thanks for your advice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:57:23+00:00Added an answer on May 25, 2026 at 6:57 pm

    In an object oriented language you can’t deny the benefits of Interface, there are hundreds of benefits.

    Let me give you an example for Dummies:

    I assume you use MVC and Ajax. And during every focusout of input you pass the input value to the server as well as a model name which is stored in the data-model (custom) attribute.

    <input name="myfield" value="myvalue" data-model="user_model" onblur="send ajax request .." />
    

    Now when you lost focus from the input it sends data to server like this

    {"a_model":"user_model","a_name":"myfield","a_value":"myvalue"}
    

    In the server you just call the model name which is received from ajax request. Something like this

    $this->{$a_model}->update($a_field,$a_value);
    

    Here the value of $a_model varies, so you can’t make sure that this model would have update() method. Here interface comes into play. Interface forces all the implemented models(classes) to have an update() method so that you can run above code unconditionally.

    Hope this makes sense.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm interested to know if there is an interface that I can use to
I know you can use C++ keyword 'explicit' for constructors of classes to prevent
I know you can use the <jsp:useBean> tag to instantiate objects within JSPs without
So I know I can use #include in BIB and REG files to pull
I need to store a double as a string. I know I can use
I know that you can use a dummy int parameter on operator++ and operator--
I know that I can use $('#myId').load('aPage.html'); to load a page into an element,
Do you know if I can use Visio to forward-engineer a sequence diagram into
Do you guys know how I can use the Curl command line to POST
I have a generator and I would like to know if I can use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.