CodeIgniter Forums

Full Version: PHP Class VS CI library
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]transformer[/eluser]
I have learned that CI library is "just" a class (right?). we can make a lot of class instance or object and we can access their function and property of each object. how can we do this with CI custom (or not) library? can we also make a lot of "CI custom (or not) library instance"?

class something
{
public $somevar1;
public $somevar2;
public function somefunction($someparam)
{
//whatever
}
}

$obj1=new class something; //is it same with $obj1=$this->load->library("something");
$obj2=new class something;
//I think we cannot do like this $obj2=$this->load->library("something");

$obj1->somevar1=5; //how can we get/set the library property of each "object"
$obj1->somefunction($someparam); //how can we use the library function of each "object"

or may be there is any other solution??
Thanks before