class Database
{
public static $_instance;

public static function getInstance()
{
if(!isset(self::$_instance))
self::$_instance = new Database(DB_SERVER, DB_USER,
DB_PASS, DB_NAME);
print_r(self::$_instance);
return self::$_instance;
}
}
can any one explain "self::$_instance = new
Database(DB_SERVER, DB_USER, DB_PASS, DB_NAME);" this line

Answer Posted / guest

self::$_instance = new
Database(DB_SERVER, DB_USER, DB_PASS, DB_NAME);

It represents object creation of the class 'Database'.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many types of inheritances used in php and how we achieve it.

710


What is difference between print_r and echo in php?

705


Tell me will a comparison of an integer 12 and a string "13" work in php?

878


How do you create an array in php?

741


How to set cookies in PHP?

826


Is laravel an oop?

699


So if md5() generates the most secure hash, why would you ever use the less secure crc32() and sha1()?

805


How would you declare a function that receives one parameter name hello?

752


What are the string functions in php?

749


What are the steps involved to run php?

813


What are the methods of array in java?

722


How do I repair phpmyadmin?

721


What beforeFilter() is used?

854


What is the use of the function 'imagetypes()'?

746


What is the basic function to search files for lines (or other units of text) that contain a pattern.

788