What is singleton class in php?



What is singleton class in php?..

Answer / Asha Kumari

"In PHP, a Singleton is a design pattern that ensures a class has only one instance and provides a global access point to it. It can be achieved by defining the __construct() method as private, creating a public static property for the instance, and providing a public static method to access or create the instance if needed."n

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

hi abinashg i think u have experience in php plz tell me more about php now i raearlly want to do php wat is the future.my email id atul_saini2@yahoo.co.in.plz guide me thanks...........

2 Answers  


I am writing an application in php that outputs a printable version of driving directions. It contains some long sentences, and I am a neat freak, and would like to make sure that no line exceeds 50 characters. How do I accomplish that with php?

1 Answers  


When to use inquire vs enquire?

1 Answers  


How can we register the variables into a Session?

7 Answers   HCL, Star Computers, Trikon Networks,


Tell me what is the difference between ereg_replace() and eregi_replace()?

1 Answers  


•How to access crystal reports through PHP code?

1 Answers   Satyam,


Who is the father of php and what is the current version of php and mysql?

1 Answers  


How big is nvarchar max?

1 Answers  


How to retrieve values out of an array?

1 Answers  


Do you know what is the use of the function 'imagetypes()'?

1 Answers  


How to read a file in php?

1 Answers  


How to randomly retrieve a value from an array?

1 Answers  


Categories