• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net

1 vs. several files for a script (PHP)

Cheap Bastard

New Member
is it better (for execution, not programming) to get everything into one file (say index.php) or into several files (say index.php, authorize.php, config.php, admin.php, track.php, submit.php,...)
 

vorapoap

New Member
I agree to to important.. and it will make your file become reusable. .. think of it as a small module..
 

Cheap Bastard

New Member
right... but i was talking executably speaking, not programming speaking. I know it's harder on the programmer, but i really don't care.

I'm just wondering if one big file (with switch statements and if-else's) has faster executing speed (or the same) as putting it into 2800 different files... Knowing of course that every action would have it's own name... Not too far subdivided. It just makes it a lot less messy to the end user.
 

xsnetwork

New Member
I may be wrong but I think that it may take a while to load at first as the whole page will have to be loaded and then the bits before the if/else tags displays the bit which is needed.... at least that's case with asp, and I am no php programmer
 

roblev

New Member
Originally posted by Cheap Bastard
right... but i was talking executably speaking, not programming speaking. I know it's harder on the programmer, but i really don't care.

I'm just wondering if one big file (with switch statements and if-else's) has faster executing speed (or the same) as putting it into 2800 different files... Knowing of course that every action would have it's own name... Not too far subdivided. It just makes it a lot less messy to the end user.
It is better for you to use many files for your website because I used to have my website where I had 1 file my whole site, which was about 15 KB. It loaded slowly. But when I divided up into 7 different files, it flew. I am a believer of the include statement!
 

spec

New Member
you should split your scripting into files, but i recommend not leaving query statements all together. Split the pages by function (not PHP functions, but function in the literal term) IE say u have a sign up, login, and somthing else(lol). make 3 pages one for each. BUT say your login page is 5 steps long. Do not split it into pages, b/c that is insane!
 

Woofcat

New Member
For fastest execution you would put everyting in its own file...

A switch or if with 2800 options parsing every time a page is served is not a good thing...
 
Top