Function usage

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
howard555
Forum Newbie
Posts: 1
Joined: Wed Oct 28, 2009 7:10 am

Function usage

Post by howard555 »

How do I make user defined functions available to multiple scripts ?

Everything I have seen on functions implies that they are used only in the script which contains them, which is not very useful, unless you have a repetitive task in that script.

I would like to use my functions in the same manner as PHP's built-in ones.

Thanks,
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: Function usage

Post by Mark Baker »

Put your functions in a separate .php file (e.g functions.php)
And include that file at the top of each script that needs to use any of the functions
Post Reply