Suppose I have the following code:
class siteMS { ... function __CONSTRUCT() { require 'config.php'; $this->config = new siteMSConfig; ... } ... }
From inside the siteMSConfig class can I determine weather or not it is being called from inside the siteMS class?
Yes, but there’s no ‘pretty’ way to do it – you’ll end up looking through a backtrace or something similar.
It would be better to pass an (optional?) parameter to the
siteMSConfigconstructor like this:or alternatively, subclass
siteMSConfig: