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

Which is used to maintain the value of a variable over different pages?

562


Write a program to get second highest number in an array using php?

527


Is php used anymore?

519


Explain what is the difference between mysql_fetch_array() and mysql_fetch_assoc()?

461


What are properties in php?

508






Is php free to use?

528


Tell me what does the initials of php stand for?

547


What is an operator in php?

564


For image work which library is used in php?

526


What are the popular frameworks in php?

517


What is php rest api?

524


What are different types of runtime errors in php?

541


How do you create an array in php?

538


What is var_dump function in php?

526


What are major variables in research?

531