CodeIgniter Forums
PHP Class VS CI library - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forum-22.html)
+--- Thread: PHP Class VS CI library (/thread-47997.html)



PHP Class VS CI library - El Forum - 12-31-2011

[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