When your PHP app loads, the interpreter comes across the same class declaration more than once.
You can prevent this from happening by either...
- Using include_once or require_once (if multiple inclusions of the same file happen)
- Using namespaces (if you need to use different classes of the same name)
- Using an autoloader class
...or checking if class has already been declared like this:
if(!class_exists('MyClass'))
{
// declare or include class here
}