Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 08-17-2007, 05:11 PM require_once()
Extreme Talker

Posts: 182
Trades: 0
I have another one for you all. Maybe this one will get some more responses...

Can you overuse require_once()? I want to be sure every part of my app can stand on it's own.

Example:

In my header file I also include my database connection and other configurations. The db connection and other configurations are obviously used by other parts of the app. So if I was doing some testing or something and didn't include my header file, I would still want that part of the app to work; require_once() would save the day.

So is there a downside or any cautions to using it too much? I couldn't find any myself but I was just curious.

Thanks
bhgchris is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-17-2007, 05:42 PM Re: require_once()
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
Nope, there is nothing like that.
Any call to require() can be replaced with require_once(), with this mega advantage that you don't risks to double include a file.

It's especially useful when you include a class or a file with only functions, as you would have an error if you included 2 times a file containing the same function / class name.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 08-18-2007, 11:53 AM Re: require_once()
Extreme Talker

Posts: 182
Trades: 0
That's exactly what I was talking about, requiring classes and function libraries. Thanks!
bhgchris is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to require_once()
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.97904 seconds with 12 queries