Forum Moderators: coopster
The only option left to you is to write them as objects that can be called anytime.
You copy your PHP file with all your functions to /usr/local/lib/php/ (we'll call it customfunctions.php). Then, in your php.ini, search for auto_prepend_file, and set it to :
auto_prepend_file = customfunctions.php
(Thanks to my buddy Justin/PyroX)
-panic
As the manual sez
auto_prepend_file.Specifies the name of a file that is automatically parsed before the main file. The file is included as if it was called with the include() function, so include_path is used.
You say you want to
use those functions without having to require/include/etc another PHP file
which you aren't really achieving. What you are doing is saving yourself the trouble of putting a require/include statement in every page header, but it isn't quite the same as achieving what you state in your post. That may seem like stupid nitpicking (okay, so it probably IS stupid nitpicking), but I only mean to say that your server overhead should be very similar whether you autoprepend or do it manually, so it will achieve half of your result (less coding) but not the other half implied by your question (reduced overhead by not including functions unless you need them).
Tom
What you are doing is saving yourself the trouble of putting a require/include statement in every page header
That's the whole idea.
but it isn't quite the same as achieving what you state in your post.
Actually, it is.
...reduced overhead by not including functions unless you need them
That's not an issue since it's only for internal use, and I'll be the only one using it. And besides, an extra kilobyte wont hurt you at all if you're running everything localhost.
-panic
gg
Interpreting your post to the letter (according to what it said), lorax was right. Interpreting it according to your intent, lorax was wrong, but your intent wasn't clear.
Doesn't really matter as long as you're happy with the solution though.
Tom