Syntax for external functions

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
ngungo
Forum Commoner
Posts: 75
Joined: Thu Jun 08, 2006 10:45 pm

Syntax for external functions

Post by ngungo »

How to make functions only file like a library, then call them externally. I appreciate someone give me a rope. Thanks.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Call them externally? Where would one do such a thing?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

~ngungo what do you mean externally? Do you just mean from outside of the same file?

You can just use require() for that.
ngungo
Forum Commoner
Posts: 75
Joined: Thu Jun 08, 2006 10:45 pm

Post by ngungo »

I got it work now. I have a question though.

Are require() and include() interchageable?
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

read the manual on them. in the short, include will throw an error but not kill the script if i cant find the file. require will kill the script if it can not find the file. i recommend require_once() for all your requireing needs

edit: .....did I just beat feyd!?
Last edited by shiznatix on Mon Aug 21, 2006 7:52 pm, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

There are some slight differences as reading the manual pages on them will detail. As far as most things are concerned, they are interchangeable.
ngungo
Forum Commoner
Posts: 75
Joined: Thu Jun 08, 2006 10:45 pm

Post by ngungo »

Thanks guys! I did read but ... lack of confidence.
Post Reply