Why do we use polymorphism in php?



Why do we use polymorphism in php?..

Answer / Gaurav Kumar Sinha

Polymorphism in PHP allows objects of different classes to be treated as objects of a common super class, providing a powerful mechanism for code reuse and abstraction. It enables methods to perform differently based on the object's class, making the code more flexible and easy to maintain.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

Tell me how do you execute a php script from the command line?

1 Answers  


Is php used in 2019?

1 Answers  


Tell me how to initiate a session in php?

1 Answers  


What is php? Why it is used?

1 Answers  


What is the difference between $_files['userfile']['name'] and $_files['userfile']['tmp_name']?

1 Answers  


How do you call a constructor for a parent class?

1 Answers  


How do you access a get requests url parameter with php?

1 Answers  


What is final keyword in php?

1 Answers  


What are the special characters you need to escape in double-quoted stings?

1 Answers  


Describe the security vulnerability of PHP?

1 Answers  


What does php do?

1 Answers  


Explain me what is the goto statement useful for?

1 Answers  


Categories