I've searched for similar questions but didn't find any. The usual problem is that a certain class cannot be redeclared in another class, and so the solution is to use "require_once" or "include_once". But my error is not allowing the class itself to redeclared!
Let me explain, I have two classes, Design
and DesignSide
.
I have a bunch of PHP files where I use these two classes.
- build_design.php,
- browse_designs.php, which gives an AJAX call to
- load_designs.php
Each design can have a few sides to it, so all 3 files above include the line:
require_once("Design.php");
and Design.php
has the line:
require_once("DesignSide.php");
But on build_design.php, my error is:
Fatal error: Cannot redeclare class DesignSide in ../classes/DesignSide.php on line 4
i.e. it's objecting to DesignSide declaring itself! These are the beginning lines of DesignSide:
<?php
class DesignSide
{
private $id;
private $data;
private $designtag;
private $side;
What's wrong?