views:

301

answers:

0

just some snippet of the code

function __construct() {
   $this->ci = &get_instance();
   ...
   ...
}

function run() {
   foreach($run_2_time as $run){ $this->deduct_user_point(); ... ... }
}

function deduct_user_point() {  
   $this->ci->load->library('user_lib');
   ...
   ...
}

Firstly, i know that by executing $this->ci->load->library, it will create an object of the class but will subsequent call by the foreach loop in run() create a new object. My thought is no, but someone please verify.

And yes, I do know of one other alternative, which is to insert a third parameter into $this->ci->load->library which is unique for every loop,

$this->ci->load->library('user_lib','',$class_name);

and that might solve the problem, but is that the only solution?