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

Can we override static method?

718


Explain how to execute a php script using command line.

765


Tell us why did you choose this particular career path?

699


What is symfony php?

717


Why do we use query?

688


How many open modes available when a file open in PHP?

877


How can we access the data sent through the url with the post method?

706


Write a select query that will be displayed the duplicated site name and how many times it is duplicated?

766


How to merge values of two arrays into a single array?

716


What is namespaces in PHP?

737


What backslash character will match whitespace?

767


How can you increase the maximum execution time of a script in php?

726


List some features of php that are deprecated in php

680


What is php? Why it is used?

754


What is data type in php?

725