Consider this example singleton class:
class Model_Acl
{
protected static $_instance;
private function __construct($a) {
echo $a;
}
public static function getInstance()
{
if(!isset(self::$_instance)) {
self::$_instance = new Model_Acl('hello world');
}
return self::$_instance;
}
}
In the static method of the same class, I am able to initialize the class to which constructor is private. Does that mean the scope of class initialization becomes local when trying to instantiate object within the class?
I will appreciate if someone could explain the behaviour of PHP when it comes to class instantiation with reference to access modifiers.