I don't know about the efficiency .. but to do it .. you can use
function_exists() to see if a function is already defined if not include the
file for that function before using a function.


----- Original Message -----
From: "Dave [Hawk-Systems]" <[EMAIL PROTECTED]>
Sent: Wednesday, December 11, 2002 10:40 AM
Subject: [PHP] Automatic include of files containing functions

> On a few sites we have used a master include or function file containing
all the
> unctions required for the site...  Some of these function files may
> 30-40 functions and some pages use only 1 function from the file.
> Would like to be a little more dynamic in our approach of this, and have
> moving all the functions into their own files...  for example moving
> from the functions.php file to a connectdb.php or connectdb.inc file.
> Then for any particular php page, we would pull in only the functions that
> need for that particular page.  From a script/function management
> this would be ideal.
> Questions//
> What would this do as far as speed and efficiency (having to load 4 or 5
> includes/requires rather than one larger include that has 25 functions
> aren't needed or used)?
> Then the hard one...
> Is there a way to have the PHP script dynamically pull in the required
> files?  for example, have a function at the top of each page to include
> files required as a result of functions that exist in the script...  ie:
> page uses abc() 123() and so it include/require ./includes/abc.php and
> ./includes/123.php which contain the appropriate functions.
> OR
> is there an easier way to manage what is becoming an over abundance of
> for particular sites.
> Have gotten in the habit of creating a function for anything I have to do
> than 1 or 2 times on seperate pages just to speed and simplify code from a
> design and readability point of view.
> Appreciate any comments.
> Dave
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to