Forum Moderators: coopster

Message Too Old, No Replies

which is more resource muchy?

if (this) { crudloads of content } *or* if (this) { include(crud) }

         

al1911

5:33 pm on Jan 21, 2005 (gmt 0)

10+ Year Member



for the sake of my question, i have a page that has two options...

if ( thingy == 1 ) {
insert heaps and heaps of echos here;
}

else if ( thingy == 2 ) {
insert heaps of more echos here;
}

if i put the heaps and heaps of echos into two external php pages and instead of echoing the content i include(); it, will this significant'y increase the speed at which the page loads? what i mean is, if thingy == 2, does the server have to load all of the content of thingy==1 before it can get to the content it need to display, thus slowing it down?

i don't know if any of this makes sense. please say so if it doesn't

dreamcatcher

5:38 pm on Jan 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You might want to look into a switch statement for what you need. It parses faster than if else statements.

More info at http://www.php.net/manual/en/control-structures.switch.php [php.net]

Slade

6:45 pm on Jan 21, 2005 (gmt 0)

10+ Year Member



I'm a little confused by your question. If you moved the heaps of echo's to an include file, would you still be echo'ing them? Or, would it just be raw text that would be inserted?

Probably your best answer would be to just try it. Set up a scenario and time it. Make sure the duration would be long enough to notice a difference, say 30 seconds to a couple of minutes. Anything under that would be hard to get a meaningful number.