• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 672
  • Last Modified:

Fatal error: Cannot redeclare class email

Fatal error: Cannot redeclare class email

A bit vague I know but can any1 give me any hints as to why I'm getting this error......

I only ever declare an email class once...........

any ideas?
0
scm0sml
Asked:
scm0sml
  • 4
  • 3
1 Solution
 
snoyes_jwCommented:
Most likely, the class definition is in a file that you include or require, and some other included file also includes or requires that file.  Use include_once or require_once instead.
0
 
scm0smlAuthor Commented:
yeah your right......

In this file I include:
  include "../includes/classes/Owner.php";
&
  include "../includes/classes/Email.php";

But the owner class also includes the email class.

So are you saying that I do not need to include the email class in this file because it will be usable having included it in the owner class?
0
 
scm0smlAuthor Commented:
yeah that works...........wouldn't even have thought of that!!

cheers!
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
snoyes_jwCommented:
Right, once it's included, it's available throughout.  But you can use the special include_once instead of include, so you don't have to worry about whether or not your included it already.
0
 
scm0smlAuthor Commented:
include_once"../includes/classes/Owner.php";

like that?
0
 
snoyes_jwCommented:
yep
0
 
scm0smlAuthor Commented:
thanks a lot.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now