views:

47

answers:

2

Hello,

My PHP code is split between many files, and often I find myself using code like this this:

require_once( "$preIP/functions.php" );

The problem is that I have to keep using this a lot, and sometimes these statements are becoming redundant.

What kind of system do yo use/would recommend for keeping track of all the inter-dependencies in all the PHP files?

+1  A: 

Might want to take a look at this: autoloading

I've used it several times and it it magically worked so I never looked into it that deep.

Clutch
+1  A: 

One thing you could try is logging all the "require_once" calls to the browser, with something like FirePHP - if you don't want to change all your function calls from require_once to another, you could override the original function using the core code, and include there a call to the FB::log so you see every time a file is included, and where it was included from.

Using eclipse, you can dig right into the source code for PHP, and see what all the functions do, if I recall correctly. There must be a copy online somewhere, but a quick search didnt find it - hope someone comments with a link!

danp