I need to find a way to skip require_once error in case 2 php classes, with same name, are called in a file. I have 2 files a.php and b.php and each of them have class A declared inside. Inside index.php I first include a.php file which has class A declared. Also inside index.php I must include c.php, which inside it has require_once b.php and for this reason I get duplicate classname error and the script is stopped. Can I find a workaround for this? Thanks for your reply
Let me explain it better. Is about Joomla and I build a plugin to overwrite a component models and views. I included my models and views classes in the plugin and Joomla uses them instead of the original component models and views classes. The problem appears when a component module is including the component original models and views classes with require_once. Since my plugin is not using the original models classes, so the file where the original models classes are, is not included inside Joomla, the module require_one is able to include the component model classes, and those classes has the same name as my plugin ones. I can only change my plugin code and classes and not component classes, the second ones.