Jump to content

Recommended Posts

When I write code/script I generally rely heavily on classes and create a class in every file which shares the same name as the file (due to my Java background). For example, search.php has a Search class. Well sometimes my classes need to call each other so I have to include the file in every file which calls the class in it. For example require("search.php"); for classes which call my Search class. However, I've had errors where if I require a class in more than one file PHP shoots out an error saying I can't require it more than once. However, I have 2 classes in 2 different files that need to use the class. If I don't specify require in either one I get errors saying it can't find the class. How can I work around this.
[!--quoteo(post=380066:date=Jun 4 2006, 11:08 PM:name=HGeneAnthony)--][div class=\'quotetop\']QUOTE(HGeneAnthony @ Jun 4 2006, 11:08 PM) [snapback]380066[/snapback][/div][div class=\'quotemain\'][!--quotec--]
When I write code/script I generally rely heavily on classes and create a class in every file which shares the same name as the file (due to my Java background). For example, search.php has a Search class. Well sometimes my classes need to call each other so I have to include the file in every file which calls the class in it. For example require("search.php"); for classes which call my Search class. However, I've had errors where if I require a class in more than one file PHP shoots out an error saying I can't require it more than once. However, I have 2 classes in 2 different files that need to use the class. If I don't specify require in either one I get errors saying it can't find the class. How can I work around this.
[/quote]

what about include("whatever.php");
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.