First I know the basics of PHP
, but I just can't understand how things work. I have the following code which will allow users to assign password to their accounts through the function hooksInit()
by initiating the function init()
. I need to know why using the static variable. I've read that without this static variable there will be a lot of request from database, but I couldn't understand why will be a lot of request from database. Please keep it simple if possible.
class WPHawy_CRP {
private static $_instance = null;
/*
* The Constructor.
*/
public static function init() {
if ( null == self::$_instance ) {
self::$_instance = new self;
self::$_instance->hooksInit();
}
return self::$_instance;
}