On Wed, 3 Apr 2002, Tamás Árpád wrote:
> >Also, you can find out if a class was defined by calling
> >'class_exists()'. In this way you might save something.
> >The best way thought is what Miguel was saying: load the files
> >conditionally with a logic.
> That's what I'm trying to do, but still searching for the logic.
> But as I see, there's no better way of doing this other than checking if the
> needed classes are defined before every instantiation.

Perhaps you can conjure up some sort of namespace scheme, and then use a 
global array to track which class files have been loaded, or which classes 
have been instantiated, or whatever it is you need to keep track of.

In your file with a dependency:

  global $LOAD_STATUS;
  if (!$LOAD_STATUS['classes-db-queryops'])
     include 'lib/classes/db/queryops.php';

In lib/classes/db/queryops.php:

  global $LOAD_STATUS;
  $LOAD_STATUS['class-db-queryops'] = 1;

Seems fairly cheap to do.

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to