View Full Version : Positioning within HTML?

07-19-2012, 09:12 PM
Hi there.

I have a search page with a huge chunk of php that makes it all work. I've managed to group most of the php together and currently have it all sitting in the <head> of the document. Is this the best place for it? I'm going to put in a sperate file and use an 'include' just for tidyness sake when looking at my html.

I'm assuming it doesn't really matter? Performance wise?

07-19-2012, 09:22 PM
No, performance wise, it doesn't matter, as PHP pages are first parsed by the PHP parser, line by line. So if its at the top, it'll get processed first, then the rest is read, posted later, and it reads the beginning first then processes. Its the efficiency of your code that makes a difference.

I, for example, like to put any processing I can at the top of the page, avoiding any double looping by putting any loops wherever they belong, etc.

07-19-2012, 10:19 PM
Cool, thank you.