Explain about getters and setters in php?



Explain about getters and setters in php?..

Answer / Shrikant Saroj

Getters and Setters are methods used in PHP to encapsulate data. A getter is a method that retrieves the value of a private property, while a setter is a method that sets the value of a private property. This helps protect the data from being modified directly.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

Is php is dying?

1 Answers  


Tell us how to redirect a page in php?

1 Answers  


What is $_ get and $_ post in php?

1 Answers  


Does php pass arrays by reference?

1 Answers  


How to get the number of characters in a string?

1 Answers  


Is php an oop?

1 Answers  


Explain me what are the main error types in php and how do they differ?

1 Answers  


What are differences between PECL and PEAR?

1 Answers  


How do sessions work in php?

1 Answers  


how we can upload and view video files

2 Answers  


What does the unlink() function means?

1 Answers  


Tell me what the difference between the 'bitwise and' operator and the 'logical and' operator?

1 Answers  


Categories