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

  • Home
  • SEARCH
  • 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 1115039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T03:05:52+00:00 2026-05-17T03:05:52+00:00

What is a abstract class and interface in PHP and when would you use

  • 0

What is a abstract class and interface in PHP and when would you use them? A layman answer with an example would be great to aid my understanding.

  • 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-17T03:05:52+00:00Added an answer on May 17, 2026 at 3:05 am

    Abstract classes and interfaces are not specific to PHP; they’re features of many modern object-oriented languages.

    An abstract class is a class that has one or more unimplemented member functions. You would use one in a situation where you would want a set of classes that have similar behaviors, differing only in a few methods. Each of these classes would derive from the abstract class, and implement the unimplemented methods in the manner that’s appropriate for their specific case.

    An interface is similar to an abstract class, but it contains no method implementations, only signatures. A class that implements an interface must implement all of the methods.

    A class can implement many interfaces, but can only be derived from one abstract class (or parent class of any sort), since PHP does not support multiple inheritance.

    Both abstract classes and interfaces allow for polymorphism; i.e., you can specify a reference as being to an abstract type (which could refer to any instance of class derived from it) or to an object implementing an interface.

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

Sidebar

Related Questions

What is use of an abstract class implementing an interface? In which scenario would
Is there a reason to use a 100% abstract class and not an interface
Possible Duplicate: PHP: What is the difference between an interface and abstract class? As
I am Studying PHP and i was thinking, Methods inside Abstract Class or Interface
Interface (or an abstract class with all the methods abstract) is a powerful weapon
I have an interface: public abstract class Authorizer<T> where T : RequiresAuthorization { public
I have a class like so: public abstract class ClassA<T> { protected ClassA(IInterface interface)
interface ICanvasTool { void Motion(Point newLocation); void Tick(); } abstract class CanvasTool_BaseDraw : ICanvasTool
Please consider the following three .NET types: I have an interface, an abstract class,
I am trying to provide an interface to an abstract generic base class. I

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.