Re: Multiple Includes vs. One Long Include (Functions)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2006-08-08 at 13:30 -0700, Kevin Murphy wrote:
> I was just wondering if there was any thought one way or another on  
> the best practice for doing this.
> 
> Lets say I have 10 functions that I want to reuse on my site. Not  
> every page needs every function. So I move the function to an  
> external page and then require it for the page.
> 
> The question is, is it better to have all 10 of those functions in a  
> single file that is called once from each PHP page, even though some  
> will not be used, or is it better to put one function per include and  
> then on each PHP page call just the functions that I need for that page?
> 
> require ("all10.php"); // one long page, but only called once.
> 
> vs.
> 
> require ("function1.php");	// multiple short pages with multiple calls.
> require ("function2.php");
> require ("function4.php");
> require ("function6.php");
> require ("function8.php");

Don't think in terms of one function per file. Think in terms of groups
of related functions per file and you'll be happy.

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux