views:

15

answers:

1

I have about 20 files containing 10-15 times this:

define('someConstantName','stringBetween10and200Chars');

those are all critical for the app, but each constants-file is parallel to an app page.

For example, index.php will require index_constants.php so on so forth.

The question is, should I make one file of all constant-definitions together, or require different files relatively to the pages they belong to.

I'm asking in terms of speed and efficiency.

Thanks.

A: 

If you are looking for the performance (since a file with useless data will be included whereas the page needs only one) then put a single file for each page but if you looking for ease/simplicity then you can put them in a single file (if you think it will not create any sort of complexity for you). Thanks...

Sarfraz
right, but if i require it once, it will only be slow once.i guess that's something to think about too. just how slow it would be I'm not quite sure.
sombe
@Gal: If you use require_once this will even increase the slowness because php will have first check whether or not the file has been already included. Thanks
Sarfraz