Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Selectively including classes
I'm currently working on a project which contains many classes. Each class is written in a separate file. Each file which I work on has included classes in it. Some classes rely on others and those classes also include files. What I want to do is to stop receiving the "cannot redeclare class" error. Is there any way of doing this? (I can get rid of them, but I have to work out file dependencies and it's slooow).
I'm thinking along the lines of the C++ '#ifndef and #include' directives to stop multiple includes.
If this is not possible then, is there any way in which this can be done by writing a little code in PHP to check to see if the file has already been included by PHP and if so prevent it from being included again.
Please help, (otherwise I'll have to spend ages trying to code round the problem :-( )
"Let us smite the evil slime eating hordes who may befall us on our quest to be the ultimate programmers of the known universe!"