1: general-questions-for-oop-in-php
differace between dirname(__DIR__) and dirname(__DIR__).
| sno | particulars |
|---|---|
1: What is Object-Oriented Programming (OOP)?
2: Explain the four fundamental principles of OOP (Abstraction, Encapsulation, Inheritance, Polymorphism).
3: What is a class in PHP?
4: What is an object in PHP?
5: How do you create a class in PHP?
6: What are properties (or attributes) and methods (or functions) in a class?
7: How do you create an object in PHP?
8: What is the difference between a class and an object?
9: How do you access class properties and methods?
10: Explain the concept of access modifiers (public, private, protected) in PHP classes.
11: What is constructor and destructor in PHP? How are they used?
12: How do you implement inheritance in PHP? Explain the "extends" keyword.
13: What is method overriding in PHP?
14: How do you achieve multiple inheritance in PHP?
15: What is the difference between abstract classes and interfaces?
16: How do you define an abstract class in PHP?
17: How do you define an interface in PHP?
18: Can you instantiate an abstract class or an interface?
19: What are traits in PHP? How do they differ from classes and interfaces?
20: How do you use namespaces in PHP to avoid naming conflicts?
21: Explain static properties and methods in PHP classes.
22: What is late static binding in PHP?
23: How do you implement polymorphism in PHP?
24: What are magic methods in PHP? Give some examples.
25: How can you prevent a class from being inherited?
26: How do you implement method chaining in PHP?
27: What is autoloading in PHP, and how does it work?
28: How do you implement dependency injection in PHP?
29: Explain the SOLID principles of OOP and their importance in PHP development.
30: What is the difference between type hinting and type declaration in PHP?