CodeIgniter Forums

Full Version: Why doesn't CodeIgniter declare its variables?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Bjørn Børresen[/eluser]
Here's a snippet from CI_Base:

Code:
class CI_Base extends CI_Loader {

    function CI_Base()
    {
        // This allows syntax like $this->load->foo() to work
        parent::CI_Loader();
        $this->load =& $this;
        
        // This allows resources used within controller constructors to work
        global $OBJ;
        $OBJ = $this->load; // Do NOT use a reference.
    }
}

In the constructor $this->load is set, but why isn't the variable declared?

I'm trying to get auto-completion to work, and declared variables would help.

El Forum

[eluser]Sean Gates[/eluser]
You mean for autocompletion in your editor?

El Forum

[eluser]Bjørn Børresen[/eluser]
Yes, specifically Zend Studio, or any Eclipse based IDE really...