I am creating custom libraries for a project that I have migrated to the CI structure, and I had a problem when certain classes have the same name.
To get around this problem, I tried to implement namespaces to no avail. I do research, and I know that this would not have been possible in the past, but with a newer version of PHP, I was wondering if there is a way to do this, or if I am doing it right.
CI Version: 2.1.4 PHP Version: 5.4.12
Here is a demonstration of my installation:
applications / libraries / class1.php
<?
class class1{
public function __construct()
{
$CI =& get_instance();
$CI->load->library('foo/class2.php');
}
}
?>
applications / libraries / Foo / class2.php
<?
namespace foo
class class2{
function bar(){
}
}
?>
When I run the CI application, I will get the following error:
Nonexistent class: class2
Thanks for any help.