Instead of include

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
webfinearts
Forum Newbie
Posts: 12
Joined: Tue Sep 30, 2003 12:02 pm
Contact:

Instead of include

Post by webfinearts »

Instead to use include in my scripts, i'm using require and require_once.
What you advice me?
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

require and require_once practicly has the same effect if you're not using loops on anything. I would recommend require() since it'll stop the script once there's an error with the file, not just continue on like include().

-Nay
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Also

Post by phpScott »

There is also include_once that I find quite useful when editing other peoples code and I don't know what is already included in the page(s).

phpScott
User avatar
mudkicker
Forum Contributor
Posts: 479
Joined: Wed Jul 09, 2003 6:11 pm
Location: Istanbul, TR
Contact:

Post by mudkicker »

i use include and include_once if i add only html tags or or something with design and like this or not so important codes. for important and core codes i use require or require_once. The difference between the function and _once is explained by Nay.
Post Reply