Possible Duplicate:
What does it mean to start a PHP function with an ampersand?
Recently I stumbled upon this piece of code:
public static function &get_instance()
{
return self::$instance;
}
What does this kind of function declaration &get_instance() mean? Can the function name be a variable?
It’s part of the singleton pattern, in old-style code.
Singleton is a pattern used to make sure that there is only one instance of a class. (Technically it can be used to make sure that there are a certain number of instances of any class, but that number is almost always one.) It’s one of the Gang of Four patterns and you can find endless discussion of its use and abuse all over the web.