What is the best practice for structuring a PHP program which is
becoming too large to manage as a single file? Should it be broken into
a number of includes, e.g.:
switch ($whatever) {
case 0:
include('case0.php');
break;
case 1:
include('case1.php');
brea
John,
part of this is a matter of taste - I would personally rather split this
into functions.
BUT: even if you _are_ using functions, you should only include() the
file with the function when you need it, IF this part of the code is
getting large. This way, php will not need to parse code that
I'd go w/ functions. You can split the functions into as many files as
needed but I wouldn't embed their inclusions in a switch statement. I'm
not quite sure what you need the switch statement for so am assuming
it's part of your applications logic. I'd never write a program as one
giant clump
I would use a combination of both,
Have all of your backend settings (including db info) in one include, and
all of your user customisable settings (if you have any) in another include
and finally another include for all your functions, so that any function is
aviable at anytime.
But this doesn
The way I normally do it is I have ONE main include (usually init.inc)
and then all files that I might need throught my page I put in init.inc
I works nicely for me.
--Joe
On Wed, Feb 14, 2001 at 09:15:35PM +0100, Ben Peter wrote:
> John,
>
> part of this is a matter of taste - I would person
PM
> To: Ben Peter
> Cc: John McCreesh; [EMAIL PROTECTED]
> Subject: Re: [PHP] Structuring large PHP programs
>
>
> The way I normally do it is I have ONE main include (usually init.inc)
> and then all files that I might need throught my page I put in init.inc
>
> I wor
t included?
>
> -Jonathan
>
> > -Original Message-
> > From: Joe Stump [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, February 14, 2001 5:11 PM
> > To: Ben Peter
> > Cc: John McCreesh; [EMAIL PROTECTED]
> > Subject: Re: [PHP] Structuring large PHP programs
&
Any particular reason you don't do something like:
$whatever="blah";
include($whatever);
This eliminates the need for potentially dozens of case/switch statements.
If you're interested, we're developing a more structured way of handling
this with classes, and I could demonstrate some of this to
Message-
> > > From: Joe Stump [mailto:[EMAIL PROTECTED]]
> > > Sent: Wednesday, February 14, 2001 5:11 PM
> > > To: Ben Peter
> > > Cc: John McCreesh; [EMAIL PROTECTED]
> > > Subject: Re: [PHP] Structuring large PHP programs
> > >
> &g
ed?
> > >
> > > -Jonathan
> > >
> > > > -Original Message-----
> > > > From: Joe Stump [mailto:[EMAIL PROTECTED]]
> > > > Sent: Wednesday, February 14, 2001 5:11 PM
> > > > To: Ben Peter
> > > > Cc: John McCreesh; [EMA
Joe,
I believe that the concept of the Zend Cache shows the contrary. It
basically pre-parses scripts and stores them in memory. Zend.com give
figures up to 603% performance increase
(http://www.zend.com/cguidemo/benchmark_frame.html). Part of this
certainly is due to less disk access, the other
Maletsky
-Original Message-
From: John McCreesh [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 5:25 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Structuring large PHP programs
What is the best practice for structuring a PHP program which is
becoming too large to manage as a single
12 matches
Mail list logo